@layer theme, base, components, utilities;
@layer components {
/* ---- Navbar ---- */
/* `--brand` is app-shell chrome: a distinct elevation layer, and Akamai Navy
   in BOTH themes. That is why it reads --color-brand-chrome / --color-on-brand
   rather than the surface tokens — it is brand chrome, not a themed surface,
   and it does not ride the neutrals ramp the surfaces use.
   `--dark` is the deprecated spelling of the same thing — it never meant
   "dark theme", and that ambiguity is why it was renamed. Both classes stay
   live; prefer `--brand`. */

.navbar {
  background: var(--color-surface);
  color: var(--color-foreground);
  border-bottom: 1px solid var(--color-border);
}

.navbar--sticky {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

/* See the note in drawer.css: `color` is the default for consumer content in
   the brand bar. Our own children each carry their own on-brand rule and keep
   winning on specificity; this only catches everything else. It also covers
   the mobile .navbar__nav dropdown, which inherits from here. */
.navbar--brand,
.navbar--dark {
  background: var(--color-brand-chrome);
  color: var(--color-on-brand);
  border-bottom-color: transparent;
}

.navbar__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-2) var(--space-4);
}

.navbar__left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.navbar__logo {
  display: flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-foreground);
}

.navbar--brand .navbar__logo,
.navbar--dark .navbar__logo {
  color: var(--color-on-brand);
}

.navbar__nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1 1 auto;
}

.navbar__link {
  padding: var(--space-1-5) var(--space-3);
  border-radius: var(--radius-base);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-muted-foreground);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.navbar__link:hover {
  background: var(--color-muted);
  color: var(--color-foreground);
}
.navbar__link--active {
  color: var(--color-primary);
  font-weight: var(--font-semibold);
}

.navbar--brand .navbar__link,
.navbar--dark .navbar__link {
  color: color-mix(in srgb, var(--color-on-brand) 75%, transparent);
}
.navbar--brand .navbar__link:hover,
.navbar--dark .navbar__link:hover {
  background: color-mix(in srgb, var(--color-on-brand) 10%, transparent);
  color: var(--color-on-brand);
}
.navbar--brand .navbar__link--active,
.navbar--dark .navbar__link--active {
  color: var(--color-on-brand);
}

/* Same reasoning as the .drawer--brand .text--muted rule in drawer.css: these
   set their own color and would otherwise put a surface-ramp grey on chrome. */
.navbar--brand .text--muted,
.navbar--brand .text--secondary,
.navbar--dark .text--muted,
.navbar--dark .text--secondary {
  color: color-mix(in srgb, var(--color-on-brand) 75%, transparent);
}

.navbar__search {
  flex-shrink: 0;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.navbar__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--color-muted-foreground);
  background: transparent;
  border: none;
  border-radius: var(--radius-base);
  cursor: pointer;
}
.navbar__toggle:hover {
  background: var(--color-muted);
}
.navbar--brand .navbar__toggle,
.navbar--dark .navbar__toggle {
  color: var(--color-on-brand);
}
.navbar--brand .navbar__toggle:hover,
.navbar--dark .navbar__toggle:hover {
  background: color-mix(in srgb, var(--color-on-brand) 10%, transparent);
}

@media (max-width: 768px) {
  .navbar__toggle {
    display: inline-flex;
  }
  .navbar__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
    padding: var(--space-2);
    background: var(--color-surface);
    color: var(--color-foreground);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
  }
  .navbar__nav.navbar__nav--open {
    display: flex;
  }
  /* The mobile dropdown re-establishes a surface, so it has to re-establish
     the brand foreground too — it cannot inherit it from .navbar--brand now
     that .navbar__nav above sets an explicit color of its own. */
  .navbar--brand .navbar__nav,
  .navbar--dark .navbar__nav {
    background: var(--color-brand-chrome);
    color: var(--color-on-brand);
    border-bottom-color: color-mix(in srgb, var(--color-on-brand) 10%, transparent);
  }
}

}

