/*
 * Shared design-system STRUCTURE — promoted 2026-08-07 from two apps'
 * site.css after both were found byte-identical here (135 of ~183 rule blocks,
 * verified by a normalized structural diff, not eyeballed). This file bridges Bootstrap 5.1's
 * component classes (.btn-*, .card, .navbar, .alert-*, .form-control …) onto the --pyr-* token
 * system, entirely through CSS custom properties — it contains NO literal colors, font names, or
 * brand values anywhere. Every app's own site.css defines the --pyr-* token VALUES (loaded AFTER
 * this file, so equal-specificity overrides still win by source order) and keeps whatever rules
 * are genuinely its own (a feature the other app hasn't built, or a value that legitimately
 * differs — see --pyr-on-danger-hover and .btn-vip:hover's own per-app comments for why those two
 * specifically stay split rather than converging).
 *
 * Two canonical alias tokens this file's rules depend on, which every consuming app's :root must
 * define (see either app's site.css for the pattern):
 *   --pyr-accent-line     — hairline tint for accent-colored badges/borders (no prior semantic
 *                           equivalent existed before this promotion).
 *   --pyr-on-danger-hover  — text color for .btn-danger's hover-state fill; genuinely differs by
 *                           app (which hue reads AA-safe on THAT app's specific danger-hover
 *                           color), not just by name.
 * Every other token this file references (--pyr-primary, --pyr-primary-hover, --pyr-focus-ring-*,
 * --pyr-status-*, --pyr-space-*, --pyr-radius-*, etc.) is already the established semantic layer.
 *
 * Breakpoints: mobile <640px, tablet 640-1024px, desktop >1024px (custom media queries below).
 * Bootstrap's own grid/utility classes keep Bootstrap's own breakpoints.
 */

/* =====================================================================================
   Base
   ===================================================================================== */
html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  background-color: var(--pyr-bg);
  color: var(--pyr-text);
  font-family: var(--pyr-font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--pyr-font-heading);
  color: var(--pyr-text);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1, .h1 { font-size: var(--pyr-text-headline); font-weight: 600; line-height: 1.2; }
h2, .h2 { font-size: var(--pyr-text-title); font-weight: 600; line-height: 1.25; }

p { text-wrap: pretty; }

a {
  color: var(--pyr-link);
  text-underline-offset: 0.15em;
}
a:hover {
  color: var(--pyr-primary-hover);
}

hr {
  border-color: var(--pyr-border);
  opacity: 1;
}

.text-muted {
  color: var(--pyr-text-muted) !important;
}

::selection {
  background: var(--pyr-focus-ring-glow);
  color: var(--pyr-text);
}

/* Machine-truth values — every ID, money figure, coordinate, UTC time. direction:ltr +
   unicode-bidi:isolate is load-bearing, not decoration: under an RTL page these values contain
   neutral bidi characters (hyphens in a GUID/reference, colons in a timestamp, a leading "+" on a
   phone number) that the browser's bidi algorithm will otherwise visually reorder/scramble
   relative to their logical (and DB-stored) order — confirmed live, e.g. a GUID rendering as
   "L8a-b933-10166af859d3" instead of "e04c7729-...-10166af859d3". isolate keeps the forced-LTR
   run from also dragging adjacent RTL text out of order. */
.pyr-data {
  font-family: var(--pyr-font-data);
  font-size: var(--pyr-text-data);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}
/* Money columns: right-align so digits stack. direction:ltr makes `end` resolve to
   physical-right consistently in BOTH LTR and RTL pages (decimal-place stacking is a universal
   left-to-right numeral convention, never mirrored) and closes the same bidi-reordering gap as
   .pyr-data above. */
.pyr-money {
  font-family: var(--pyr-font-data);
  font-variant-numeric: tabular-nums;
  text-align: end;
  direction: ltr;
  unicode-bidi: isolate;
}
/* Bidi isolation ONLY, no forced LTR and no font/tabular-nums change — for values that are still
   prose-adjacent (a user-typed filename) rather than pure machine-truth, but that must never be
   allowed to visually reorder or bleed directionality into surrounding text. Defense in depth
   alongside server-side validation that already rejects bidi-control characters in filenames
   outright — this covers any value that validation didn't (yet) cover. */
.pyr-bidi-isolate {
  unicode-bidi: isolate;
}

/* =====================================================================================
   Focus ring — AA-safe accent inner ring + soft glow, both modes. Transparent outline is the
   forced-colors / Windows High Contrast fallback (box-shadow is dropped there).
   ===================================================================================== */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-select:focus, .form-check-input:focus,
.page-link:focus, a:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 0.125rem var(--pyr-focus-ring-ink), 0 0 0 0.3rem var(--pyr-focus-ring-glow);
}

/* =====================================================================================
   Navigation — surface bar with a hairline border, replacing Bootstrap's default navbar chrome.
   ===================================================================================== */
/* The OUTER bar (logo + hamburger toggle) deliberately does NOT mirror under RTL: a fixed,
   consistent brand/toggle position is a common, deliberate pattern for masthead chrome — muscle-
   memory consistency across every locale. direction:ltr here doesn't affect Arabic text shaping
   (that's determined by the characters themselves, not this property) — it only fixes THIS bar's
   own item order, and incidentally also keeps a two-word wordmark from visually reversing under
   RTL (a flex container's RTL main axis would otherwise reverse its child spans even though their
   DOM order never changes).
   The COLLAPSED MENU CONTENTS (nav links, account/sign-out) are NOT part of this exception — see
   .navbar-collapse below, which explicitly re-enables RTL for them so they mirror like the rest
   of the page. ⚠️ Deliberate partial exception to "RTL mirrors layout" — do not remove without
   updating the app's own RTL documentation too. */
