/*
 * Final UI refinements v4 (docs/prompts/CLAUDE_FINAL_UI_REFINEMENTS_PROMPT_v4.md), loaded last on every page.
 *
 * 1. Palette: owner-approved UI colours. Softer dark #153F3A for headings, buttons and structural text; deep teal
 *    #00566C and bright teal #00AEB1 as visible structural colours; tint #EAF3F2; white. The near-black #022319
 *    stays for the logo files and small accents only. Logo files are not recoloured.
 * 2. Dark mode: blue-teal base #0D2B34, surfaces #123D43, bright teal interactive accents, off-white text.
 * 3. Layers: explicit stacking order for the utility bar, the sticky header and their menus.
 * 4. Completed state (partials/done_state.html).
 */

:root {
  --ui-ink: #153F3A;
  --ui-ink-rgb: 21, 63, 58;
  --ui-deep-teal: #00566C;
  --ui-teal: #00AEB1;
  --ui-teal-strong: #008C8F;   /* bright teal darkened for text on white (4.6:1) */
  --ui-teal-on-dark: #5FD6D8;  /* bright teal lightened for text on dark surfaces */
  --ui-tint: #EAF3F2;
  --ui-darkest: #022319;

  /* Layers: page content < decorative hero layers < header < utility bar (and its menus) < overlays. */
  --layer-content: 0;
  --layer-header: 1020;
  --layer-topbar: 1030;
  --layer-popover: 1040;
}

/* ---------------------------------------------------------------- Light tokens */
:root:not([data-theme="dark"]) {
  --rdi-deep-teal: var(--ui-deep-teal);
  --rdi-deep-teal-rgb: 0 86 108;
  --rdi-dark-blue-green: var(--ui-ink);
  --rdi-dark-blue-green-rgb: 21 63 58;
  --rdi-light-background: var(--ui-tint);
  --rdi-color-text: var(--ui-ink);
  --rdi-color-heading: var(--ui-ink);
  --rdi-color-link: var(--ui-deep-teal);
  --rdi-color-primary: var(--ui-ink);
  --rdi-color-focus: var(--ui-deep-teal);
  --color-text: var(--ui-ink);
  --color-heading: var(--ui-ink);
  --color-border: #CFE1DE;
  --color-text-muted: #3F5F5B;

  --bg-alt: var(--ui-tint);
  --bg-app: #F3F8F7;
  --surface-inset: var(--ui-tint);
  --text: var(--ui-ink);
  --text-muted: #3F5F5B;
  --heading: var(--ui-ink);
  --link: var(--ui-deep-teal);
  --link-hover: var(--ui-ink);
  --accent: var(--ui-teal);
  --icon-bg: var(--ui-tint);
  --icon-fg: var(--ui-deep-teal);
  --action-bg: var(--ui-ink);
  --action-hover-bg: var(--ui-deep-teal);
  --secondary-fg: var(--ui-deep-teal);
  --secondary-border: var(--ui-deep-teal);
  --secondary-hover-bg: var(--ui-deep-teal);
  --focus: var(--ui-deep-teal);
  --info-fg: var(--ui-deep-teal);
  --band-bg: var(--ui-ink);
  --footer-bg: var(--ui-ink);
  --sidebar-bg: var(--ui-deep-teal);
  --border: rgb(0 86 108 / 0.16);
  --border-strong: rgb(0 86 108 / 0.4);
  --bs-body-color-rgb: 21, 63, 58;
  --bs-primary: var(--ui-ink);
  --bs-primary-rgb: 21, 63, 58;
  --bs-link-color-rgb: 0, 86, 108;
  --bs-link-hover-color-rgb: 21, 63, 58;
  --bs-focus-ring-color: rgb(0 86 108 / 0.35);
}
:root:not([data-theme="dark"]) .btn-primary { --bs-btn-bg: var(--ui-ink); --bs-btn-border-color: var(--ui-ink); --bs-btn-hover-bg: var(--ui-deep-teal); --bs-btn-hover-border-color: var(--ui-deep-teal); --bs-btn-active-bg: var(--ui-deep-teal); --bs-btn-active-border-color: var(--ui-deep-teal); }