@layer components {
/* ---- Container (vertical flex stack / page shell) ---- */
/* Column stack with a named-scale gap — the block-layout primitive for page
   and form sections. The container fills its parent's width (width: 100%) and
   centers itself via a responsive max-width + auto margins; children stretch
   full width (no default centering, Bootstrap-style). width: 100% keeps it
   full-width even when the container is a flex item (e.g. inside a Col with
   display:flex) — the auto margins would otherwise defeat flex stretch and
   collapse it to content width. Padding is horizontal-only (Bootstrap-style):
   the inset --container-inset-x grows with the screen (16px below 640px,
   24px ≥ 640px, 32px ≥ 1024px); there is no vertical padding — vertical rhythm
   comes from the named gap. Use Row for horizontal lines and Col for cells;
   center columns with <Row justify="center">. */

.container {
  box-sizing: border-box;
  width: 100%;
  display: flex;
  flex-direction: column;
  margin-left: auto;
  margin-right: auto;
  padding: 0 var(--container-inset-x);
}

@media (min-width: 640px)  { .container { max-width: 640px; } }
@media (min-width: 768px)  { .container { max-width: 768px; } }
@media (min-width: 1024px) { .container { max-width: 1024px; } }
@media (min-width: 1280px) { .container { max-width: 1280px; } }
@media (min-width: 1536px) { .container { max-width: 1536px; } }
@media (min-width: 1344px) { .container { max-width: 1600px; } }

/* Full width — drops the centered max-width and auto margins, keeps the inset
   padding. 100% rather than none: with `none`, a child wider than the parent
   (a wide table, a long <pre>) stretches the container past the viewport
   instead of scrolling inside it. */
.container--fluid {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* Padding — overrides the default horizontal inset. none removes it entirely;
   the named scale sets all sides (the base has no vertical padding). */
.container--padding-none { padding: 0; }
.container--padding-xs   { padding: var(--space-1); }
.container--padding-sm   { padding: var(--space-2); }
.container--padding-md   { padding: var(--space-4); }
.container--padding-lg   { padding: var(--space-6); }
.container--padding-xl   { padding: var(--space-8); }

/* Padding — horizontal only */
.container--padding-x-none { padding-left: 0; padding-right: 0; }
.container--padding-x-xs   { padding-left: var(--space-1); padding-right: var(--space-1); }
.container--padding-x-sm   { padding-left: var(--space-2); padding-right: var(--space-2); }
.container--padding-x-md   { padding-left: var(--space-4); padding-right: var(--space-4); }
.container--padding-x-lg   { padding-left: var(--space-6); padding-right: var(--space-6); }
.container--padding-x-xl   { padding-left: var(--space-8); padding-right: var(--space-8); }

/* Padding — vertical only */
.container--padding-y-none { padding-top: 0; padding-bottom: 0; }
.container--padding-y-xs   { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.container--padding-y-sm   { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.container--padding-y-md   { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.container--padding-y-lg   { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.container--padding-y-xl   { padding-top: var(--space-8); padding-bottom: var(--space-8); }

/* Gap modifiers */
.container--gap-none { gap: var(--space-0); }
.container--gap-xs   { gap: var(--space-1); }
.container--gap-sm   { gap: var(--space-2); }
.container--gap-md   { gap: var(--space-4); }
.container--gap-lg   { gap: var(--space-6); }
.container--gap-xl   { gap: var(--space-8); }

/* Alignment (cross axis) — opt-in; default is stretch */
.container--align-start    { align-items: flex-start; }
.container--align-center   { align-items: center; }
.container--align-end      { align-items: flex-end; }
.container--align-stretch  { align-items: stretch; }
.container--align-baseline { align-items: baseline; }

/* Justify (main axis) */
.container--justify-start   { justify-content: flex-start; }
.container--justify-center  { justify-content: center; }
.container--justify-end     { justify-content: flex-end; }
.container--justify-between { justify-content: space-between; }
.container--justify-around  { justify-content: space-around; }
.container--justify-evenly  { justify-content: space-evenly; }

}

@layer components {
/* ---- Grid (CSS grid) ---- */
/* True grid layout primitive — display:grid with explicit column counts,
   responsive tiers, and a named-scale gap. Unlike Row/Col (flexbox), the gap
   is real CSS grid `gap`, so fractional tracks sum to 100% and both
   horizontal + vertical spacing are handled. Children are Cells (`.grid__cell`
   / `<Grid.Cell>`), which can span multiple tracks via `--span-*` /
   tier span modifiers. Use Grid for card layouts (e.g. 2-up site cards),
   Row/Col for form lines. */

.grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

/* Column counts — mobile-first, applies at every breakpoint */
.grid--cols-1  { grid-template-columns: repeat(1,  minmax(0, 1fr)); }
.grid--cols-2  { grid-template-columns: repeat(2,  minmax(0, 1fr)); }
.grid--cols-3  { grid-template-columns: repeat(3,  minmax(0, 1fr)); }
.grid--cols-4  { grid-template-columns: repeat(4,  minmax(0, 1fr)); }
.grid--cols-5  { grid-template-columns: repeat(5,  minmax(0, 1fr)); }
.grid--cols-6  { grid-template-columns: repeat(6,  minmax(0, 1fr)); }
.grid--cols-7  { grid-template-columns: repeat(7,  minmax(0, 1fr)); }
.grid--cols-8  { grid-template-columns: repeat(8,  minmax(0, 1fr)); }
.grid--cols-9  { grid-template-columns: repeat(9,  minmax(0, 1fr)); }
.grid--cols-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
.grid--cols-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); }
.grid--cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

/* Gap modifiers */
.grid--gap-none { gap: var(--space-0); }
.grid--gap-xs   { gap: var(--space-1); }
.grid--gap-sm   { gap: var(--space-2); }
.grid--gap-md   { gap: var(--space-4); }
.grid--gap-lg   { gap: var(--space-6); }
.grid--gap-xl   { gap: var(--space-8); }

/* Responsive column counts (min-width breakpoints matching row/col) */
@media (min-width: 640px) {
  .grid--sm-cols-1  { grid-template-columns: repeat(1,  minmax(0, 1fr)); }
  .grid--sm-cols-2  { grid-template-columns: repeat(2,  minmax(0, 1fr)); }
  .grid--sm-cols-3  { grid-template-columns: repeat(3,  minmax(0, 1fr)); }
  .grid--sm-cols-4  { grid-template-columns: repeat(4,  minmax(0, 1fr)); }
  .grid--sm-cols-5  { grid-template-columns: repeat(5,  minmax(0, 1fr)); }
  .grid--sm-cols-6  { grid-template-columns: repeat(6,  minmax(0, 1fr)); }
  .grid--sm-cols-7  { grid-template-columns: repeat(7,  minmax(0, 1fr)); }
  .grid--sm-cols-8  { grid-template-columns: repeat(8,  minmax(0, 1fr)); }
  .grid--sm-cols-9  { grid-template-columns: repeat(9,  minmax(0, 1fr)); }
  .grid--sm-cols-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .grid--sm-cols-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); }
  .grid--sm-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .grid--md-cols-1  { grid-template-columns: repeat(1,  minmax(0, 1fr)); }
  .grid--md-cols-2  { grid-template-columns: repeat(2,  minmax(0, 1fr)); }
  .grid--md-cols-3  { grid-template-columns: repeat(3,  minmax(0, 1fr)); }
  .grid--md-cols-4  { grid-template-columns: repeat(4,  minmax(0, 1fr)); }
  .grid--md-cols-5  { grid-template-columns: repeat(5,  minmax(0, 1fr)); }
  .grid--md-cols-6  { grid-template-columns: repeat(6,  minmax(0, 1fr)); }
  .grid--md-cols-7  { grid-template-columns: repeat(7,  minmax(0, 1fr)); }
  .grid--md-cols-8  { grid-template-columns: repeat(8,  minmax(0, 1fr)); }
  .grid--md-cols-9  { grid-template-columns: repeat(9,  minmax(0, 1fr)); }
  .grid--md-cols-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .grid--md-cols-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); }
  .grid--md-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .grid--lg-cols-1  { grid-template-columns: repeat(1,  minmax(0, 1fr)); }
  .grid--lg-cols-2  { grid-template-columns: repeat(2,  minmax(0, 1fr)); }
  .grid--lg-cols-3  { grid-template-columns: repeat(3,  minmax(0, 1fr)); }
  .grid--lg-cols-4  { grid-template-columns: repeat(4,  minmax(0, 1fr)); }
  .grid--lg-cols-5  { grid-template-columns: repeat(5,  minmax(0, 1fr)); }
  .grid--lg-cols-6  { grid-template-columns: repeat(6,  minmax(0, 1fr)); }
  .grid--lg-cols-7  { grid-template-columns: repeat(7,  minmax(0, 1fr)); }
  .grid--lg-cols-8  { grid-template-columns: repeat(8,  minmax(0, 1fr)); }
  .grid--lg-cols-9  { grid-template-columns: repeat(9,  minmax(0, 1fr)); }
  .grid--lg-cols-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .grid--lg-cols-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); }
  .grid--lg-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .grid--xl-cols-1  { grid-template-columns: repeat(1,  minmax(0, 1fr)); }
  .grid--xl-cols-2  { grid-template-columns: repeat(2,  minmax(0, 1fr)); }
  .grid--xl-cols-3  { grid-template-columns: repeat(3,  minmax(0, 1fr)); }
  .grid--xl-cols-4  { grid-template-columns: repeat(4,  minmax(0, 1fr)); }
  .grid--xl-cols-5  { grid-template-columns: repeat(5,  minmax(0, 1fr)); }
  .grid--xl-cols-6  { grid-template-columns: repeat(6,  minmax(0, 1fr)); }
  .grid--xl-cols-7  { grid-template-columns: repeat(7,  minmax(0, 1fr)); }
  .grid--xl-cols-8  { grid-template-columns: repeat(8,  minmax(0, 1fr)); }
  .grid--xl-cols-9  { grid-template-columns: repeat(9,  minmax(0, 1fr)); }
  .grid--xl-cols-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .grid--xl-cols-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); }
  .grid--xl-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