.navbar {
  background-color: var(--pyr-surface) !important;
  border-bottom: 1px solid var(--pyr-border) !important;
  box-shadow: none !important;
  direction: ltr;
}
.navbar .navbar-brand {
  font-family: var(--pyr-font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--pyr-text) !important;
  display: flex;
  align-items: center;
  min-width: var(--pyr-tap-min);
  min-height: var(--pyr-tap-min);
}
/* Re-inherit the page's real direction for the collapsed menu's contents (nav links,
   Hello-user/sign-out) — .navbar above forces ltr for the outer bar, and direction otherwise
   cascades to every descendant, so without this override the menu items would incorrectly stay
   LTR too. Scoped to when <html dir="rtl"> is actually set (Razor's _Layout.cshtml sets this for
   Arabic) rather than unconditionally rtl, so the LTR-culture pages are unaffected. */
html[dir="rtl"] .navbar-collapse {
  direction: rtl;
}
.navbar .navbar-brand .pyr-brand-mark { color: var(--pyr-primary); }
.navbar .navbar-brand .pyr-brand-logo { vertical-align: -0.4em; margin-right: var(--pyr-space-2); }

/* Long-form prose pages (legal/static): readable measure, nothing else. A fixed-top,
   transparent-over-hero nav (a landing layout built around a full-height hero) overlaps any page
   whose content starts at the very top instead of behind that hero — this padding clears the
   nav's own rendered height with room to spare. Only apply this class on pages using that layout;
   a normal in-app page with its own non-transparent nav doesn't need it. */
.pyr-prose { max-width: 46rem; padding-top: calc(var(--pyr-space-8) + var(--pyr-space-4)); }
.navbar .nav-link,
.navbar .nav-link.text-dark,
.navbar .text-dark {
  color: var(--pyr-text) !important;
}
.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--pyr-primary-hover) !important;
}
.navbar .nav-link.active,
.navbar .nav-link[aria-current="page"] {
  color: var(--pyr-primary) !important;
}
.navbar-toggler {
  border-color: var(--pyr-border);
  min-width: var(--pyr-tap-min);
  min-height: var(--pyr-tap-min);
}
/* Skip-to-content link (WCAG 2.4.1) — Bootstrap's visually-hidden-focusable hides it until
   keyboard focus; this styles its FOCUSED appearance. */
.pyr-skip-link {
  position: absolute;
  z-index: calc(var(--pyr-z-sticky) + 1);
  inset-inline-start: var(--pyr-space-3);
  top: var(--pyr-space-3);
  padding: var(--pyr-space-2) var(--pyr-space-4);
  background: var(--pyr-surface-2);
  color: var(--pyr-text);
  border-radius: var(--pyr-radius-md);
}
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23EAEAEA' stroke-width='2' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
/* Data-URIs can't read tokens — an app whose navbar surface flips to a LIGHT color under a given
   theme (its default, or a [data-pyr-theme] variant) needs its own dark-stroke hamburger icon
   variant. Apps whose navbar stays dark-surfaced in every theme they use simply never trigger
   this selector. */