/* ---------------------------------------------------------------- Dark tokens: blue-teal, not a wall of green */
[data-theme="dark"] {
  --rdi-color-bg: #0D2B34;
  --rdi-color-surface: #123D43;
  --rdi-color-text: #F1F7F6;
  --rdi-color-heading: #FFFFFF;
  --rdi-color-link: var(--ui-teal-on-dark);
  --rdi-color-focus: var(--ui-teal-on-dark);
  --color-text: #F1F7F6;
  --color-text-muted: #C3D8D7;
  --color-surface: #123D43;
  --color-background: #0D2B34;
  --color-border: #2A5A61;

  --bg: #0D2B34;
  --bg-alt: #10333C;
  --bg-app: #0D2B34;
  --surface: #123D43;
  --surface-inset: #0F343C;
  --band-bg: #0A232B;
  --footer-bg: #0A232B;
  --sidebar-bg: #123D43;
  --border: rgb(255 255 255 / 0.14);
  --border-strong: rgb(255 255 255 / 0.36);
  --text: #F1F7F6;
  --text-muted: #C3D8D7;
  --heading: #FFFFFF;
  --link: var(--ui-teal-on-dark);
  --link-hover: #FFFFFF;
  --accent: var(--ui-teal);
  --icon-bg: #0F343C;
  --icon-fg: var(--ui-teal-on-dark);
  --action-bg: var(--ui-teal);
  --action-fg: #0D2B34;
  --action-hover-bg: #3CC5C8;
  --action-hover-fg: #0D2B34;
  --secondary-fg: #FFFFFF;
  --secondary-border: rgb(255 255 255 / 0.6);
  --focus: var(--ui-teal-on-dark);
  --info-bg: #0F3A44;
  --info-fg: #CDEFF0;
  --muted-bg: #1A4A51;
  --disabled-bg: #1A4A51;
  --bs-body-color-rgb: 241, 247, 246;
  --bs-link-color-rgb: 95, 214, 216;
  --bs-focus-ring-color: rgb(0 174 177 / 0.45);
}
[data-theme="dark"] .btn-primary { --bs-btn-bg: var(--ui-teal); --bs-btn-border-color: var(--ui-teal); --bs-btn-color: #0D2B34; --bs-btn-hover-bg: #3CC5C8; --bs-btn-hover-border-color: #3CC5C8; --bs-btn-hover-color: #0D2B34; --bs-btn-active-bg: #3CC5C8; --bs-btn-active-border-color: #3CC5C8; --bs-btn-active-color: #0D2B34; }
[data-theme="dark"] .service-card.is-featured, [data-theme="dark"] .legal-band, [data-theme="dark"] .auth-card { background: #123D43; }
[data-theme="dark"] .mega-column:hover, [data-theme="dark"] .mega-column:focus-within { background: rgb(0 174 177 / 0.1); }
[data-theme="dark"] .dropdown-menu { --bs-dropdown-bg: #123D43; --bs-dropdown-border-color: rgb(255 255 255 / 0.16); --bs-dropdown-link-color: #F1F7F6; --bs-dropdown-link-hover-bg: rgb(0 174 177 / 0.16); --bs-dropdown-link-hover-color: #FFFFFF; --bs-dropdown-link-active-bg: var(--ui-teal); --bs-dropdown-link-active-color: #0D2B34; }
.auth-aside { background: var(--ui-ink); }
[data-theme="dark"] .auth-aside { background: #0A232B; }

/* ---------------------------------------------------------------- Layers (language menu fix)
 * Cause of the bug: the utility bar was not positioned, so its language menu (z-index 1000) joined the root stacking
 * context, while the sticky header that follows it in the page creates its own context (sticky + z-index +
 * backdrop-filter) and painted over the menu. The bar is now its own positioned layer above the header, so every
 * menu it contains stays above the header, the navigation and the hero. No ancestor clips it (no overflow). */
.gov-bar { position: relative; z-index: var(--layer-topbar); }
.header { z-index: var(--layer-header); }
.app-topbar { z-index: var(--layer-header); }
.gov-bar .dropdown-menu, .app-topbar .dropdown-menu, .header .dropdown-menu { z-index: var(--layer-popover); }
.lang-switch .dropdown-menu { min-inline-size: 10rem; margin-block-start: 0.35rem; box-shadow: var(--shadow-overlay); border-radius: var(--radius); padding: 0.35rem; }
.lang-switch .dropdown-item { border-radius: var(--radius-sm); font-weight: 600; }
.lang-switch .dropdown-item[aria-current="true"] { background: var(--surface-inset); color: var(--heading); }
.lang-switch .dropdown-item[aria-current="true"]::after { content: "\F26E"; font-family: "bootstrap-icons"; margin-inline-start: 0.5rem; color: var(--ui-teal-strong); }
[data-theme="dark"] .lang-switch .dropdown-item[aria-current="true"]::after { color: var(--ui-teal-on-dark); }
.dropdown-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ---------------------------------------------------------------- Completed state */
.done-state { display: flex; align-items: center; gap: 0.85rem; margin-block-end: 1rem; padding: 0.85rem 1.1rem; border: 1px solid color-mix(in srgb, var(--ui-teal) 55%, transparent); border-inline-start: 4px solid var(--ui-teal); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--ui-teal) 9%, var(--surface, #fff)); color: var(--text); animation: done-in 0.28s ease-out; }
.done-state--compact { padding: 0.5rem 0.75rem; gap: 0.6rem; font-size: 0.9375rem; }
.done-check { flex: none; inline-size: 2.25rem; block-size: 2.25rem; }
.done-state--compact .done-check { inline-size: 1.6rem; block-size: 1.6rem; }
.done-check-ring { fill: var(--ui-teal); }
.done-check-mark { fill: none; stroke: #FFFFFF; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 22; stroke-dashoffset: 0; animation: done-draw 0.45s 0.12s ease-out backwards; }
[data-theme="dark"] .done-check-mark { stroke: #0D2B34; }
.done-text p { margin: 0; }
.done-title { font-weight: 700; color: var(--heading); }
.done-message { font-weight: 600; }
@keyframes done-draw { from { stroke-dashoffset: 22; } to { stroke-dashoffset: 0; } }
@keyframes done-in { from { transform: translateY(-4px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .done-state, .done-check-mark { animation: none !important; }
}

/* ---------------------------------------------------------------- Contact: ministry section and map */
.ministry-section { background: var(--bg-alt); border-block-start: 1px solid var(--border); padding-block: var(--space-section); }
.ministry-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(1.25rem, 3vw, 2.5rem); align-items: stretch; }
.ministry-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: clamp(1.25rem, 3vw, 2rem); box-shadow: 0 8px 24px rgb(var(--ui-ink-rgb) / 0.06); }
.ministry-name { font-size: clamp(1.25rem, 2.2vw, 1.625rem); line-height: 1.3; margin-block-end: 1rem; }
.ministry-website { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-weight: 700; padding: 0.55rem 0.9rem; border: 1.5px solid var(--secondary-border); border-radius: 999px; text-decoration: none; transition: background-color 0.2s ease, color 0.2s ease; }
.ministry-website bdi { font-weight: 500; opacity: 0.85; }
.ministry-website:hover, .ministry-website:focus-visible { background: var(--ui-deep-teal); border-color: var(--ui-deep-teal); color: #FFFFFF; }
[data-theme="dark"] .ministry-website:hover, [data-theme="dark"] .ministry-website:focus-visible { background: var(--ui-teal); border-color: var(--ui-teal); color: #0D2B34; }
.ministry-map { margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.ministry-map-title { font-family: var(--font-heading); font-weight: 700; font-size: 1.0625rem; color: var(--heading); display: inline-flex; align-items: center; gap: 0.45rem; }
.ministry-map-title .bi { color: var(--ui-teal-strong); }
[data-theme="dark"] .ministry-map-title .bi { color: var(--ui-teal-on-dark); }
.ministry-map .contact-map { flex: 1; min-block-size: 18rem; aspect-ratio: 16 / 10; border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 8px 24px rgb(var(--ui-ink-rgb) / 0.08); overflow: hidden; background: var(--surface-inset); }
.ministry-map .contact-map iframe { inline-size: 100%; block-size: 100%; border: 0; display: block; }
@media (max-width: 991.98px) {
  .ministry-grid { grid-template-columns: 1fr; }
  .ministry-map .contact-map { aspect-ratio: 4 / 3; min-block-size: 0; }
}

/* ---------------------------------------------------------------- Notes pass (2026-11): New badge and logo green
 * New badge: warm amber (#F2B84B) with dark text (contrast 9.6:1), two soft pulses on first appearance, then still.
 * Bright logo green (#06F9BA, from the approved mark) is used sparingly: the hero primary action, the header
 * sign-in button and active controls. Other buttons keep the softer dark / deep teal system. */
:root { --ui-amber: #F2B84B; --ui-amber-ink: #3A2600; --ui-logo-green: #06F9BA; --ui-logo-green-hover: #2BE3B3; }
.nav-badge, [data-theme="dark"] .nav-badge { color: var(--ui-amber-ink); background: var(--ui-amber); box-shadow: 0 0 0 0 rgb(242 184 75 / 0.6); animation: badge-pulse 1.4s ease-out 0.6s 2; }
@keyframes badge-pulse { 0% { box-shadow: 0 0 0 0 rgb(242 184 75 / 0.6); } 100% { box-shadow: 0 0 0 7px rgb(242 184 75 / 0); } }
html:root .h3-hero .h3-actions .btn-primary, html:root .header-actions > .btn-primary {  /* beats the theme button rules */
  --bs-btn-bg: var(--ui-logo-green); --bs-btn-border-color: var(--ui-logo-green); --bs-btn-color: #0D2B34;
  --bs-btn-hover-bg: var(--ui-logo-green-hover); --bs-btn-hover-border-color: var(--ui-logo-green-hover); --bs-btn-hover-color: #0D2B34;
  --bs-btn-active-bg: var(--ui-logo-green-hover); --bs-btn-active-border-color: var(--ui-logo-green-hover); --bs-btn-active-color: #0D2B34;
}
.appearance-switch button[aria-pressed="true"], .on-band .appearance-switch button[aria-pressed="true"] { background: var(--ui-logo-green); color: #0D2B34; }
.navmenu .nav-link::after { background: var(--ui-logo-green); }
.done-check-ring { fill: var(--ui-teal); }
@media (prefers-reduced-motion: reduce) {
  .nav-badge { animation: none !important; }
}
/* "Missing" and other danger text stay red, lightened on the dark surfaces for contrast (6:1 on #123D43). */
[data-theme="dark"] .text-danger { color: #FF9C9C !important; }

/* ---------------------------------------------------------------- Public user guide: contextual help links */
.guide-help-row { margin: 0.35rem 0 0.75rem; }
.guide-help { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; font-weight: 600; color: var(--link); text-decoration: none; border-block-end: 1px dashed currentColor; padding-block-end: 1px; }
.guide-help:hover, .guide-help:focus-visible { color: var(--link-hover); border-block-end-style: solid; }
.guide-help .bi { font-size: 1rem; }
.guide-help-lang { font-weight: 500; opacity: 0.8; }
.guide-callout { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; align-items: center; padding: 0.85rem 1rem; border-radius: var(--radius-lg); border: 1px solid var(--border); border-inline-start: 4px solid var(--ui-teal); background: var(--surface-inset); }
.h3-guide-link { margin: 1rem 0 0; font-size: 0.95rem; color: var(--h3-ink-soft, var(--text-muted)); }
.h3-guide-link a { font-weight: 700; display: inline-flex; gap: 0.4rem; align-items: center; }

/* Featured service on the authenticated dashboard and catalog (Innovate or Pay). Colours come from the approved
   v2 palette: amber (Innovate or Pay accent) for the card, plum for the "New" badge. */
.featured-service { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem 1.25rem; margin-block-end: 1rem; padding: clamp(1rem, 2.5vw, 1.5rem); background: linear-gradient(135deg, var(--surface-white) 35%, var(--surface-amber)); border: 2px solid var(--innovation-amber); border-inline-start-width: 6px; border-radius: 12px; box-shadow: 0 6px 20px rgb(214 163 58 / 0.18); color: var(--startup-deep-green); }
.featured-service .featured-icon { display: inline-grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%; background: var(--innovation-amber); color: var(--startup-deep-green); font-size: 1.5rem; }
.featured-service .featured-title { font-family: "Sora", var(--bs-font-sans-serif); font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 700; margin: 0 0 0.25rem; color: var(--startup-deep-green); }
.featured-service .featured-summary { margin: 0; color: #42675A; }
.featured-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 0.35rem; font-size: 0.8125rem; font-weight: 600; color: var(--innovation-amber-text); }
.badge-new { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--innovation-plum); color: #FFFFFF; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; animation: badge-new-pulse 2.6s ease-in-out infinite; }
:lang(ar) .badge-new { text-transform: none; letter-spacing: 0; }
.featured-actions { display: flex; flex-direction: column; align-items: stretch; gap: 0.5rem; max-width: 18rem; }
.featured-cta { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; font-weight: 700; white-space: nowrap; }
.featured-cta:focus-visible, .featured-service a:focus-visible { outline: 3px solid var(--color-focus, #0B5C66); outline-offset: 3px; }
.featured-note { margin: 0; font-size: 0.8125rem; color: var(--innovation-amber-text); }
.service-choice.is-featured { border: 2px solid var(--innovation-amber); background: linear-gradient(160deg, var(--surface-white) 45%, var(--surface-amber)); box-shadow: 0 6px 20px rgb(214 163 58 / 0.18); }
.service-choice.is-featured .rdi-icon { background: var(--innovation-amber); color: var(--startup-deep-green); }
.org-verification-notice { display: flex; gap: 0.75rem; align-items: flex-start; margin-block-end: 1rem; padding: 0.85rem 1rem; border-radius: 8px; border: 1px solid var(--innovation-amber); border-inline-start-width: 4px; background: var(--surface-amber); color: var(--startup-deep-green); }
.org-verification-notice > i { font-size: 1.15rem; color: var(--innovation-amber-text); }
.org-verification-notice.is-rejected { border-color: var(--innovation-plum); background: var(--surface-plum); }
.org-verification-notice.is-rejected > i { color: var(--innovation-plum); }
@keyframes badge-new-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(122 45 102 / 0.45); } 50% { box-shadow: 0 0 0 6px rgb(122 45 102 / 0); } }
@media (prefers-reduced-motion: reduce) { .badge-new { animation: none; } }
[data-theme="dark"] .featured-service { background: linear-gradient(135deg, #10382D 35%, rgb(214 163 58 / 0.18)); border-color: #E5B84A; color: #FFFFFF; box-shadow: none; }
[data-theme="dark"] .featured-service .featured-title { color: #FFFFFF; }
[data-theme="dark"] .featured-service .featured-summary { color: #D5E9E0; }
[data-theme="dark"] .featured-service .featured-icon, [data-theme="dark"] .service-choice.is-featured .rdi-icon { background: #E5B84A; color: #022319; }
[data-theme="dark"] .featured-kicker, [data-theme="dark"] .featured-note, [data-theme="dark"] .org-verification-notice > i { color: #F3D98A; }
[data-theme="dark"] .service-choice.is-featured { background: linear-gradient(160deg, #10382D 45%, rgb(214 163 58 / 0.16)); border-color: #E5B84A; }
[data-theme="dark"] .org-verification-notice { background: rgb(214 163 58 / 0.12); border-color: #E5B84A; color: #FFFFFF; }
[data-theme="dark"] .org-verification-notice.is-rejected { background: rgb(184 90 159 / 0.16); border-color: #B85A9F; }
[data-theme="dark"] .org-verification-notice.is-rejected > i { color: #E7B3DA; }
@media (max-width: 991.98px) {
  .featured-service { grid-template-columns: auto 1fr; }
  .featured-service .featured-actions { grid-column: 1 / -1; max-width: none; flex-direction: row; flex-wrap: wrap; align-items: center; }
}
@media (max-width: 575.98px) {
  .featured-service { grid-template-columns: 1fr; }
  .featured-service .featured-icon { width: 2.75rem; height: 2.75rem; font-size: 1.25rem; }
  .featured-service .featured-actions { flex-direction: column; align-items: stretch; }
  .featured-cta { white-space: normal; }
}