@media (min-width: 1536px) {
  .grid--xxl-cols-1  { grid-template-columns: repeat(1,  minmax(0, 1fr)); }
  .grid--xxl-cols-2  { grid-template-columns: repeat(2,  minmax(0, 1fr)); }
  .grid--xxl-cols-3  { grid-template-columns: repeat(3,  minmax(0, 1fr)); }
  .grid--xxl-cols-4  { grid-template-columns: repeat(4,  minmax(0, 1fr)); }
  .grid--xxl-cols-5  { grid-template-columns: repeat(5,  minmax(0, 1fr)); }
  .grid--xxl-cols-6  { grid-template-columns: repeat(6,  minmax(0, 1fr)); }
  .grid--xxl-cols-7  { grid-template-columns: repeat(7,  minmax(0, 1fr)); }
  .grid--xxl-cols-8  { grid-template-columns: repeat(8,  minmax(0, 1fr)); }
  .grid--xxl-cols-9  { grid-template-columns: repeat(9,  minmax(0, 1fr)); }
  .grid--xxl-cols-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .grid--xxl-cols-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); }
  .grid--xxl-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

/* Cell */
.grid__cell {
  min-width: 0;
}

/* Cell span — default spans 1 track */
.grid__cell--span-1  { grid-column: span 1; }
.grid__cell--span-2  { grid-column: span 2; }
.grid__cell--span-3  { grid-column: span 3; }
.grid__cell--span-4  { grid-column: span 4; }
.grid__cell--span-5  { grid-column: span 5; }
.grid__cell--span-6  { grid-column: span 6; }
.grid__cell--span-7  { grid-column: span 7; }
.grid__cell--span-8  { grid-column: span 8; }
.grid__cell--span-9  { grid-column: span 9; }
.grid__cell--span-10 { grid-column: span 10; }
.grid__cell--span-11 { grid-column: span 11; }
.grid__cell--span-12 { grid-column: span 12; }