[data-pyr-theme="light"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%230A1628' stroke-width='2' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Collapsible left staff sidebar (an alternative to a top nav bar for staff-heavy apps). Same
   masthead RTL exception as .navbar above: direction: ltr pins the sidebar to the physical left
   and fixes its own internal order regardless of culture; labels still render as correct Arabic
   text — only the chrome's own side/order is fixed. Collapse state is driven by a
   "staffSidebar"-style Alpine component (x-show toggles this aside between `display: none` and
   the `display: flex` set below, so the flex row's other child fills the freed space with no
   extra class bookkeeping needed) — an app using this pattern owns that component itself. */
.pyr-staff-shell {
  display: flex;
  align-items: stretch;
  direction: ltr;
}
/* The ltr pin places the sidebar only; direction cascades, so without this every page inside the
   shell and the sidebar's own labels render left-to-right in Arabic. Set on the sidebar's CHILDREN,
   not the sidebar, so a scrolling sidebar keeps its scrollbar on the physical right. */
html[dir="rtl"] .pyr-staff-content,
html[dir="rtl"] .pyr-staff-sidebar > * {
  direction: rtl;
}
.pyr-staff-content {
  flex: 1 1 auto;
  min-width: 0;
}
.pyr-staff-sidebar {
  flex: 0 0 240px;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: var(--pyr-space-1);
  padding: var(--pyr-space-3);
  background-color: var(--pyr-surface);
  border-right: 1px solid var(--pyr-border);
}
/* Below the desktop breakpoint a 240px sidebar would leave too little room for content, so a
   COLLAPSED sidebar is a fully-hidden overlay there instead of the 60px icon rail desktop gets
   below — no room for a persistent rail on a phone either. The opener button re-reveals it,
   restricted to this range only (desktop never needs it — the rail's own header toggle does the
   same job in less space). */
@media (max-width: 991.98px) {
  .pyr-staff-sidebar.pyr-staff-sidebar-collapsed {
    display: none;
  }
}
@media (min-width: 992px) {
  .pyr-staff-sidebar-opener {
    display: none !important;
  }
}
.pyr-staff-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--pyr-space-2);
  padding-block-end: var(--pyr-space-2);
  border-bottom: 1px solid var(--pyr-border);
  margin-block-end: var(--pyr-space-2);
}
.pyr-staff-sidebar-title {
  font-size: var(--pyr-text-sm);
  font-weight: 600;
  color: var(--pyr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pyr-staff-sidebar-toggle,
.pyr-staff-sidebar-opener {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--pyr-tap-min);
  min-height: var(--pyr-tap-min);
  flex-shrink: 0;
  border: 1px solid var(--pyr-border);
  border-radius: var(--pyr-radius-sm);
  background-color: transparent;
  color: var(--pyr-text-muted);
}
.pyr-staff-sidebar-toggle:hover,
.pyr-staff-sidebar-toggle:focus,
.pyr-staff-sidebar-opener:hover,
.pyr-staff-sidebar-opener:focus {
  color: var(--pyr-primary-hover);
  background-color: var(--pyr-focus-ring-glow);
}
.pyr-staff-sidebar-opener {
  direction: ltr;
  align-self: flex-start;
  margin: var(--pyr-space-2);
}
.pyr-staff-sidebar-icon {
  flex-shrink: 0;
}
.pyr-staff-sidebar-group:not(:first-child) {
  margin-block-start: var(--pyr-space-2);
  border-top: 1px solid var(--pyr-border);
  padding-block-start: var(--pyr-space-2);
}
.pyr-staff-sidebar-group-links {
  display: flex;
  flex-direction: column;
  gap: var(--pyr-space-1);
}
/* A button, not a plain-text heading — it toggles the group open/closed. Reset button chrome
   back to matching the plain-link rows below it. */
.pyr-staff-sidebar-heading {
  display: flex;
  align-items: center;
  gap: var(--pyr-space-2);
  width: 100%;
  min-height: var(--pyr-tap-min);
  padding-inline: var(--pyr-space-3);
  padding-block: var(--pyr-space-1);
  border: none;
  background-color: transparent;
  font: inherit;
  font-size: var(--pyr-text-sm);
  font-weight: 600;
  color: var(--pyr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: var(--pyr-radius-sm);
}
.pyr-staff-sidebar-heading:hover,
.pyr-staff-sidebar-heading:focus {
  color: var(--pyr-primary-hover);
  background-color: var(--pyr-focus-ring-glow);
}
.pyr-staff-sidebar-heading .pyr-staff-sidebar-link-text {
  flex: 1 1 auto;
  text-align: start;
}
.pyr-staff-sidebar-chevron {
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.pyr-staff-sidebar-heading[aria-expanded="true"] .pyr-staff-sidebar-chevron {
  transform: rotate(180deg);
}
.pyr-staff-sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--pyr-space-2);
  min-height: var(--pyr-tap-min);
  padding-inline: var(--pyr-space-3);
  border-radius: var(--pyr-radius-sm);
  color: var(--pyr-text-muted);
  font-size: var(--pyr-text-sm);
  text-decoration: none;
}
.pyr-staff-sidebar-link:hover,
.pyr-staff-sidebar-link:focus {
  color: var(--pyr-primary-hover);
  background-color: var(--pyr-focus-ring-glow);
}
.pyr-staff-sidebar-link.active {
  color: var(--pyr-primary-hover);
  background-color: var(--pyr-focus-ring-glow);
  font-weight: 600;
}
/* Collapsed on desktop = a 60px icon-only rail, not fully hidden (mobile below 992px stays
   fully-hidden — see the media query above). Every group's links show regardless of their own
   accordion state while collapsed — that's driven by the app's own Alpine component, not a CSS
   override, so there's one source of truth for "is this link visible". This block only handles
   layout (width, hiding the now-redundant text/heading/chevron) — a rail has no room for a real
   accordion, so the toggle buttons that would drive it are hidden here too. */
@media (min-width: 992px) {
  .pyr-staff-sidebar.pyr-staff-sidebar-collapsed {
    flex-basis: 60px;
    width: 60px;
    padding-inline: var(--pyr-space-1);
  }
  .pyr-staff-sidebar.pyr-staff-sidebar-collapsed .pyr-staff-sidebar-link-text,
  .pyr-staff-sidebar.pyr-staff-sidebar-collapsed .pyr-staff-sidebar-heading,
  .pyr-staff-sidebar.pyr-staff-sidebar-collapsed .pyr-staff-sidebar-chevron {
    display: none;
  }
  .pyr-staff-sidebar.pyr-staff-sidebar-collapsed .pyr-staff-sidebar-header {
    justify-content: center;
    padding-inline: 0;
  }
  .pyr-staff-sidebar.pyr-staff-sidebar-collapsed .pyr-staff-sidebar-link {
    justify-content: center;
    padding-inline: 0;
  }
  .pyr-staff-sidebar.pyr-staff-sidebar-collapsed .pyr-staff-sidebar-group:not(:first-child) {
    padding-block-start: var(--pyr-space-1);
  }
}
.navbar-nav .nav-link {
  display: flex;
  align-items: center;
  min-height: var(--pyr-tap-min);
  padding-block: var(--pyr-space-2);
}

/* Account menu — a compact icon+email dropdown instead of an inline "Hello, full.email@address /
   Sign out" pair, which overflows the navbar below desktop widths. */
.pyr-account-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.pyr-account-email {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropdown-menu {
  background-color: var(--pyr-surface-2);
  border: 1px solid var(--pyr-border);
  border-radius: var(--pyr-radius-md);
  box-shadow: var(--pyr-shadow-md);
  padding-block: var(--pyr-space-2);
}
.dropdown-item {
  color: var(--pyr-text);
}
.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--pyr-focus-ring-glow);
  color: var(--pyr-primary-hover);
}
.dropdown-divider {
  border-top-color: var(--pyr-border);
}

