/* The government look of the three organisation themes (themeFor in internal/web sets theme-cspd, theme-mofa or
 * theme-platform on the html element, /static/brand.css holds the palette of each): the slim government bar with the
 * national four colour stripe, the formal header, sidebar brand block and footer, calmer headings and squarer shapes
 * on an 8px grid, and document like verification panels with a seal ring around the outcome icon. Linked after
 * app.css and payment.css, before brand.css. Colors only through the custom properties, which TestContrast checks in
 * every theme and both schemes: the text pairs used here are pairs of contrastPairs. */
:root {
  --radius: 8px;
  --radius-card: 12px;
  --radius-big: 16px;
  --stripe: linear-gradient(90deg, var(--flag-black) 0 25%, var(--flag-white) 25% 50%, var(--flag-green) 50% 75%, var(--flag-red) 75% 100%);
  --stripe-size: 4px;
}

/* Typography: stronger headings, a ruled page head. */
h1, h2 { font-weight: 700; letter-spacing: -0.01em; }
h3 { font-weight: 600; }
.page-head { padding-block-end: 1rem; border-block-end: 1px solid var(--line); }
.page-head h1 { padding-inline-start: 0.75rem; border-inline-start: 4px solid var(--primary); }

/* The government bar: the stripe on its top edge, the kingdom in both languages and the language switch. The stripe
 * is fixed to the viewport, so the bar and the sidebar brand block show one continuous stripe. */