@media (min-width: 640px) {
  .grid__cell--sm-span-1  { grid-column: span 1; }
  .grid__cell--sm-span-2  { grid-column: span 2; }
  .grid__cell--sm-span-3  { grid-column: span 3; }
  .grid__cell--sm-span-4  { grid-column: span 4; }
  .grid__cell--sm-span-5  { grid-column: span 5; }
  .grid__cell--sm-span-6  { grid-column: span 6; }
  .grid__cell--sm-span-7  { grid-column: span 7; }
  .grid__cell--sm-span-8  { grid-column: span 8; }
  .grid__cell--sm-span-9  { grid-column: span 9; }
  .grid__cell--sm-span-10 { grid-column: span 10; }
  .grid__cell--sm-span-11 { grid-column: span 11; }
  .grid__cell--sm-span-12 { grid-column: span 12; }
}

@media (min-width: 768px) {
  .grid__cell--md-span-1  { grid-column: span 1; }
  .grid__cell--md-span-2  { grid-column: span 2; }
  .grid__cell--md-span-3  { grid-column: span 3; }
  .grid__cell--md-span-4  { grid-column: span 4; }
  .grid__cell--md-span-5  { grid-column: span 5; }
  .grid__cell--md-span-6  { grid-column: span 6; }
  .grid__cell--md-span-7  { grid-column: span 7; }
  .grid__cell--md-span-8  { grid-column: span 8; }
  .grid__cell--md-span-9  { grid-column: span 9; }
  .grid__cell--md-span-10 { grid-column: span 10; }
  .grid__cell--md-span-11 { grid-column: span 11; }
  .grid__cell--md-span-12 { grid-column: span 12; }
}

