@font-face {
  font-family: 'Register Serif';
  src: url('../fonts/works-register/RegisterSerif-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Register Serif';
  src: url('../fonts/works-register/RegisterSerif-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Register Sans';
  src: url('../fonts/works-register/RegisterSans-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Register Sans';
  src: url('../fonts/works-register/RegisterSans-Semibold.woff2') format('woff2');
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Register Mono';
  src: url('../fonts/works-register/RegisterMono-Regular.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

html {
  background: var(--wr-night);
  color: var(--wr-ink);
}

body {
  min-width: 0;
  background: var(--wr-night);
  color: var(--wr-ink);
  font-family: var(--wr-font-sans);
  font-size: 0.9375rem;
}

h1,
h2,
h3,
.brand {
  font-family: var(--wr-font-serif);
}

.amount,
.code-badge,
kbd,
time {
  font-family: var(--wr-font-mono);
}

.flag-stripe {
  z-index: 90;
  height: var(--wr-national-rule-size);
}

:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: var(--wr-focus-width) solid var(--wr-river-bright);
  outline-offset: var(--wr-focus-width);
}

.skip-link {
  z-index: 140;
  color: var(--wr-paper);
  background: var(--wr-river);
  border-radius: var(--wr-shell-radius);
}

.sidebar {
  position: fixed;
  z-index: 80;
  inset: var(--wr-national-rule-size) auto 0 0;
  width: var(--wr-sidebar-width);
  max-width: none;
  height: auto;
  max-height: none;
  margin: 0;
  padding: 0;
  color: var(--wr-paper);
  background: var(--wr-forest);
  border: 0;
  border-right: var(--wr-rule-width) solid var(--wr-night);
  border-radius: 0;
  overflow: hidden;
  transition: width var(--wr-motion-fast) ease, transform var(--wr-motion-fast) ease;
  display: flex;
  flex-direction: column;
}

.module-drawer {
  display: none;
  margin: 0;
  padding: 0;
  color: var(--wr-paper);
  background: var(--wr-forest);
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

.drawer-heading {
  min-height: 4.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: var(--wr-rule-width) solid var(--wr-rule-dark);
}

.brand {
  min-width: 0;
  min-height: var(--wr-control-size);
  padding-inline: 1.0625rem;
  gap: 0.6875rem;
  color: var(--wr-paper);
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  color: var(--wr-night);
  background: var(--wr-brass);
  border-radius: var(--wr-shell-radius);
  font-family: var(--wr-font-serif);
}

.brand-text {
  min-width: 0;
  display: grid;
  gap: 0.1875rem;
}

.brand-text strong {
  font-size: 1.125rem;
  line-height: 1;
}

.brand-text small {
  color: var(--wr-muted-on-forest);
  font-family: var(--wr-font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
}

.drawer-close {
  display: none;
}

.drawer-search {
  display: none;
}

.nav {
  min-height: 0;
  margin: 0;
  padding: 0.625rem 0 1.125rem;
  gap: 0;
  scrollbar-width: thin;
}

.nav-label {
  display: block;
  margin: 0;
  padding: 0.75rem 1.0625rem 0.3125rem;
  color: var(--wr-muted-on-forest);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.nav-item {
  min-height: var(--wr-control-size);
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.3125rem 0.875rem;
  color: var(--wr-paper-on-forest);
  border-left: var(--wr-national-rule-size) solid transparent;
  border-radius: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.nav-item:hover {
  color: var(--wr-paper);
  background: var(--wr-forest-bright);
}

.nav-item.active {
  color: var(--wr-night);
  background: var(--wr-limestone);
  border-left-color: var(--wr-brass);
}

.nav-item .icon {
  width: 1.125rem;
  height: 1.125rem;
  justify-self: center;
}

.nav-local {
  display: flex;
  flex-direction: column;
  margin: 1rem 0.625rem 0.25rem;
  padding-block: 0.25rem;
  border: var(--wr-rule-width) solid var(--wr-rule-dark);
}

.nav-local .nav-label {
  padding-inline: 0.6875rem;
}

.nav-local .nav-item {
  padding-inline: 0.5rem;
}

.rail-toggle {
  min-height: var(--wr-control-size);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: auto 0.625rem 0.625rem;
  padding-inline: 0.75rem;
  color: var(--wr-paper-on-forest);
  background: transparent;
  border: var(--wr-rule-width) solid var(--wr-rule-dark);
  border-radius: var(--wr-shell-radius);
  font-size: 0.875rem;
  font-weight: 600;
}

.rail-toggle .icon {
  transform: rotate(90deg);
}

.topbar {
  z-index: 70;
  top: var(--wr-national-rule-size);
  left: var(--wr-sidebar-width);
  height: var(--wr-topbar-height);
  gap: 0.5rem;
  padding: 0 0.75rem;
  color: var(--wr-paper);
  background: var(--wr-night);
  border-bottom: var(--wr-rule-width) solid var(--wr-rule-dark);
  transition: left var(--wr-motion-fast) ease;
}

.scope-chip {
  min-width: 10.625rem;
  max-width: 19rem;
  min-height: var(--wr-control-size);
  flex: 1 1 13rem;
  padding: 0.375rem 0.75rem;
  color: var(--wr-paper);
  background: var(--wr-night-raised);
  border: var(--wr-rule-width) solid var(--wr-rule-dark);
  border-radius: var(--wr-shell-radius);
}

.scope-chip label {
  color: var(--wr-muted-on-night);
  font-size: 0.8125rem;
  font-weight: 600;
}

.scope-chip select {
  min-width: 0;
  min-height: var(--wr-control-size);
  color: var(--wr-paper);
  font-size: 0.875rem;
  font-weight: 600;
}

.command-trigger,
.top-icon,
.hamburger {
  min-width: var(--wr-control-size);
  min-height: var(--wr-control-size);
  color: var(--wr-paper-on-forest);
  background: transparent;
  border: var(--wr-rule-width) solid var(--wr-rule-dark);
  border-radius: var(--wr-shell-radius);
}

.command-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding-inline: 0.625rem;
  font-family: var(--wr-font-mono);
  font-size: 0.8125rem;
}

.command-trigger b {
  font-family: var(--wr-font-sans);
  font-size: 0.8125rem;
}

.global-search {
  min-width: 8.75rem;
  flex: 1 1 15rem;
  margin-left: 0;
}

.global-search span {
  color: var(--wr-muted-on-night);
  font-size: 0.8125rem;
}

.global-search input {
  width: 100%;
  min-width: 0;
  max-width: 15rem;
  min-height: var(--wr-control-size);
  color: var(--wr-paper);
  background: var(--wr-night-raised);
  border-color: var(--wr-rule-dark);
  border-radius: var(--wr-shell-radius);
}

.user-pill {
  min-width: var(--wr-control-size);
  min-height: var(--wr-control-size);
  color: var(--wr-paper-on-forest);
}

.user-pill span {
  width: 2rem;
  height: 2rem;
  color: var(--wr-night);
  background: var(--wr-brass);
  border-radius: 50%;
  font-family: var(--wr-font-mono);
}

.main-content {
  width: auto;
  max-width: none;
  min-height: 100dvh;
  margin-left: var(--wr-sidebar-width);
  padding: calc(var(--wr-topbar-height) + var(--wr-shell-pad)) var(--wr-shell-pad) 4rem;
  color: var(--wr-ink);
  background-color: var(--wr-limestone);
  background-image:
    linear-gradient(var(--wr-grid-ink) var(--wr-rule-width), transparent var(--wr-rule-width)),
    linear-gradient(90deg, var(--wr-grid-ink) var(--wr-rule-width), transparent var(--wr-rule-width));
  background-size: var(--wr-grid-size) var(--wr-grid-size);
  transition: margin-left var(--wr-motion-fast) ease;
}

.main-content > * {
  width: min(100%, var(--wr-content-max));
  margin-inline: auto;
}

/* The operational pages sit on the light Works Register sheet. Rebind shared
   dark-theme cards and controls at the shell boundary so their foreground and
   surface tokens cannot cross into an unreadable black-on-navy combination. */
.main-content :is(.panel, .kpi-card) {
  color: var(--wr-ink);
  background: var(--wr-paper);
  border-color: var(--wr-rule-ink);
}

.main-content :is(.panel, .kpi-card) :is(h1, h2, h3, .kpi-value) {
  color: var(--wr-ink);
}

.main-content :is(.caption, .cell-sub, .kpi-label, .kpi-meta) {
  color: var(--wr-ink-muted);
}

.main-content :is(.kpi-label, .kpi-meta) {
  font-size: var(--font-size-operational);
}

.main-content .page-head > div > p:not(.eyebrow),
.main-content .detail-scope > div > p:not(.eyebrow) {
  color: var(--wr-ink-muted);
}

.main-content :is(.btn.secondary, .btn.ghost) {
  color: var(--wr-ink);
  border-color: var(--wr-rule-ink);
}

.main-content :is(.btn.secondary, .btn.ghost):hover {
  color: var(--wr-ink);
  background: var(--wr-limestone-deep);
}

.main-content :is(.filter-chip.active, .filter-pills a.active, .page-num.active, .pagination .active) {
  color: var(--wr-paper);
  background: var(--wr-river);
  border-color: var(--wr-river);
}
.breadcrumbs {
  color: var(--wr-ink-muted);
  font-size: 0.8125rem;
}

.breadcrumbs a {
  color: var(--wr-ink-muted);
}

.breadcrumbs [aria-current='page'] {
  color: var(--wr-ink);
}

.sidebar-collapsed .sidebar {
  width: var(--wr-sidebar-rail);
}

.sidebar-collapsed .drawer-heading {
  grid-template-columns: 1fr;
}

.sidebar-collapsed .brand {
  justify-content: center;
  padding-inline: 0;
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-item span,
.sidebar-collapsed .rail-toggle span {
  display: none;
}

.sidebar-collapsed .nav-item {
  grid-template-columns: 1fr;
  padding-inline: 0.5rem;
}

.sidebar-collapsed .nav-local {
  margin-inline: 0.375rem;
}

.sidebar-collapsed .rail-toggle {
  justify-content: center;
  margin-inline: 0.375rem;
  padding-inline: 0;
}

.sidebar-collapsed .rail-toggle .icon {
  transform: rotate(-90deg);
}

.sidebar-collapsed .topbar {
  left: var(--wr-sidebar-rail);
}

.sidebar-collapsed .main-content {
  margin-left: var(--wr-sidebar-rail);
}

.command-dialog {
  color: var(--wr-ink);
  background: var(--wr-paper);
  border: var(--wr-rule-width) solid var(--wr-ink);
  border-radius: var(--wr-shell-radius);
  box-shadow: var(--wr-shadow);
}

.command-dialog::backdrop,
.module-drawer::backdrop {
  background: var(--wr-modal-scrim);
}

.bottom-tabs {
  min-height: var(--wr-bottom-nav-height);
  color: var(--wr-muted-on-night);
  background: var(--wr-night);
  border-top: var(--wr-rule-width) solid var(--wr-rule-dark);
}

.bottom-tabs a {
  min-height: var(--wr-control-size);
  color: var(--wr-muted-on-night);
  font-size: 0.8125rem;
  font-weight: 600;
}

.bottom-tabs a.active,
.bottom-tabs a[aria-current='page'] {
  color: var(--wr-brass);
}

@media (max-width: 75rem) {
  .command-trigger b,
  .user-pill b,
  .global-search span,
  .lang-current {
    display: none;
  }
}

@media (max-width: 56.25rem) {
  .sidebar {
    display: none;
  }

  .module-drawer[open] {
    position: fixed;
    z-index: 120;
    inset: 0 auto 0 0;
    width: min(calc(100vw - 2.75rem), var(--wr-drawer-max));
    max-width: var(--wr-drawer-max);
    height: 100dvh;
    max-height: none;
    display: flex;
    flex-direction: column;
    border-right: var(--wr-national-rule-size) solid var(--wr-night);
    box-shadow: var(--wr-shadow);
  }

  .drawer-close {
    min-width: var(--wr-control-size);
    min-height: var(--wr-control-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    padding-inline: 0.625rem;
    color: var(--wr-paper);
    background: transparent;
    border: var(--wr-rule-width) solid var(--wr-rule-dark);
    border-radius: var(--wr-shell-radius);
    font-size: 0.875rem;
    font-weight: 600;
  }

  .rail-toggle {
    display: none;
  }

  .drawer-search {
    display: grid;
    gap: 0.375rem;
    padding: 0.75rem 0.875rem;
    border-bottom: var(--wr-rule-width) solid var(--wr-rule-dark);
    color: var(--wr-muted-on-forest);
    font-size: 0.8125rem;
    font-weight: 600;
  }

  .drawer-search input {
    width: 100%;
    min-height: var(--wr-control-size);
    color: var(--wr-paper);
    background: var(--wr-night-raised);
    border-color: var(--wr-rule-dark);
    border-radius: var(--wr-shell-radius);
    font-size: 1rem;
  }

  .topbar,
  .sidebar-collapsed .topbar {
    left: 0;
    gap: 0.25rem;
    padding-inline: 0.5rem;
  }

  .hamburger {
    display: inline-grid;
    place-items: center;
  }

  .hamburger span,
  .command-trigger b,
  .user-pill b,
  .global-search,
  .topbar .lang-current {
    display: none;
  }

  .topbar :is(.lang-menu, .dev-switch-menu),
  .topbar :is(.lang-menu, .dev-switch-menu) > summary {
    width: var(--wr-control-size);
    min-width: var(--wr-control-size);
    padding-inline: 0;
  }

  .topbar :is(.lang-menu, .dev-switch-menu) > summary {
    justify-content: center;
  }

  .topbar :is(.lang-menu, .dev-switch-menu) > summary .icon:last-child {
    display: none;
  }

  .scope-chip {
    min-width: 4.375rem;
    max-width: none;
    flex: 1 1 auto;
    overflow: hidden;
    padding-inline: 0.5rem;
  }

  .scope-chip select {
    width: 100%;
    text-overflow: ellipsis;
  }

  .main-content,
  .sidebar-collapsed .main-content {
    margin-left: 0;
    padding: calc(var(--wr-topbar-height) + var(--wr-shell-pad-mobile)) var(--wr-shell-pad-mobile) calc(var(--wr-bottom-nav-height) + 1.5rem);
  }

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

@media (max-width: 18rem) {
  :root {
    --wr-topbar-height: 7rem;
  }

  .topbar,
  .sidebar-collapsed .topbar {
    flex-wrap: wrap;
    align-content: center;
  }

  .scope-chip {
    flex: 1 1 calc(100% - var(--wr-control-size) - 0.25rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .module-drawer,
  .topbar,
  .main-content {
    transition: none;
  }
}