/* =====================================================================================
   Buttons — all seven states.
   ===================================================================================== */
.btn {
  --bs-btn-focus-box-shadow: none;
  border-radius: var(--pyr-radius-sm);
  padding: 0.625rem 1.25rem;
  min-height: var(--pyr-tap-min);
  font-weight: 500;
  transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out;
}
.btn-sm { min-height: auto; padding: 0.375rem 0.75rem; }

.btn-primary {
  --bs-btn-bg: var(--pyr-primary);
  --bs-btn-border-color: var(--pyr-primary);
  --bs-btn-color: var(--pyr-on-accent);
  --bs-btn-hover-bg: var(--pyr-primary-hover);
  --bs-btn-hover-border-color: var(--pyr-primary-hover);
  --bs-btn-hover-color: var(--pyr-on-accent);
  --bs-btn-active-bg: var(--pyr-primary-hover);
  --bs-btn-active-border-color: var(--pyr-primary-hover);
  --bs-btn-active-color: var(--pyr-on-accent);
  --bs-btn-disabled-bg: var(--pyr-surface-2);
  --bs-btn-disabled-border-color: var(--pyr-border);
  --bs-btn-disabled-color: var(--pyr-text-muted);
  background-color: var(--pyr-primary);
  border-color: var(--pyr-primary);
  color: var(--pyr-on-accent);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: var(--pyr-primary-hover);
  border-color: var(--pyr-primary-hover);
  color: var(--pyr-on-accent);
}
.btn-primary:disabled, .btn-primary.disabled {
  background-color: var(--pyr-surface-2);
  border-color: var(--pyr-border);
  color: var(--pyr-text-muted);
  cursor: not-allowed;
}

/* Secondary = outline / surface affordance with accent text. */
.btn-outline-primary,
.btn-secondary {
  background-color: transparent;
  border-color: var(--pyr-border-strong);
  color: var(--pyr-link);
}
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active,
.btn-secondary:hover, .btn-secondary:focus, .btn-secondary:active {
  background-color: var(--pyr-focus-ring-glow);
  border-color: var(--pyr-primary);
  color: var(--pyr-primary-hover);
}
.btn-secondary:disabled, .btn-outline-primary:disabled {
  border-color: var(--pyr-border);
  color: var(--pyr-text-muted);
  background-color: transparent;
  cursor: not-allowed;
}

/* Neutral outline — the system's second, quieter outline weight, so a page can put an accent
   outline next to a neutral one and still read a hierarchy. Deliberately NOT an alias of
   .btn-outline-primary. Unbridged it falls through to Bootstrap's #6C757D, which is under AA on a
   dark surface. */
.btn-outline-secondary {
  background-color: transparent;
  border-color: var(--pyr-border-strong);
  color: var(--pyr-text);
}
.btn-outline-secondary:hover, .btn-outline-secondary:focus, .btn-outline-secondary:active {
  background-color: var(--pyr-focus-ring-glow);
  border-color: var(--pyr-primary);
  color: var(--pyr-primary-hover);
}
.btn-outline-secondary:disabled, .btn-outline-secondary.disabled {
  border-color: var(--pyr-border);
  color: var(--pyr-text-muted);
  background-color: transparent;
  cursor: not-allowed;
}

/* Outline success/warning — Bootstrap's stock outline greens/yellows fail contrast on a dark
   surface; bridged to tokens the same way .btn-outline-primary is. */
.btn-outline-success {
  background-color: transparent;
  border-color: var(--pyr-success-line);
  color: var(--pyr-status-success);
}
.btn-outline-success:hover, .btn-outline-success:focus, .btn-outline-success:active {
  background-color: var(--pyr-success-glow);
  border-color: var(--pyr-status-success);
  color: var(--pyr-status-success);
}
.btn-outline-warning {
  background-color: transparent;
  border-color: var(--pyr-warning-line);
  color: var(--pyr-status-warning);
}
.btn-outline-warning:hover, .btn-outline-warning:focus, .btn-outline-warning:active {
  background-color: var(--pyr-warning-glow);
  border-color: var(--pyr-status-warning);
  color: var(--pyr-status-warning);
}

/* Destructive action — solid, high-emphasis danger, keeping Bootstrap's .btn-danger semantics
   intact. Deep danger-ink fill carries AA-safe white text; "proceed" actions use .btn-primary, so
   we do NOT repurpose .btn-success (it keeps its default meaning). */
.btn-danger {
  background-color: var(--pyr-danger-ink);
  border-color: var(--pyr-danger-ink);
  color: var(--pyr-on-danger);
}
.btn-danger:hover, .btn-danger:focus, .btn-danger:active {
  /* --pyr-on-danger-hover, not --pyr-on-danger: which ink reads AA-safe against THIS app's
     hover-state danger fill genuinely differs by app (a brighter/paler hover hue needs dark
     text, a darker/more-saturated one needs white) — see each app's own site.css for its value
     and the reasoning behind it. */
  background-color: var(--pyr-danger);
  border-color: var(--pyr-danger);
  color: var(--pyr-on-danger-hover);
}

/* VIP / premium — the one gold surface (Gold-Is-Sacred: never repurposed for anything else).
   .btn-vip:hover stays PER-APP, not here — each app's hover direction (lighten vs. darken) is a
   deliberate choice tied to which of --pyr-gold-light/--pyr-gold-ink reads AA-safe against that
   app's own --pyr-gold value; see that app's own site.css for its .btn-vip:hover rule + comment. */