@media (min-width: 1024px) {
  .grid__cell--lg-span-1  { grid-column: span 1; }
  .grid__cell--lg-span-2  { grid-column: span 2; }
  .grid__cell--lg-span-3  { grid-column: span 3; }
  .grid__cell--lg-span-4  { grid-column: span 4; }
  .grid__cell--lg-span-5  { grid-column: span 5; }
  .grid__cell--lg-span-6  { grid-column: span 6; }
  .grid__cell--lg-span-7  { grid-column: span 7; }
  .grid__cell--lg-span-8  { grid-column: span 8; }
  .grid__cell--lg-span-9  { grid-column: span 9; }
  .grid__cell--lg-span-10 { grid-column: span 10; }
  .grid__cell--lg-span-11 { grid-column: span 11; }
  .grid__cell--lg-span-12 { grid-column: span 12; }
}

@media (min-width: 1280px) {
  .grid__cell--xl-span-1  { grid-column: span 1; }
  .grid__cell--xl-span-2  { grid-column: span 2; }
  .grid__cell--xl-span-3  { grid-column: span 3; }
  .grid__cell--xl-span-4  { grid-column: span 4; }
  .grid__cell--xl-span-5  { grid-column: span 5; }
  .grid__cell--xl-span-6  { grid-column: span 6; }
  .grid__cell--xl-span-7  { grid-column: span 7; }
  .grid__cell--xl-span-8  { grid-column: span 8; }
  .grid__cell--xl-span-9  { grid-column: span 9; }
  .grid__cell--xl-span-10 { grid-column: span 10; }
  .grid__cell--xl-span-11 { grid-column: span 11; }
  .grid__cell--xl-span-12 { grid-column: span 12; }
}

@media (min-width: 1536px) {
  .grid__cell--xxl-span-1  { grid-column: span 1; }
  .grid__cell--xxl-span-2  { grid-column: span 2; }
  .grid__cell--xxl-span-3  { grid-column: span 3; }
  .grid__cell--xxl-span-4  { grid-column: span 4; }
  .grid__cell--xxl-span-5  { grid-column: span 5; }
  .grid__cell--xxl-span-6  { grid-column: span 6; }
  .grid__cell--xxl-span-7  { grid-column: span 7; }
  .grid__cell--xxl-span-8  { grid-column: span 8; }
  .grid__cell--xxl-span-9  { grid-column: span 9; }
  .grid__cell--xxl-span-10 { grid-column: span 10; }
  .grid__cell--xxl-span-11 { grid-column: span 11; }
  .grid__cell--xxl-span-12 { grid-column: span 12; }
}

}

@layer components {
/* ---- Card ---- */
.card {
  background: var(--color-surface);
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card--elevated {
  border-color: transparent;
  box-shadow: var(--shadow-md);
}

.card--flat {
  border-color: transparent;
  box-shadow: none;
  background: var(--color-muted);
  color: var(--color-foreground);
}

.card--interactive {
  cursor: pointer;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.card--interactive:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border-strong);
}

/* Opt out of the corner clipping. The base `overflow: hidden` is what rounds
   off edge-to-edge card media, but it also traps any non-portalled popover
   (Select, Dropdown, Combobox) rendered inside the card. Reach for this when
   a card contains one; keep the default when it contains media. */
.card--overflow-visible {
  overflow: visible;
}

/* Card sections — padding driven by the --space-inset-* tokens */
.card__header {
  padding: var(--space-inset-sm) var(--space-inset-lg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.card__body {
  padding: var(--space-inset-lg);
}

.card__footer {
  padding: var(--space-inset-sm) var(--space-inset-lg);
  border-top: 1px solid var(--color-border);
  background: var(--color-muted);
  color: var(--color-foreground);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.card__header-content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.card__header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: var(--space-2);
}

.card__title {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-foreground);
  margin: 0;
}

.card__description {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-muted-foreground);
  margin: 0;
  line-height: var(--leading-relaxed);
}

/* Compact variant */
.card--compact .card__header,
.card--compact .card__footer {
  padding: var(--space-inset-sm);
}
.card--compact .card__body {
  padding: var(--space-inset-sm);
}

}