.gov-bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  min-block-size: 3rem;
  padding: calc(0.25rem + var(--stripe-size)) 1.5rem 0.25rem;
  color: var(--on-dark);
  background: var(--primary);
  font-size: 0.8125rem;
}
.gov-bar::before, .brand-block::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: var(--stripe-size);
  background: var(--stripe) fixed;
}
.gov-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 1rem; margin: 0; font-weight: 600; letter-spacing: 0.02em; }
.gov-other { color: var(--on-dark-muted); font-weight: 500; }
.gov-bar .lang-switch { gap: 0.5rem; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.gov-bar .lang-head, .gov-bar .lang-head .icon { color: var(--on-dark); }
.gov-bar .lang-track { background: none; border: 1px solid var(--on-dark-muted); border-radius: var(--radius); }
.gov-bar .lang-opt { color: var(--on-dark); border-radius: 2px; }
.gov-bar .lang-opt:hover { color: var(--on-dark); background: var(--primary-dark); }
.gov-bar .lang-opt[aria-current="true"], .gov-bar .lang-opt[aria-current="true"]:hover { color: var(--primary); background: var(--bg); box-shadow: none; }
.gov-bar :focus-visible { outline-color: var(--focus-on-dark); }

/* Organisation marks: the official logo when configured, else the placeholder monogram. */
.org-mark { inline-size: 2.75rem; block-size: 2.75rem; flex: none; }
.org-mark .om-ring { stroke: var(--brand-cyan); }
.org-logo { inline-size: auto; max-inline-size: 8rem; object-fit: contain; }
.org-pair { display: inline-flex; flex: none; gap: 0.25rem; }
.org-pair .org-mark { inline-size: 2.25rem; block-size: 2.25rem; }

/* Sidebar brand block: the organisation of the role, large enough to read. */
.brand-block { padding: calc(1.25rem + var(--stripe-size)) 1.25rem 1.5rem; }
.brand-block .org-mark { inline-size: 3.25rem; block-size: 3.25rem; }
.brand-block .org-pair .org-mark { inline-size: 2.5rem; block-size: 2.5rem; }
.brand-block .brand { align-items: flex-start; }
.brand-block .brand-name { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.brand-block .brand-sub { margin-block-start: 0.25rem; }
.nav-item[aria-current="page"] { border-inline-start: 4px solid var(--brand-cyan); padding-inline-start: calc(0.75rem - 4px); }

/* The formal top bar of the signed-in pages: the section title and the mark of the organisation. */
.topbar { min-block-size: 4rem; padding-block: 0.5rem; background: var(--bg); border-block-end: 3px solid var(--brand-cyan); backdrop-filter: none; }
.topbar-title { font-size: 1.125rem; font-weight: 700; }
.topbar-mark { gap: 0.5rem; font-size: 0.875rem; font-weight: 700; }
.topbar-mark .org-mark { inline-size: 2.5rem; block-size: 2.5rem; }

/* Signed-out pages: a calm page color, a formal white header and plain cards instead of glass. */
body.public { background: var(--page); }
.public-top { padding: 1rem 1.5rem; background: var(--bg); border-block-end: 1px solid var(--line); box-shadow: var(--shadow); }
.public-top .brand-name { font-size: 1.25rem; font-weight: 700; }
.public-nav a { border-radius: var(--radius); }
.public-nav a:hover { background: var(--hover); }
.public-nav a[aria-current="page"] { background: var(--hover); box-shadow: inset 0 -3px 0 var(--primary); }
.public-main { padding-block-start: 2rem; }
.big-card { background: var(--bg); border-color: var(--line); box-shadow: var(--shadow); }

/* The sign-in card of the joint platform: the stripe on top, both organisation marks above the platform name. */
.grad-bar, [dir="rtl"] .grad-bar { block-size: var(--stripe-size); background: var(--stripe); }
.pill-divider, [dir="rtl"] .pill-divider { inline-size: 4rem; block-size: var(--stripe-size); border-radius: 0; background: var(--stripe); box-shadow: 0 0 0 1px var(--line); }
.auth-card .logo-box { flex-direction: column; gap: 0.75rem; text-align: center; background: var(--surface); }
.auth-card .logo-box .brand-text { align-items: center; }
.auth-card .logo-box .org-pair { gap: 0.75rem; }
.auth-card .logo-box .org-pair .org-mark { inline-size: 3.5rem; block-size: 3.5rem; }

/* Formal footer of the signed-out pages: the issuing organisations and the main links. */
.public-footer { margin-block-start: 2rem; padding: 2rem 1.5rem 1.5rem; color: var(--fg); background: var(--bg); border-block-start: 4px solid var(--primary); text-align: start; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem 3rem; max-inline-size: 75rem; margin-inline: auto; }
.public-footer .footer-head { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.footer-orgs ul, .footer-nav ul { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.footer-orgs li { display: flex; align-items: center; gap: 0.75rem; color: var(--primary); font-weight: 600; }
.footer-orgs .org-mark { inline-size: 2.5rem; block-size: 2.5rem; }
.footer-nav ul { gap: 0; }
.footer-nav a { display: inline-flex; align-items: center; gap: 0.5rem; min-block-size: 2.75rem; font-weight: 500; }
.public-footer .footer-base { max-inline-size: 75rem; margin: 1.5rem auto 0; padding-block-start: 1rem; color: var(--muted); border-block-start: 1px solid var(--line); font-size: 0.875rem; }

/* Squarer shapes where a formal look reads better than pills. */
.badge, .chip { border-radius: 999px; }
.page-links a, .again a, .button-light, .lang-switch, .lang-track, .lang-opt { border-radius: var(--radius); }
.card > .card-head { background: var(--surface); border-start-start-radius: var(--radius-card); border-start-end-radius: var(--radius-card); }

/* Verification: document like panels, the outcome icon in a seal ring (a solid ring and a dashed ring in the color
 * of the outcome, generic and never an emblem). */
.panel { border-block-start-width: 4px; border-radius: var(--radius-card); box-shadow: var(--shadow); }
.panel-icon, .error-card .panel-icon {
  margin: 0.5rem;
  box-shadow: 0 0 0 3px var(--seal-gap, var(--bg)), 0 0 0 5px var(--seal, var(--primary));
  outline: 1px dashed var(--seal, var(--primary));
  outline-offset: 8px;
}
.panel-valid, .panel-valid_attested { --seal: var(--green); --seal-gap: var(--green-bg); }
.panel-revoked, .panel-altered { --seal: var(--red); --seal-gap: var(--red-bg); }
.panel-not_found, .panel-ledger_unavailable { --seal: var(--amber); --seal-gap: var(--amber-bg); }
.panel-id_only, .panel-invalid, .panel-error-page { --seal-gap: var(--blue-bg); }
.panel-title { padding-block-start: 0.75rem; }
.panel-body { padding: 1.5rem; }
.panel .facts { padding-inline: 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
.panel .facts dt { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
html[lang="ar"] .panel .facts dt { font-size: 0.875rem; }

/* Phones: the bar keeps the kingdom in the page language only. */
@media (max-width: 39.99rem) {
  .gov-bar { padding-inline: 1rem; }
  .gov-other { display: none; }
  .public-top { padding: 0.75rem 1rem; }
  .panel-body { padding-inline: 1.1rem; }
  .public-footer { padding-inline: 1rem; }
}

@media (max-width: 56.25rem) {
  .topbar { padding-inline: 0.75rem; }
}

@media print {
  .gov-bar { display: none !important; }
  .page-head h1 { padding-inline-start: 0; border: 0; }
  .panel-icon { box-shadow: none; outline: 0; }
}

/* Official logos on a white disc so they read on the dark sidebar and on the top bar; larger once signed in. */
.org-logo { inline-size: auto; block-size: 2.5rem; padding: 2px; background: var(--logo-plate); border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.brand-block .org-logo { block-size: 3.5rem; }
.brand-block .org-pair .org-logo { block-size: 3rem; }
.topbar-mark .org-logo { block-size: 2.75rem; }
.topbar-mark .org-pair { gap: 0.4rem; }
.topbar-mark .org-pair .org-logo { block-size: 2.5rem; }
.footer-orgs .org-logo { block-size: 2.75rem; }
.auth-card .logo-box .org-logo, .auth-card .logo-box .org-pair .org-logo { block-size: 4.5rem; }
/* The disc is always a circle: the width follows the height here, not the fixed width of the placeholder marks. */
.org-logo, .org-pair .org-logo, .brand-block .org-logo, .brand-block .org-pair .org-logo, .topbar-mark .org-logo, .topbar-mark .org-pair .org-logo,
.footer-orgs .org-logo, .auth-card .logo-box .org-logo, .auth-card .logo-box .org-pair .org-logo { inline-size: auto; aspect-ratio: 1; object-fit: contain; }

/* Smoother, calmer surfaces: soft cards, gentle motion, readable tables. Government colours and the stripe stay. */
.card, .big-card, .panel { box-shadow: var(--shadow); }
.card > .card-head { border-block-end: 1px solid var(--line); }
button, .button, .nav-item, .choice label, .flow-card, input, select, textarea, a { transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, transform 0.15s ease; }
button:not(:disabled, .link-button, .signout, .ghost):hover, .button:not(.ghost):hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
button:not(:disabled):active, .button:active { transform: none; }
.nav-item { border-radius: var(--radius); }
.flow-card:hover, .choice label:hover { transform: translateY(-2px); }
table tbody tr:hover td, table tbody tr:hover th { background: var(--hover); }
.page { padding-block: 1.75rem 3rem; }
.page-head { margin-block-end: 1.5rem; }
/* The lead keeps its own row under the title (flex-basis 100% of app.css); the padding holds the text to 48rem. */
.page-head .lead { color: var(--muted); padding-inline-end: max(0px, calc(100% - 48rem)); }

/* One finish for every page type: aligned numbers, calm row actions, tables that fit their card. */
/* Row actions that disable an account are outlined, a page of solid red buttons shouts. */
.row-actions button.danger { color: var(--red); background: var(--bg); border-color: var(--red); box-shadow: none; }
.row-actions button.danger:hover { color: var(--red); background: var(--red-bg); border-color: var(--red); }
.wrap-actions input.input-sm { inline-size: 8.5rem; min-inline-size: 8.5rem; }
/* Wide tables: slightly denser cells and headers that may wrap, so seven or eight columns fit a laptop screen. */
table.wide { font-size: 0.95rem; }
table.wide th, table.wide td { padding-inline: 0.875rem; }
table.wide thead th { white-space: normal; letter-spacing: 0.05em; }
table.wide .id { max-inline-size: 11ch; }
/* A hint between a label and its box sits close to the label and clear of the box. */
.field > label + .hint { margin-block: -0.15rem 0.5rem; }
/* Number cards of one row share their rows: labels, numbers and notes line up whatever the label length. */
@supports (grid-template-rows: subgrid) {
  .stat-grid > .stat-card { display: grid; grid-template-rows: subgrid; grid-row: span 3; row-gap: 0; }
  .stat-grid > .stat-card > .stat-label { align-self: start; }
}
.summary-strip { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
/* Payment cards of the request page: one readable card per bill, content at the top. */
.pay-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.pay-card { align-content: start; }
/* The staff request page: facts and actions beside the citizen timeline, the audit log across the full width. */
@media (min-width: 75rem) {
  body.staff .detail-grid > .detail-main { display: contents; }
  body.staff .detail-grid > .detail-main > .table-card { grid-column: 1 / -1; }
  body.staff .detail-grid > .detail-side { grid-column: 2; grid-row: 1 / span 3; }
}
/* An eyebrow placed straight in the page head takes its own row above the title. */
.page-head > .eyebrow { flex-basis: 100%; margin-block-end: -0.5rem; }
@media (max-width: 39.99rem) {
  /* A long state code stays inside its label on a phone. */
  table.cards .badge { max-inline-size: 100%; white-space: normal; overflow-wrap: anywhere; }
  table.cards .badge .code { font-size: 0.72rem; white-space: normal; overflow-wrap: anywhere; }
  table.wide .id { max-inline-size: 100%; }
  .wrap-actions input.input-sm { inline-size: auto; }
}
/* Reduced motion: only the hover lifts go. Layout transforms (mirrored icons and charts in Arabic, the drawer) stay. */
@media (prefers-reduced-motion: reduce) { button:hover, .button:hover, .flow-card:hover, .choice label:hover { transform: none !important; } }