.btn-vip {
  background-color: var(--pyr-gold);
  border-color: var(--pyr-gold);
  color: var(--pyr-on-accent);
}

.btn-link {
  color: var(--pyr-link);
  text-decoration: none;
}
.btn-link:hover { color: var(--pyr-primary-hover); }
.navbar .btn-link.text-dark { color: var(--pyr-text) !important; }
.navbar .btn-link.text-dark:hover { color: var(--pyr-primary-hover) !important; }

/* Inline button spinner (loading state). */
.btn .pyr-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: pyr-spin 0.6s linear infinite;
  vertical-align: -0.125em;
}
@keyframes pyr-spin { to { transform: rotate(360deg); } }

/* =====================================================================================
   Cards / containers — tone + hairline (light, not shadow) by default.
   ===================================================================================== */
.card {
  background-color: var(--pyr-surface-2);
  color: var(--pyr-text);
  border: 1px solid var(--pyr-border);
  border-radius: var(--pyr-radius-lg);
}
.card .card-body { padding: var(--pyr-space-5); }
.card .card-title { font-family: var(--pyr-font-heading); }
[data-pyr-theme="light"] .card {
  background-color: var(--pyr-surface);
  box-shadow: var(--pyr-shadow-sm);
  border-color: var(--pyr-border);
}

/* Panel = the routine bordered surface for form/section grouping. */
.pyr-panel {
  background-color: var(--pyr-surface);
  border: 1px solid var(--pyr-border);
  border-radius: var(--pyr-radius-lg);
  padding: var(--pyr-space-5);
}
.pyr-panel-sm { max-width: 32rem; }
.pyr-panel-md { max-width: 40rem; }
.pyr-panel-lg { max-width: 72rem; }

/* Notification center: unread indicator — a small dot beside the title, not a side border (a
   thick accent border reads as a generic AI-UI tell; a dot is the more common, subtler
   convention for this exact "unread" meaning). */
.pyr-notification-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: var(--pyr-primary);
  margin-inline-end: var(--pyr-space-2);
}

/* =====================================================================================
   Data table. Desktop: a real table on the panel surface; ≤640px ("tables → stacked cards"):
   rows become bordered cards, each cell labelled by its data-label. text-align/inset logical
   props keep RTL mirroring free; force-LTR machine values keep their own .pyr-data wrappers.
   ===================================================================================== */
.pyr-table-wrap { overflow-x: auto; }
.pyr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--pyr-text-sm);
}
.pyr-table th,
.pyr-table td {
  padding: var(--pyr-space-3) var(--pyr-space-4);
  text-align: start;
  vertical-align: middle;
  border-bottom: 1px solid var(--pyr-border);
}
.pyr-table thead th {
  color: var(--pyr-text-muted);
  font-size: var(--pyr-text-label);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.pyr-table tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
  .pyr-table thead { display: none; }
  .pyr-table,
  .pyr-table tbody,
  .pyr-table tr,
  .pyr-table td { display: block; }
  .pyr-table tr {
    border: 1px solid var(--pyr-border);
    border-radius: var(--pyr-radius-md);
    background-color: var(--pyr-surface-2);
    margin-block-end: var(--pyr-space-3);
  }
  .pyr-table tr:last-child { margin-block-end: 0; }
  .pyr-table td {
    border-bottom: 0;
    padding: var(--pyr-space-2) var(--pyr-space-4);
  }
  .pyr-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--pyr-text-muted);
    font-size: var(--pyr-text-label);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  .pyr-table td:empty { display: none; }
}

/* Row highlight — e.g. a staff list pointing at the just-created row. */
.pyr-row-highlight {
  outline: 2px solid var(--pyr-warning-line);
  background: var(--pyr-warning-glow);
}

/* Utilization percent bar — width set via CSSOM from a data-width-pct attribute in the app's own
   JS, same mechanism as .pyr-timeline-block (a strict CSP with no 'unsafe-inline' drops a
   server-rendered style="width:.."). */
.pyr-bar {
  position: relative;
  width: 100%;
  min-width: 4rem;
  height: 0.5rem;
  background-color: var(--pyr-recessed);
  border: 1px solid var(--pyr-border);
  border-radius: var(--pyr-radius-pill);
  overflow: hidden;
  margin-block-end: var(--pyr-space-1);
}
.pyr-bar-fill {
  height: 100%;
  background-color: var(--pyr-primary);
  border-radius: var(--pyr-radius-pill);
}

/* Chart.js canvas wrapper — canvases need a sized positioned ancestor for Chart.js's responsive
   resize observer to have a stable box to fill. */
.pyr-chart-wrap {
  position: relative;
  height: 300px;
}
@media (max-width: 640px) {
  .pyr-chart-wrap { height: 220px; }
}

/* Utility classes — a strict CSP (style-src 'self', no 'unsafe-inline') blocks inline style="",
   so these back what would otherwise be one-off inline styles. */