@layer components {
/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-0-5) var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Variants
   Status badges use the <status>-subtle / <status>-subtle-foreground pair,
   with the border derived as a 25% mix of the status color — the same shape
   alert.css uses. These were previously twelve hardcoded Tailwind hexes,
   which meant four of the six variants were off-brand and none of them
   followed the theme. */
.badge--primary {
  background: var(--color-primary);
  color: var(--color-primary-foreground);
}

.badge--secondary {
  background: var(--color-muted);
  color: var(--color-foreground);
}

.badge--success {
  background: var(--color-success-subtle);
  color: var(--color-success-subtle-foreground);
  border-color: color-mix(in srgb, var(--color-success) 25%, transparent);
}

.badge--error {
  background: var(--color-error-subtle);
  color: var(--color-error-subtle-foreground);
  border-color: color-mix(in srgb, var(--color-error) 25%, transparent);
}

.badge--warning {
  background: var(--color-warning-subtle);
  color: var(--color-warning-subtle-foreground);
  border-color: color-mix(in srgb, var(--color-warning) 25%, transparent);
}

.badge--info {
  background: var(--color-info-subtle);
  color: var(--color-info-subtle-foreground);
  border-color: color-mix(in srgb, var(--color-info) 25%, transparent);
}

.badge--outline {
  background: transparent;
  color: var(--color-foreground);
  border-color: var(--color-border);
}

/* Sizes */
.badge--sm {
  padding: 0 var(--space-1-5);
  font-size: var(--text-2xs);
}

.badge--lg {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
}

/* Dot indicator */
.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

}

@layer components {
/* ---- Form Input ---- */
.input-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.input-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-0-5);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-foreground);
}

.input-label__required {
  color: var(--color-error);
  flex-shrink: 0;
}

.input {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-foreground);
  background: var(--color-surface);
  /* --color-border-strong, not --color-border: an input boundary is a control
     boundary, so WCAG SC 1.4.11 requires 3:1 against the surface.
     --color-border is 1.57:1 and is for decorative dividers. */
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
  line-height: var(--leading-normal);
}

.input::placeholder {
  color: var(--color-disabled-foreground);
}

.input:hover:not(:disabled) {
  border-color: var(--color-border-hover);
}

.input:focus {
  outline: none;
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-ring) 20%, transparent);
}

.input:disabled {
  background: var(--color-muted);
  color: var(--color-disabled-foreground);
  cursor: not-allowed;
}

/* States */
.input--error {
  border-color: var(--color-error);
}
.input--error:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-error) 20%, transparent);
}

.input--success {
  border-color: var(--color-success);
}

/* Sizes */
.input--sm {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
}
.input--lg {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
}

/* Textarea */
.textarea {
  resize: vertical;
  min-height: 80px;
}

/* Select
   The chevron is a data-URI SVG, and a data URI cannot read a CSS variable —
   the stroke color has to be literal. This is the one sanctioned exception to
   the "no literals, no [data-theme] in component CSS" rule, and
   scripts/check-tokens.sh excludes forms.css for exactly this.
   A mask-image would let the chevron inherit currentColor, but <select> is a
   replaced element: masking it would mask the option text too. Moving the
   chevron to a wrapper pseudo-element would change the HTML contract, so the
   two literals stay, matched to --color-muted-foreground in each theme:
   neutrals-80 (light) and neutrals-30 (dark). */
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23515157' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-2) center;
  background-size: 1.25rem;
  padding-right: var(--space-8);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23D6D6DD' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  }
}

[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23D6D6DD' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
}

/* Helper / error text */
.input-hint {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-muted-foreground);
}

.input-error-msg {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-error);
}

}

@layer components {
/* ---- Data Table ---- */

.data-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

/* Header */
.data-table__head {
  background: var(--color-muted);
}

.data-table__th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--font-semibold);
  font-size: var(--text-xs);
  color: var(--color-muted-foreground);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
}

.data-table__th--sortable {
  cursor: pointer;
  user-select: none;
}
.data-table__th--sortable:hover {
  color: var(--color-foreground);
  background: var(--color-surface);
}

.data-table__sort-icon {
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-1);
  color: var(--color-disabled-foreground);
}
.data-table__th--sorted .data-table__sort-icon {
  color: var(--color-primary);
}

/* Body */
.data-table__row {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
}
.data-table__row:last-child {
  border-bottom: none;
}
.data-table__row:hover {
  background: var(--color-muted);
}