.pyr-hero { text-align: center; padding-block: var(--pyr-space-8) var(--pyr-space-7); }
.pyr-wordmark {
  font-family: var(--pyr-font-display);
  font-size: var(--pyr-text-display);
  letter-spacing: 0.02em;
}
.pyr-wordmark-accent { color: var(--pyr-primary); }
.pyr-lead { max-width: 52ch; margin-inline: auto; font-size: var(--pyr-text-title); }
.pyr-form-hint { font-size: var(--pyr-text-sm); }
/* Narrow single-field wrapper (short text inputs shouldn't stretch the full content width). */
.pyr-field-narrow { max-width: var(--pyr-field-narrow-width); }
/* "or" separator between a form and its external-SSO buttons. */
.pyr-divider {
  display: flex;
  align-items: center;
  gap: var(--pyr-space-3);
  margin-block: var(--pyr-space-4);
  color: var(--pyr-text-muted);
  font-size: var(--pyr-text-sm);
}
.pyr-divider::before,
.pyr-divider::after {
  content: "";
  flex: 1;
  border-block-start: 1px solid var(--pyr-border);
}
/* External-SSO provider buttons — icon + label, never icon-only (the label carries the provider
   name; the icon is recognition, not the only cue). */
.pyr-sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--pyr-space-2);
}
.pyr-sso-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

/* MFA TOTP-setup QR — the SVG ships with fixed dark-on-light module colors (must stay scannable
   regardless of theme), so the white card here is deliberate, not a token miss. Fixed pixel
   width: a QR that stretches loses scannability. */
.pyr-mfa-qr {
  display: inline-block;
  width: 10rem;
  padding: var(--pyr-space-3);
  background: #FFFFFF;
  border-radius: var(--pyr-radius-md);
  margin-block-end: var(--pyr-space-3);
}
.pyr-mfa-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

/* =====================================================================================
   Forms / fields — recessed fill, hairline stroke, accent focus.
   ===================================================================================== */
.form-label {
  font-size: var(--pyr-text-label);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pyr-text-muted);
}
.form-label.h6 { text-transform: none; letter-spacing: 0; font-size: var(--pyr-text-body); color: var(--pyr-text); }
legend.form-label { text-transform: none; letter-spacing: 0; }

.form-control, .form-select {
  background-color: var(--pyr-recessed);
  border: 1px solid var(--pyr-border);
  border-radius: var(--pyr-radius-sm);
  color: var(--pyr-text);
  min-height: var(--pyr-tap-min);
}
.form-control::placeholder { color: var(--pyr-text-muted); opacity: 1; }
.form-control:focus, .form-select:focus {
  background-color: var(--pyr-recessed);
  border-color: var(--pyr-primary);
  color: var(--pyr-text);
}
.form-control:disabled {
  background-color: var(--pyr-surface-2);
  color: var(--pyr-text-muted);
}
.form-control.input-validation-error, .input-validation-error {
  border-color: var(--pyr-danger);
}
[data-pyr-theme="light"] .form-control,
[data-pyr-theme="light"] .form-select { background-color: var(--pyr-surface); }

.form-check-input {
  background-color: var(--pyr-recessed);
  border-color: var(--pyr-border-strong);
}
.form-check-input:checked {
  background-color: var(--pyr-primary);
  border-color: var(--pyr-primary);
}
.form-check-label { color: var(--pyr-text); }

/* Field-level validation text — pairs with the danger border, never color-only. */
.text-danger, .field-validation-error {
  color: var(--pyr-status-danger) !important;
  font-size: var(--pyr-text-sm);
}

/* Success text utility — Bootstrap's #198754 is under AA on a dark surface. */
.text-success {
  color: var(--pyr-status-success) !important;
}

/* =====================================================================================
   Alerts — tinted surface + hue text + hairline; icon paired in markup.
   ===================================================================================== */
/* Icon lives in an absolutely-positioned start gutter (NOT flex) so multiple child paragraphs —
   e.g. a validation summary's loop of <p> — keep normal block flow and stack vertically. */
.alert {
  position: relative;
  border-radius: var(--pyr-radius-md);
  border-width: 1px;
  border-style: solid;
  /* Logical padding so the icon gutter (inline-start) flips with the ::before icon in RTL. */
  padding-block: var(--pyr-space-4);
  padding-inline: 2.75rem var(--pyr-space-4);
  color: var(--pyr-text);
}
.alert::before {
  position: absolute;
  inset-inline-start: var(--pyr-space-4);
  top: var(--pyr-space-4);
  font-family: var(--pyr-font-data);
  font-weight: 700;
  line-height: 1.5;
}
.alert-success {
  background-color: var(--pyr-success-glow);
  border-color: var(--pyr-success-line);
}
.alert-success::before { content: "\2713"; color: var(--pyr-status-success); }
.alert-danger {
  background-color: var(--pyr-danger-glow);
  border-color: var(--pyr-danger-line);
}
.alert-danger::before { content: "\26A0"; color: var(--pyr-status-danger); }
.alert-warning {
  background-color: var(--pyr-warning-glow);
  border-color: var(--pyr-warning-line);
}
.alert-warning::before { content: "\26A0"; color: var(--pyr-status-warning); }
.alert-info {
  background-color: var(--pyr-neutral-glow);
  border-color: var(--pyr-border);
}
.alert-info::before { content: "\2139"; color: var(--pyr-status-info); }
/* A plain link in an alert; a button-styled link (.btn) keeps its own button colours. */
.alert a:not(.btn) { color: var(--pyr-link); }

/* =====================================================================================
   Password-strength checklist (registration/reset flows) — informational only, live-toggled by
   the app's own JS. Same absolutely-positioned start-gutter icon shape as .alert::before.
   ===================================================================================== */