.data-table__td {
  padding: var(--space-3) var(--space-4);
  color: var(--color-foreground);
  vertical-align: middle;
}

/* Empty state */
.data-table__empty {
  padding: var(--space-12) var(--space-4);
  text-align: center;
  color: var(--color-muted-foreground);
}

/* Pagination */
.data-table__pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-muted);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.data-table__pagination-info {
  font-size: var(--text-sm);
  color: var(--color-muted-foreground);
}

.data-table__pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

}

@layer components {
/* ---- Typography ---- */

/* Base reset */
.text {
  font-family: var(--font-sans);
  margin: 0;
  color: inherit;
}

/* Display headings */
.text--display-xl {
  font-size: var(--text-5xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.text--display-lg {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.text--display {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
}

/* Headings */
.text--h1 {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  line-height: var(--leading-snug);
}

.text--h2 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  line-height: var(--leading-snug);
}

.text--h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  line-height: var(--leading-normal);
}

.text--h4 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: var(--leading-normal);
}

/* Body */
.text--body-lg {
  font-size: var(--text-lg);
  font-weight: var(--font-normal);
  line-height: var(--leading-relaxed);
}

.text--body {
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-relaxed);
}

.text--body-sm {
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
}

/* Caption / overline */
.text--caption {
  font-size: var(--text-xs);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--color-muted-foreground);
}

.text--overline {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted-foreground);
}

/* Color modifiers */
.text--muted    { color: var(--color-muted-foreground); }
.text--secondary { color: var(--color-muted-foreground); }
.text--disabled { color: var(--color-disabled-foreground); }
.text--inverse  { color: var(--color-inverse-foreground); }
.text--primary  { color: var(--color-primary); }
.text--error    { color: var(--color-error); }
.text--success  { color: var(--color-success); }
.text--warning  { color: var(--color-warning); }

/* Alignment */
.text--left   { text-align: left; }
.text--center { text-align: center; }
.text--right  { text-align: right; }

/* Code */
.text--code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-muted);
  color: var(--color-foreground);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
}

/* Monospace text (no background) */
.text--mono {
  font-family: var(--font-mono);
}

}

@layer components {
/* ---- SectionHeading ---- */
/* Section title block: title + description on the left, actions on the right.
   Stacks vertically on small screens. */

.section-heading {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.section-heading--no-border {
  border-bottom: none;
}

.section-heading__content {
  min-width: 0;
}

.section-heading__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-foreground);
  line-height: var(--leading-normal);
}

.section-heading__description {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--color-muted-foreground);
  line-height: var(--leading-normal);
}

.section-heading__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .section-heading {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
  }
}

}

@layer components {
/* ---- Link (branded text link) ---- */

.link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: var(--leading-normal);
  color: var(--color-primary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition-fast);
}

/* Same token as .btn--primary:hover. Mixing toward --color-foreground looked
   right on paper but produced no visible hover in the light theme: navy and
   the light foreground are the same darkness. */
.link:hover {
  color: var(--color-primary-hover);
}

.link:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

/* Underline behavior */
.link--underline-always {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link--underline-hover:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link--underline-none {
  text-decoration: none;
}

/* Disabled */
.link--disabled {
  color: var(--color-disabled-foreground);
  cursor: not-allowed;
  pointer-events: none;
}

}

@layer components {
/* ---- Theme Switcher ---- */
/* Sliding light/dark switch. Rendered as a <button role="switch">; state is
   driven by aria-checked, the same contract as .toggle-action — no extra
   classes, so the React wrapper and the vanilla [data-pf-theme-toggle]
   markup style identically.

   aria-checked="true" means DARK. The switch is "turn on dark mode", which is
   what the label the author supplies will say. */

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-foreground);
  font-family: inherit;
  font-size: var(--text-sm);
}

.theme-switcher:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.theme-switcher:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.theme-switcher__track {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--color-border-strong);
  transition: background var(--transition-fast);
}

.theme-switcher[aria-checked="true"] .theme-switcher__track {
  background: var(--color-primary);
}

.theme-switcher:hover:not(:disabled) .theme-switcher__track {
  background: var(--color-border-hover);
}

.theme-switcher[aria-checked="true"]:hover:not(:disabled) .theme-switcher__track {
  background: var(--color-primary-hover);
}

.theme-switcher__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  transition: left var(--transition-fast);
}

.theme-switcher[aria-checked="true"] .theme-switcher__thumb {
  left: 22px;
}

/* Both icons are always in the DOM and stacked in the same grid cell, so the
   crossfade needs no layout and the markup never changes. State is carried by
   thumb POSITION as well as by the icon — never by color alone. */
.theme-switcher__icon {
  grid-area: 1 / 1;
  display: flex;
  color: var(--color-muted-foreground);
  transition: opacity var(--transition-fast);
}

.theme-switcher__icon--dark {
  opacity: 0;
}

.theme-switcher[aria-checked="true"] .theme-switcher__icon--light {
  opacity: 0;
}

.theme-switcher[aria-checked="true"] .theme-switcher__icon--dark {
  opacity: 1;
  color: var(--color-primary);
}

.theme-switcher__label {
  color: var(--color-foreground);
  line-height: var(--leading-normal);
}

}

@layer components {
/* ---- Button ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-normal);
  border-radius: var(--radius-base);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.btn:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
}

/* Icons inside buttons */
.btn__icon {
  display: inline-flex;
  flex-shrink: 0;
}
.btn__icon svg {
  display: block;
}

/* Variants */
/* Hover mixes toward --color-foreground rather than a fixed navy, so it
   darkens in the light theme and lightens in the dark one. The old rule
   hardcoded navy, which in the light theme is exactly --color-primary — the
   button had no visible hover at all — and in the dark theme replaced the
   blue fill with the surface color. */
.btn--primary {
  background: var(--color-primary);
  color: var(--color-primary-foreground);
  border-color: var(--color-primary);
}
.btn--primary:hover:not(:disabled):not(.btn--disabled) {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-foreground);
  border-color: var(--color-border-strong);
}
.btn--secondary:hover:not(:disabled):not(.btn--disabled) {
  background: var(--color-muted);
}

.btn--soft {
  background: var(--color-primary-subtle);
  color: var(--color-primary-subtle-foreground);
  border-color: transparent;
}
.btn--soft:hover:not(:disabled):not(.btn--disabled) {
  background: color-mix(in srgb, var(--color-primary) 18%, var(--color-primary-subtle));
}

.btn--ghost {
  background: transparent;
  color: var(--color-foreground);
  border-color: transparent;
}
.btn--ghost:hover:not(:disabled):not(.btn--disabled) {
  background: var(--color-muted);
}

.btn--danger {
  background: var(--color-error);
  color: var(--color-error-foreground);
  border-color: var(--color-error);
}
.btn--danger:hover:not(:disabled):not(.btn--disabled) {
  background: color-mix(in srgb, var(--color-error) 82%, var(--color-foreground));
  border-color: color-mix(in srgb, var(--color-error) 82%, var(--color-foreground));
}

/* Ghost danger — no fill; error-colored text/icon (e.g. icon-only delete). */
.btn--danger-ghost {
  background: transparent;
  color: var(--color-error);
  border-color: transparent;
}
/* The label darkens to -subtle-foreground on hover: --color-error over
   --color-error-subtle is only 4.01:1 in the light theme. */
.btn--danger-ghost:hover:not(:disabled):not(.btn--disabled) {
  background: var(--color-error-subtle);
  color: var(--color-error-subtle-foreground);
}

/* Sizes */
.btn--xs {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
}
.btn--sm {
  padding: var(--space-1-5) var(--space-3);
  font-size: var(--text-xs);
}
.btn--lg {
  padding: var(--space-2-5) var(--space-5);
  font-size: var(--text-sm);
}
.btn--xl {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

/* Shapes */
.btn--pill {
  border-radius: var(--radius-full);
}
.btn--circle {
  padding: 0;
  border-radius: var(--radius-full);
  width: 36px;
  height: 36px;
}
.btn--circle.btn--xs { width: 28px; height: 28px; }
.btn--circle.btn--sm { width: 32px; height: 32px; }
.btn--circle.btn--lg { width: 40px; height: 40px; }
.btn--circle.btn--xl { width: 44px; height: 44px; }

/* Icon-only button (square) */
.btn--icon-only {
  padding: var(--space-2);
}
.btn--icon-only.btn--xs { padding: var(--space-1); }
.btn--icon-only.btn--sm { padding: var(--space-1-5); }
.btn--icon-only.btn--lg { padding: var(--space-2-5); }
.btn--icon-only.btn--xl { padding: var(--space-3); }

/* States */
.btn:disabled,
.btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--loading {
  cursor: wait;
  opacity: 0.8;
}

}