.pyr-password-checklist {
  list-style: none;
  margin: var(--pyr-space-2) 0 0;
  padding: 0;
  font-size: var(--pyr-text-sm);
}
.pyr-password-checklist li {
  position: relative;
  padding-inline-start: 1.25rem;
  color: var(--pyr-text-muted);
}
.pyr-password-checklist li::before {
  content: "\2717";
  position: absolute;
  inset-inline-start: 0;
}
.pyr-password-checklist li.pyr-check-met {
  color: var(--pyr-status-success);
}
.pyr-password-checklist li.pyr-check-met::before {
  content: "\2713";
}

/* =====================================================================================
   Status badges — color + LABEL always (never color-only). Pill + label type.
   ===================================================================================== */
.pyr-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.125rem var(--pyr-space-2);
  border-radius: var(--pyr-radius-pill);
  font-size: var(--pyr-text-label);
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pyr-badge::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }
/* Text color reads through the semantic --pyr-status-* tokens (each app re-derives them per
   theme) rather than a raw hue — a raw bright hue as badge text only clears AA on a dark
   surface, which isn't universal across apps/themes. */
/* .pyr-badge-upcoming and .pyr-badge-info are the SAME styling under two names — different apps
   reach for whichever reads naturally in their own vocabulary (a travel app's "upcoming
   booking" vs. a security tool's "info-severity finding"); never diverge their styling. */
.pyr-badge-upcoming,
.pyr-badge-info { color: var(--pyr-status-info); background: var(--pyr-focus-ring-glow); border-color: var(--pyr-accent-line); }
.pyr-badge-active   { color: var(--pyr-status-success); background: var(--pyr-success-glow); border-color: var(--pyr-success-line); }
.pyr-badge-pending  { color: var(--pyr-text-muted); background: transparent; border-style: dashed; border-color: var(--pyr-border-strong); }
.pyr-badge-pending::before { background: transparent; border: 1px solid currentColor; }
.pyr-badge-success  { color: var(--pyr-status-success); background: var(--pyr-success-glow); border-color: var(--pyr-success-line); }
.pyr-badge-warning  { color: var(--pyr-status-warning); background: var(--pyr-warning-glow); border-color: var(--pyr-warning-line); }
.pyr-badge-danger   { color: var(--pyr-status-danger); background: var(--pyr-danger-glow); border-color: var(--pyr-danger-line); }
.pyr-badge-neutral  { color: var(--pyr-text-muted); background: var(--pyr-neutral-glow); border-color: var(--pyr-border); }
.pyr-badge-vip      { color: var(--pyr-on-accent); background: var(--pyr-gold); border-color: var(--pyr-gold); }

/* =====================================================================================
   Toast notifications (see wwwroot/js/pyr-notify.js) for pages that submit via AJAX/fetch (no
   full page reload) and need to confirm success/failure without server-rendered ModelState.
   Never color-only: an icon + text always carry the state, same pattern as .alert-success/
   .alert-danger above.
   ===================================================================================== */
.pyr-notify-region {
  position: fixed;
  inset-block-end: var(--pyr-space-5);
  inset-inline-end: var(--pyr-space-5);
  z-index: var(--pyr-z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--pyr-space-2);
  max-width: min(24rem, calc(100vw - var(--pyr-space-5) * 2));
  pointer-events: none;
}
.pyr-notify {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--pyr-space-2);
  padding: var(--pyr-space-3) var(--pyr-space-4);
  background: var(--pyr-surface);
  border: 1px solid var(--pyr-border);
  border-radius: var(--pyr-radius-lg);
  box-shadow: var(--pyr-shadow-md);
  color: var(--pyr-text);
  font-size: var(--pyr-text-sm);
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
.pyr-notify-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .pyr-notify { transition: opacity 0.01ms; transform: none; }
}
.pyr-notify-icon {
  flex-shrink: 0;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  margin-block-start: 0.5em;
  background: currentColor;
}
.pyr-notify-success .pyr-notify-icon { color: var(--pyr-status-success); }
.pyr-notify-danger .pyr-notify-icon { color: var(--pyr-status-danger); }

/* =====================================================================================
   Onboarding-style progress stepper. Neutral by default, accent for the current step, accent
   check for done. Never color-only — the number/checkmark + label carry the state; aria-current
   marks the step for AT.
   ===================================================================================== */
.pyr-steps {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0 0 var(--pyr-space-6);
  counter-reset: pyr-step;
}
.pyr-steps li {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--pyr-space-2);
  position: relative;
  color: var(--pyr-text-muted);
  font-size: var(--pyr-text-sm);
  min-width: 0;
}
.pyr-steps li::before {
  counter-increment: pyr-step;
  content: counter(pyr-step);
  position: relative;
  z-index: 1;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--pyr-border-strong);
  background: var(--pyr-surface);
  font-family: var(--pyr-font-data);
  font-weight: 600;
  color: var(--pyr-text-muted);
}
.pyr-steps li::after {
  content: "";
  position: absolute;
  top: 1rem;
  inset-inline-start: 50%;
  inline-size: 100%;
  block-size: 1px;
  background: var(--pyr-border);
  z-index: 0;
}
.pyr-steps li:last-child::after { display: none; }
.pyr-steps li .pyr-step-label { position: relative; z-index: 1; }
.pyr-steps li[data-state="current"] { color: var(--pyr-text); font-weight: 600; }
.pyr-steps li[data-state="current"]::before {
  border-color: var(--pyr-primary);
  color: var(--pyr-primary);
  box-shadow: 0 0 0 3px var(--pyr-focus-ring-glow);
}
.pyr-steps li[data-state="done"] { color: var(--pyr-text); }
.pyr-steps li[data-state="done"]::before {
  content: "\2713";
  background: var(--pyr-primary);
  border-color: var(--pyr-primary);
  color: var(--pyr-on-accent);
}
.pyr-steps li[data-state="done"]::after { background: var(--pyr-primary); }

/* Reassurance panel (e.g. a KYC trust moment) — neutral surface, NOT accent-colored
   (info-isn't-action). */
.pyr-reassure {
  background-color: var(--pyr-surface);
  border: 1px solid var(--pyr-border);
  border-radius: var(--pyr-radius-lg);
  padding: var(--pyr-space-5);
  margin-bottom: var(--pyr-space-5);
  max-width: 42rem;
}
.pyr-reassure h2 { font-size: var(--pyr-text-title); margin-bottom: var(--pyr-space-3); }
.pyr-reassure ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--pyr-space-3); }
.pyr-reassure li { display: flex; gap: var(--pyr-space-3); color: var(--pyr-text); font-size: var(--pyr-text-sm); }
.pyr-reassure li::before {
  content: "\1F512"; /* lock glyph — reinforces trust, not color-only */
  flex: 0 0 auto;
  filter: grayscale(1);
  opacity: 0.7;
}

/* =====================================================================================
   Description lists (staff detail views) — label muted, value in mono where it's a machine truth.
   ===================================================================================== */
dl.row dt { color: var(--pyr-text-muted); font-weight: 600; }
dl.row dd { color: var(--pyr-text); }

/* =====================================================================================
   Footer
   ===================================================================================== */
.footer {
  border-top: 1px solid var(--pyr-border) !important;
  color: var(--pyr-text-muted);
  background-color: var(--pyr-bg);
}
.footer a { color: var(--pyr-text-muted); }
.footer a:hover { color: var(--pyr-primary-hover); }

/* =====================================================================================
   Calendar/timeline view: one 24h-wide track per day, each segment plotted as a block
   positioned/sized by its own start/end time.
   ===================================================================================== */
.pyr-timeline-day {
  position: relative;
  height: 2.5rem;
  background-color: var(--pyr-surface);
  border: 1px solid var(--pyr-border);
  border-radius: var(--pyr-radius-md);
}
.pyr-timeline-block {
  position: absolute;
  top: var(--pyr-space-1);
  bottom: var(--pyr-space-1);
  min-width: 2%;
  overflow: hidden;
  white-space: nowrap;
  padding-inline: var(--pyr-space-2);
  border-radius: var(--pyr-radius-sm);
  background-color: var(--pyr-primary);
  color: var(--pyr-bg);
  display: flex;
  align-items: center;
}
/* Confirmed vs pending: pending shown visually distinct — dashed/faded. */
.pyr-timeline-block.pyr-timeline-pending {
  opacity: 0.55;
  border: 1px dashed var(--pyr-border-strong);
  background-color: transparent;
  color: var(--pyr-text);
}

/* =====================================================================================
   Responsive / touch baseline — mobile-first, WCAG 2.5.5 targets.
   ===================================================================================== */
@media (max-width: 639px) {
  .navbar-nav { gap: var(--pyr-space-1); }
  footer.footer { text-align: center; }
}

/* =====================================================================================
   Reduced motion (WCAG 2.3.3) — kill non-essential motion.
   ===================================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* The bar is pinned LTR, so Bootstrap's RTL build leaves the brand's start margin and a list's browser start padding on
   its left. */
.navbar .navbar-brand { margin-left: 0; }
.navbar .navbar-nav { padding-left: 0; }

/* A status is information, never a chip: its dot and its word in the status colour, with no pill, fill or outline
   that would read as something to press. A filled tag (a plan's label) names another class. */
.pyr-badge:is(.pyr-badge-success, .pyr-badge-active, .pyr-badge-pending, .pyr-badge-info, .pyr-badge-upcoming, .pyr-badge-warning, .pyr-badge-danger, .pyr-badge-neutral) {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: var(--pyr-text-sm);
  letter-spacing: 0;
}

/* A chosen choice chip (a radio drawn as an outline button) fills the primary colour, never Bootstrap's own blue: the
   shared button bridge sets the active fill for .btn-primary only. */
.btn-check:checked + .btn-outline-primary,
.btn-check:checked + .btn-outline-primary:hover {
  background-color: var(--pyr-primary);
  border-color: var(--pyr-primary);
  color: var(--pyr-on-accent);
}

/* Touch screens: the compact buttons keep a full tap target (the look stays compact on a mouse). */
@media (pointer: coarse) {
  .btn-sm { min-height: var(--pyr-tap-min); display: inline-flex; align-items: center; justify-content: center; }
}

/* The small flag beside a country's name in text, tables and the country picker. Two classes: an app's own .pyr-flag
   loads after this file. */
.pyr-flag.pyr-flag-inline {
  width: 1.25rem;
  height: 0.9375rem;
  border-radius: 0.15rem;
  vertical-align: -0.15em;
  margin-inline-end: 0.375rem;
}
.pyr-flag-inline.pyr-flag-glyph svg { width: 85%; height: 85%; }

/* Multi-line machine/user text preserved as typed (e.g. request notes) — inline style attributes
   are dropped by a strict CSP (style-src 'self'). */
.pyr-prewrap {
  white-space: pre-wrap;
}

/* The data-pyr-confirm panel (SweetAlert2) in the site's look. */
.swal2-popup {
  font-family: inherit;
  color: var(--bs-body-color);
  background: var(--bs-body-bg);
  border-radius: var(--bs-border-radius-xl);
}
.swal2-html-container { font-size: 1rem; }
.swal2-actions { gap: 0.5rem; }
