/*
 * RESTOCRM Sites — the look of RESTOCRM Platform's admin on Orchard's TheAdmin (RS-015).
 *
 * Source of truth: restocrmloyalty/restocrm-fe-admin-panel, origin/main be63c0f — React + shadcn/ui
 * (new-york, slate) on Tailwind v4. Nothing of that stack runs here: this file restates its tokens and its
 * components' classes for the markup Orchard's admin and our Razor screens already have. Decisions and the
 * map of what comes from where: docs/architecture/adr-021-admin-ui-from-platform.md; how a screen uses it: docs/admin-ui.md.
 *
 *   1. Typeface      Inter, the platform's own files (public/fonts), as woff2 subsets.
 *   2. Tokens        src/styles/theme-tokens-slate.css, verbatim — light and dark.
 *   3. Bridge        Bootstrap 5 and TheAdmin variables pointed at the tokens.
 *   4. Shell         TheAdmin's top bar, sidebar and content as the platform's inset sidebar layout.
 *   5. Components    Bootstrap's components drawn as the platform's (components/ui/*).
 *   6. ra-*          The platform's own patterns for our screens: page header, card, status badge, stats,
 *                    empty state, toolbar. Prefixed ra- (RESTOCRM admin): the public site's design system
 *                    (web/src/styles) owns rc-, with other values under the same names.
 *
 * Tailwind's shadow and radius scale, as the platform uses them:
 *   shadow-xs 0 1px 2px 0 rgb(0 0 0 / .05)
 *   shadow-sm 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1)
 *   shadow-md 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1)
 *   shadow-lg 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1)
 *   rounded-sm radius-4px · rounded-md radius-2px · rounded-lg radius · rounded-xl radius+4px
 */

/* 1. Typeface ---------------------------------------------------------------------------------------- */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/inter-400.woff2) format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/inter-500.woff2) format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/inter-600.woff2) format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/inter-700.woff2) format('woff2');
}

/* 2. Tokens — theme-tokens-slate.css at be63c0f, verbatim. Orchard's theme switch sets data-bs-theme on
      <html> where the platform sets .dark; «Auto» resolves to one of the two before the page draws. ----- */

:root,
[data-bs-theme='light'] {
  --radius: 0.625rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.129 0.042 264.695);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.129 0.042 264.695);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.129 0.042 264.695);
  --primary: oklch(0.208 0.042 265.755);
  --primary-foreground: oklch(0.984 0.003 247.858);
  --secondary: oklch(0.968 0.007 247.896);
  --secondary-foreground: oklch(0.208 0.042 265.755);
  --muted: oklch(0.968 0.007 247.896);
  --muted-foreground: oklch(0.554 0.046 257.417);
  --accent: oklch(0.968 0.007 247.896);
  --accent-foreground: oklch(0.208 0.042 265.755);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.929 0.013 255.508);
  --input: oklch(0.929 0.013 255.508);
  --ring: oklch(0.704 0.04 256.788);
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);

  --sidebar: var(--background);
  --sidebar-foreground: var(--foreground);
  --sidebar-primary: var(--primary);
  --sidebar-primary-foreground: var(--primary-foreground);
  --sidebar-accent: var(--accent);
  --sidebar-accent-foreground: var(--accent-foreground);
  --sidebar-border: var(--border);
  --sidebar-ring: var(--ring);
}

[data-bs-theme='dark'] {
  --background: oklch(0.129 0.042 264.695);
  --foreground: oklch(0.984 0.003 247.858);
  --card: oklch(0.14 0.04 259.21);
  --card-foreground: oklch(0.984 0.003 247.858);
  --popover: oklch(0.208 0.042 265.755);
  --popover-foreground: oklch(0.984 0.003 247.858);
  --primary: oklch(0.929 0.013 255.508);
  --primary-foreground: oklch(0.208 0.042 265.755);
  --secondary: oklch(0.279 0.041 260.031);
  --secondary-foreground: oklch(0.984 0.003 247.858);
  --muted: oklch(0.279 0.041 260.031);
  --muted-foreground: oklch(0.704 0.04 256.788);
  --accent: oklch(0.279 0.041 260.031);
  --accent-foreground: oklch(0.984 0.003 247.858);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.551 0.027 264.364);
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.696 0.17 162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);

  /* Restated so that an element Bootstrap marks dark on its own resolves them against the dark values. */
  --sidebar: var(--background);
  --sidebar-foreground: var(--foreground);
  --sidebar-primary: var(--primary);
  --sidebar-primary-foreground: var(--primary-foreground);
  --sidebar-accent: var(--accent);
  --sidebar-accent-foreground: var(--accent-foreground);
  --sidebar-border: var(--border);
  --sidebar-ring: var(--ring);
}

/* 3. Bridge — what the tokens mean to Bootstrap and TheAdmin. Values that Bootstrap needs as RGB triplets
      (the *-rgb utilities) are not bridged; the components that use them are restyled in section 5. ----- */

:root,
[data-bs-theme='light'],
[data-bs-theme='dark'] {
  --ra-font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
    'Segoe UI Symbol', 'Noto Color Emoji';
  --ra-radius-sm: calc(var(--radius) - 4px);
  --ra-radius-md: calc(var(--radius) - 2px);
  --ra-radius-lg: var(--radius);
  --ra-radius-xl: calc(var(--radius) + 4px);
  --ra-shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --ra-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --ra-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --ra-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  /* focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 */
  --ra-ring: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
  --ra-ring-destructive: 0 0 0 3px color-mix(in oklab, var(--destructive) 20%, transparent);

  --bs-body-font-family: var(--ra-font-sans);
  --bs-body-font-size: 0.875rem;
  --bs-body-line-height: 1.5;
  --bs-body-color: var(--foreground);
  --bs-body-bg: var(--background);
  --bs-emphasis-color: var(--foreground);
  --bs-secondary-color: var(--muted-foreground);
  --bs-secondary-bg: var(--secondary);
  --bs-tertiary-color: var(--muted-foreground);
  --bs-tertiary-bg: var(--muted);
  --bs-heading-color: var(--foreground);
  --bs-border-color: var(--border);
  --bs-border-color-translucent: var(--border);
  --bs-border-radius: var(--ra-radius-md);
  --bs-border-radius-sm: var(--ra-radius-sm);
  --bs-border-radius-lg: var(--ra-radius-lg);
  --bs-border-radius-xl: var(--ra-radius-xl);
  --bs-box-shadow: var(--ra-shadow-md);
  --bs-box-shadow-sm: var(--ra-shadow-sm);
  --bs-box-shadow-lg: var(--ra-shadow-lg);
  --bs-focus-ring-width: 3px;
  --bs-focus-ring-color: color-mix(in oklab, var(--ring) 50%, transparent);
  --bs-code-color: var(--foreground);
  --bs-highlight-bg: var(--accent);
  --bs-form-invalid-color: var(--destructive);
  --bs-form-invalid-border-color: var(--destructive);
  --bs-form-valid-color: var(--foreground);
  --bs-form-valid-border-color: var(--input);

  --oc-border-content: 1px solid var(--sidebar-border);
  --oc-admin-menu-bg-color: var(--sidebar);
  --oc-scrollbar-color: var(--border);
  --oc-admin-menu-font-color: var(--sidebar-foreground);
  --oc-admin-menu-font-color-hover: var(--sidebar-accent-foreground);
  --oc-admin-menu-item-bg-color: var(--sidebar);
  --oc-admin-menu-item-font-color: var(--sidebar-foreground);
  --oc-admin-menu-item-font-color-active: var(--sidebar-accent-foreground);
  --oc-li-hover-bg-color: var(--sidebar-accent);
  --oc-selected-indicator-color: transparent;
  /* The platform's sidebar is 16rem wide and 3rem folded (components/ui/sidebar.tsx). */
  --oc-start-navigation-width: 16rem;
  --oc-start-navigation-width-when-compact: 3rem;
  --oc-top-nav-height: 3.5rem;
}

html {
  /* body has-[div[data-variant='inset']]:bg-sidebar */
  background-color: var(--sidebar);
  color-scheme: light;
}

html[data-bs-theme='dark'] {
  color-scheme: dark;
}

body {
  font-family: var(--ra-font-sans);
  font-feature-settings: 'cv11';
  background-color: var(--sidebar);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

::selection {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

a {
  color: var(--primary);
  text-decoration: none;
  text-underline-offset: 4px;
}

a:hover {
  color: var(--primary);
  text-decoration: underline;
}

code,
kbd,
samp {
  font-size: 0.8125em;
}

code {
  border-radius: var(--ra-radius-sm);
  background-color: var(--muted);
  padding: 0.125rem 0.375rem;
  color: var(--foreground);
  overflow-wrap: anywhere;
}

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

.text-muted,
.text-body-secondary,
.text-secondary {
  color: var(--muted-foreground) !important;
}

.text-danger {
  color: var(--destructive) !important;
}

.text-success,
.text-primary {
  color: var(--foreground) !important;
}

.bg-light,
.bg-body-tertiary,
.bg-body-secondary {
  background-color: var(--muted) !important;
}

.border,
.border-top,
.border-bottom,
.border-start,
.border-end {
  border-color: var(--border) !important;
}

/* TheAdmin's form hint: FormDescription — text-sm text-muted-foreground. */
.hint {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--muted-foreground) !important;
  word-break: normal;
  overflow-wrap: anywhere;
  hyphens: manual;
}

/* 4. Shell — the platform's inset sidebar layout (components/layout/authenticated-layout.tsx, ui/sidebar.tsx):
      the sidebar and the top strip sit on the sidebar colour, the page is a rounded, shadowed panel. ------- */

.ta-navbar-top.navbar {
  height: var(--oc-top-nav-height);
  border-bottom: 0;
  box-shadow: none;
  background-color: var(--sidebar) !important;
  color: var(--sidebar-foreground) !important;
}

.ta-navbar-top .container-fluid {
  padding-inline: 0.5rem 1rem;
}

.ta-navbar-top .ta-navbar-brand,
.ta-navbar-top .navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  margin: 0;
  border-radius: var(--ra-radius-md);
  padding: 0.5rem;
  color: var(--sidebar-foreground);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
}

.ta-navbar-top .ta-navbar-brand:hover {
  background-color: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  text-decoration: none;
}

.ra-brand-mark {
  display: block;
  flex: none;
  width: 2rem;
  height: 2rem;
}

.ra-brand-text {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.ra-brand-text > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ra-brand-text > small {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 400;
}

/* The top bar's buttons: ghost icon buttons, size-9. */
.ta-navbar-top .user-top-navbar {
  gap: 0.25rem;
  align-items: center;
}

.ta-navbar-top .user-top-navbar .nav-link,
.ta-navbar-top .user-top-navbar .btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: var(--ra-radius-md);
  padding: 0 0.5rem;
  color: var(--sidebar-foreground);
  text-decoration: none;
}

.ta-navbar-top .user-top-navbar .nav-link:hover,
.ta-navbar-top .user-top-navbar .btn-link:hover,
.ta-navbar-top .user-top-navbar .show > .nav-link {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.ta-navbar-top .user-top-navbar .nav-link:focus-visible,
.ta-navbar-top .user-top-navbar .btn-link:focus-visible {
  outline: none;
  box-shadow: var(--ra-ring);
}

/* The page panel: SidebarInset, md:peer-data-[variant=inset]:m-2 ms-0 rounded-xl shadow-sm; Main px-4 py-6. */
.ta-content {
  min-height: calc(100svh - var(--oc-top-nav-height) - 0.5rem);
  margin-top: var(--oc-top-nav-height);
  margin-bottom: 0.5rem;
  border-radius: var(--ra-radius-xl);
  padding: 1.5rem 1rem;
  background-color: var(--background);
  box-shadow: var(--ra-shadow-sm);
  --oc-notify-offset-top: var(--oc-top-nav-height);
}

[dir='ltr'] .ta-content {
  margin-right: 0.5rem;
}

[dir='rtl'] .ta-content {
  margin-left: 0.5rem;
}

@media (min-width: 768px) {
  .ta-content {
    padding: 1.5rem;
  }
}

html[data-bs-theme='dark'] .ta-content {
  /* The panel's edge in the dark: shadow-sm does not read on a near-black page. */
  box-shadow: 0 0 0 1px var(--border);
}

/* The page title: <h2 class='text-2xl font-bold tracking-tight'>, its description text-muted-foreground. */
.ta-content h1,
.ta-content > .ra-page-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.ta-content h2,
.ta-content .h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.0125em;
}

.ta-content h2.h5,
.ta-content .h5 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
  letter-spacing: normal;
}

.ta-content > h1 + p.text-muted,
.ta-content > h1 + .text-muted,
.ra-lead {
  margin-bottom: 1.5rem;
  font-size: 1rem;
  color: var(--muted-foreground);
}

/* The sidebar: SidebarContent > SidebarGroup p-2 > SidebarMenu gap-1 > SidebarMenuButton h-8 rounded-md p-2. */
#ta-left-sidebar {
  background-color: var(--sidebar);
  color: var(--sidebar-foreground);
}

html body:not(.left-sidebar-compact) #ta-left-sidebar,
html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav > ul > li,
html body:not(.left-sidebar-compact) #ta-left-sidebar .footer {
  border: 0;
  background-color: var(--sidebar) !important;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav > ul.menu-admin {
  padding: 0.5rem;
  scrollbar-color: var(--border) transparent;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav > ul > li {
  width: auto;
  margin-bottom: 0.25rem;
  line-height: 2rem;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav > ul > li > figure > ul > li {
  line-height: 1.75rem;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav > ul > li > figure > figcaption {
  height: auto;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav .item-label {
  position: relative;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  border: 0;
  border-radius: var(--ra-radius-md);
  padding: 0 0.5rem !important;
  background: transparent;
  color: var(--sidebar-foreground) !important;
  font-size: 0.875rem;
  font-weight: 400;
  text-decoration: none;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav .item-label:hover,
html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav .item-label:active,
html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav .item-label[aria-expanded='true']:hover {
  background-color: var(--sidebar-accent) !important;
  color: var(--sidebar-accent-foreground) !important;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav .item-label:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--sidebar-ring);
}

/* data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium — and no stripe at the edge. */
html body:not(.left-sidebar-compact) #ta-left-sidebar li.active:not(.has-items) > figure > figcaption > .item-label,
html body:not(.left-sidebar-compact) #ta-left-sidebar li > figure > ul > li.active > .item-label,
html body:not(.left-sidebar-compact) #ta-left-sidebar li > figure > ul > li.active:not(.has-items) > figure > figcaption > .item-label {
  background-color: var(--sidebar-accent) !important;
  color: var(--sidebar-accent-foreground) !important;
  font-weight: 500;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar li.has-items.active > figure > figcaption > .item-label {
  background-color: transparent;
  font-weight: 500;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav li::before,
html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav li::after,
html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav .item-label::before,
html body:not(.left-sidebar-compact) #ta-left-sidebar .footer::before {
  display: none !important;
}

/* [&>svg]:size-4 [&>svg]:shrink-0 — Font Awesome glyphs of Orchard's own items at the same size. */
html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav > ul.menu-admin .item-label > span.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  padding: 0;
  font-size: 0.875rem;
  color: inherit;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav > ul.menu-admin .item-label > span.icon svg {
  width: 1rem;
  height: 1rem;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav > ul.menu-admin .item-label > span.title {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* SidebarMenuSub: mx-3.5 border-s border-sidebar-border px-2.5 py-0.5, items h-7. */
html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav > ul > li > figure > ul {
  margin: 0.125rem 0.875rem;
  border-inline-start: 1px solid var(--sidebar-border);
  padding: 0.125rem 0 0.125rem 0.625rem;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav > ul > li > figure > ul .item-label {
  min-height: 1.75rem;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav > ul > li > figure > ul .item-label > span.icon {
  display: none !important;
}

html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav .collapse-icon,
html body:not(.left-sidebar-compact) #ta-left-sidebar #left-nav .btn-nostyle {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

#ta-left-sidebar .leftbar-compactor {
  color: var(--muted-foreground);
}

#ta-left-sidebar .leftbar-compactor:hover {
  color: var(--sidebar-accent-foreground);
}

/* Folded: collapsible="icon", size-8 buttons in a 3rem rail. */
.left-sidebar-compact #ta-left-sidebar {
  border: 0 !important;
  background-color: var(--sidebar) !important;
}

.left-sidebar-compact #ta-left-sidebar #left-nav > ul > li {
  background-color: var(--sidebar) !important;
}

.left-sidebar-compact #ta-left-sidebar #left-nav > ul > li > figure > figcaption > .item-label {
  border-radius: var(--ra-radius-md);
  color: var(--sidebar-foreground) !important;
}

.left-sidebar-compact #ta-left-sidebar #left-nav > ul > li.active > figure > figcaption > .item-label,
.left-sidebar-compact #ta-left-sidebar #left-nav > ul > li > figure > figcaption > .item-label:hover {
  background-color: var(--sidebar-accent) !important;
  color: var(--sidebar-accent-foreground) !important;
}

html .left-sidebar-compact #ta-left-sidebar #left-nav > ul .item-label > span.icon,
html .left-sidebar-compact #ta-left-sidebar #left-nav > ul > li:not(.has-items) .item-label > span.icon,
html .left-sidebar-compact #ta-left-sidebar #left-nav > ul > li > figure > figcaption > .item-label > span.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

html .left-sidebar-compact #ta-left-sidebar #left-nav > ul .item-label > span.icon svg,
html .left-sidebar-compact #ta-left-sidebar #left-nav > ul > li > figure > figcaption > .item-label > span.icon svg {
  width: 1rem;
  height: 1rem;
}

.left-sidebar-compact #ta-left-sidebar #left-nav li::before,
.left-sidebar-compact #ta-left-sidebar #left-nav .item-label::before {
  display: none !important;
}

/* 5. Components ------------------------------------------------------------------------------------------ */

/* Button — components/ui/button.tsx. */
.btn {
  --bs-btn-padding-x: 1rem;
  --bs-btn-padding-y: 0.5rem;
  --bs-btn-font-family: var(--ra-font-sans);
  --bs-btn-font-size: 0.875rem;
  --bs-btn-font-weight: 500;
  --bs-btn-line-height: 1.25rem;
  --bs-btn-border-radius: var(--ra-radius-md);
  --bs-btn-border-width: 1px;
  --bs-btn-box-shadow: none;
  --bs-btn-focus-box-shadow: var(--ra-ring);
  --bs-btn-disabled-opacity: 0.5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.25rem;
  white-space: nowrap;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: var(--ra-ring);
}

.btn.w-100 {
  display: flex;
}

/* default */
.btn-primary,
.btn-success,
.btn-dark,
.btn-info {
  --bs-btn-color: var(--primary-foreground);
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-color: var(--primary-foreground);
  --bs-btn-hover-bg: color-mix(in oklab, var(--primary) 90%, transparent);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--primary-foreground);
  --bs-btn-active-bg: color-mix(in oklab, var(--primary) 90%, transparent);
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--primary-foreground);
  --bs-btn-disabled-bg: var(--primary);
  --bs-btn-disabled-border-color: var(--primary);
  box-shadow: var(--ra-shadow-xs);
}

/* destructive */
.btn-danger {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--destructive);
  --bs-btn-border-color: var(--destructive);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: color-mix(in oklab, var(--destructive) 90%, transparent);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: color-mix(in oklab, var(--destructive) 90%, transparent);
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--destructive);
  --bs-btn-disabled-border-color: var(--destructive);
  box-shadow: var(--ra-shadow-xs);
}

html[data-bs-theme='dark'] .btn-danger {
  --bs-btn-bg: color-mix(in oklab, var(--destructive) 60%, transparent);
  --bs-btn-border-color: transparent;
}

.btn-danger:focus-visible {
  box-shadow: var(--ra-ring-destructive);
}

/* secondary */
.btn-secondary,
.btn-light,
.btn-warning {
  --bs-btn-color: var(--secondary-foreground);
  --bs-btn-bg: var(--secondary);
  --bs-btn-border-color: var(--secondary);
  --bs-btn-hover-color: var(--secondary-foreground);
  --bs-btn-hover-bg: color-mix(in oklab, var(--secondary) 80%, transparent);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--secondary-foreground);
  --bs-btn-active-bg: color-mix(in oklab, var(--secondary) 80%, transparent);
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--secondary-foreground);
  --bs-btn-disabled-bg: var(--secondary);
  --bs-btn-disabled-border-color: var(--secondary);
  box-shadow: var(--ra-shadow-xs);
}

/* outline — one neutral outline, whatever colour Bootstrap's class named. A command that takes something
   away keeps its meaning in its text colour, not in a coloured frame. */
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-info,
.btn-outline-warning,
.btn-outline-dark,
.btn-outline-light,
.btn-outline-danger,
.btn-default {
  --bs-btn-color: var(--foreground);
  --bs-btn-bg: var(--background);
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-color: var(--accent-foreground);
  --bs-btn-hover-bg: var(--accent);
  --bs-btn-hover-border-color: var(--border);
  --bs-btn-active-color: var(--accent-foreground);
  --bs-btn-active-bg: var(--accent);
  --bs-btn-active-border-color: var(--border);
  --bs-btn-disabled-color: var(--foreground);
  --bs-btn-disabled-bg: var(--background);
  --bs-btn-disabled-border-color: var(--border);
  box-shadow: var(--ra-shadow-xs);
}

html[data-bs-theme='dark'] :is(.btn-outline-primary, .btn-outline-secondary, .btn-outline-success, .btn-outline-info, .btn-outline-warning, .btn-outline-dark, .btn-outline-light, .btn-outline-danger, .btn-default) {
  --bs-btn-bg: color-mix(in oklab, var(--input) 30%, transparent);
  --bs-btn-border-color: var(--input);
  --bs-btn-hover-bg: color-mix(in oklab, var(--input) 50%, transparent);
  --bs-btn-hover-border-color: var(--input);
}

.btn-outline-danger {
  --bs-btn-color: var(--destructive);
  --bs-btn-hover-color: var(--destructive);
  --bs-btn-active-color: var(--destructive);
}

/* ghost and link */
.btn-link {
  --bs-btn-color: var(--primary);
  --bs-btn-hover-color: var(--primary);
  --bs-btn-active-color: var(--primary);
  --bs-btn-disabled-color: var(--muted-foreground);
  text-decoration: none;
  text-underline-offset: 4px;
}

.btn-link:hover {
  text-decoration: underline;
}

/* size sm: h-8 gap-1.5 px-3; lg: h-10 px-6 */
.btn-sm,
.btn-group-sm > .btn {
  --bs-btn-padding-x: 0.75rem;
  --bs-btn-padding-y: 0.375rem;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-border-radius: var(--ra-radius-md);
  gap: 0.375rem;
  min-height: 2rem;
}

.btn-lg,
.btn-group-lg > .btn {
  --bs-btn-padding-x: 1.5rem;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-border-radius: var(--ra-radius-md);
  min-height: 2.5rem;
}

.btn-group > .btn {
  box-shadow: none;
}

/* Input, Select, Textarea — components/ui/input.tsx, textarea.tsx, select.tsx. */
.form-control,
.form-select {
  min-height: 2.25rem;
  border: 1px solid var(--input);
  border-radius: var(--ra-radius-md);
  padding: 0.25rem 0.75rem;
  background-color: transparent;
  color: var(--foreground);
  font-size: 0.875rem;
  line-height: 1.5rem;
  box-shadow: var(--ra-shadow-xs);
  transition: color 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.form-select {
  padding-inline-end: 2.25rem;
}

textarea.form-control {
  min-height: 4rem;
  padding-block: 0.5rem;
}

.form-control-sm,
.form-select-sm {
  min-height: 2rem;
  padding-block: 0.125rem;
  font-size: 0.875rem;
}

html[data-bs-theme='dark'] :is(.form-control, .form-select) {
  background-color: color-mix(in oklab, var(--input) 30%, transparent);
}

.form-select option {
  background-color: var(--popover);
  color: var(--popover-foreground);
}

.form-control::placeholder {
  color: var(--muted-foreground);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ring);
  background-color: transparent;
  color: var(--foreground);
  box-shadow: var(--ra-ring);
  outline: none;
}

html[data-bs-theme='dark'] :is(.form-control, .form-select):focus {
  background-color: color-mix(in oklab, var(--input) 30%, transparent);
}

.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
  background-color: transparent;
  opacity: 0.5;
}

.form-control.is-invalid,
.form-select.is-invalid,
.input-validation-error {
  border-color: var(--destructive) !important;
}

.form-control.is-invalid:focus,
.input-validation-error:focus {
  box-shadow: var(--ra-ring-destructive);
}

.field-validation-error,
.validation-summary-errors,
.invalid-feedback {
  color: var(--destructive);
  font-size: 0.875rem;
}

/* Label — text-sm leading-none font-medium, FormItem gap-2. */
.form-label,
.ta-content legend.form-label {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
}

/* Checkbox — size-4 rounded-[4px] border-input shadow-xs, checked bg-primary. */
.form-check-input {
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--input);
  background-color: transparent;
  box-shadow: var(--ra-shadow-xs);
}

.form-check-input[type='checkbox'] {
  border-radius: 4px;
}

html[data-bs-theme='dark'] .form-check-input {
  background-color: color-mix(in oklab, var(--input) 30%, transparent);
}

.form-check-input:checked {
  border-color: var(--primary);
  background-color: var(--primary);
}

html[data-bs-theme='dark'] .form-check-input:checked[type='checkbox'] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%231e293b' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

html[data-bs-theme='dark'] .form-check-input:checked[type='radio'] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%231e293b'/%3e%3c/svg%3e");
}

.form-check-input:focus {
  border-color: var(--ring);
  box-shadow: var(--ra-ring);
}

/* Switch — h-[1.15rem] w-8 rounded-full, unchecked bg-input. */
.form-switch .form-check-input {
  width: 2rem;
  height: 1.15rem;
  border-color: transparent;
  border-radius: 9999px;
  background-color: var(--input);
}

.form-switch .form-check-input:checked {
  background-color: var(--primary);
}

/* Card — components/ui/card.tsx: rounded-xl border bg-card py-6 shadow-sm. */
.card {
  --bs-card-bg: var(--card);
  --bs-card-color: var(--card-foreground);
  --bs-card-border-color: var(--border);
  --bs-card-border-radius: var(--ra-radius-xl);
  --bs-card-inner-border-radius: calc(var(--ra-radius-xl) - 1px);
  --bs-card-cap-bg: transparent;
  --bs-card-spacer-x: 1.5rem;
  --bs-card-spacer-y: 1.5rem;
  --bs-card-cap-padding-x: 1.5rem;
  --bs-card-cap-padding-y: 1rem;
  box-shadow: var(--ra-shadow-sm);
}

.card-title {
  font-weight: 600;
  line-height: 1;
}

/* List group — the platform's table surface (data-table/layout.ts): rounded-md border bg-card, rows
   divided by the border, hover:bg-muted/50. */
.list-group {
  --bs-list-group-color: var(--card-foreground);
  --bs-list-group-bg: var(--card);
  --bs-list-group-border-color: var(--border);
  --bs-list-group-border-radius: var(--ra-radius-md);
  --bs-list-group-item-padding-x: 1rem;
  --bs-list-group-item-padding-y: 0.75rem;
  --bs-list-group-action-color: var(--foreground);
  --bs-list-group-action-hover-color: var(--foreground);
  --bs-list-group-action-hover-bg: color-mix(in oklab, var(--muted) 50%, transparent);
  --bs-list-group-action-active-color: var(--foreground);
  --bs-list-group-action-active-bg: var(--muted);
  --bs-list-group-active-color: var(--accent-foreground);
  --bs-list-group-active-bg: var(--accent);
  --bs-list-group-active-border-color: var(--border);
  --bs-list-group-disabled-color: var(--muted-foreground);
}

.list-group-item {
  transition: background-color 0.15s;
}

.list-group:not(.list-group-flush) > .list-group-item:hover {
  background-color: color-mix(in oklab, var(--muted) 50%, var(--card));
}

.list-group-flush > .list-group-item {
  background-color: transparent;
}

.list-group-item > .fw-bold,
.list-group-item .fw-bold {
  font-weight: 500 !important;
}

/* Table — components/ui/table.tsx inside the table surface. */
.table {
  --bs-table-color: var(--foreground);
  --bs-table-bg: var(--card);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: color-mix(in oklab, var(--muted) 50%, transparent);
  --bs-table-striped-color: var(--foreground);
  --bs-table-hover-bg: var(--muted);
  --bs-table-hover-color: var(--foreground);
  --bs-table-active-bg: var(--muted);
  --bs-table-active-color: var(--foreground);
  font-size: 0.875rem;
}

.table > thead th,
.table > :not(caption) > * > th {
  height: 2.5rem;
  font-weight: 500;
  white-space: nowrap;
}

.table > :not(caption) > * > * {
  padding: 0.5rem;
  vertical-align: middle;
}

/* Badge — components/ui/badge.tsx: rounded-md border px-2 py-0.5 text-xs font-medium. Bootstrap's colour
   classes land on the tone the platform's StatusBadge gives the same meaning (components/status-badge.tsx):
   success → active (default), danger → error (destructive), warning and info → pending (secondary),
   secondary and light → inactive (outline). */
.badge,
.ra-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: fit-content;
  border: 1px solid transparent;
  border-radius: var(--ra-radius-md);
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: middle;
}

.badge.text-wrap,
.ra-badge.text-wrap {
  white-space: normal;
}

.badge.text-bg-primary,
.badge.text-bg-success,
.badge.text-bg-dark,
.badge.bg-primary,
.badge.bg-success,
.ra-badge--default,
.ra-badge--active {
  border-color: transparent;
  background-color: var(--primary) !important;
  color: var(--primary-foreground) !important;
}

.badge.text-bg-danger,
.badge.bg-danger,
.ra-badge--destructive,
.ra-badge--error {
  border-color: transparent;
  background-color: var(--destructive) !important;
  color: #fff !important;
}

html[data-bs-theme='dark'] :is(.badge.text-bg-danger, .badge.bg-danger, .ra-badge--destructive, .ra-badge--error) {
  background-color: color-mix(in oklab, var(--destructive) 60%, transparent) !important;
}

.badge.text-bg-warning,
.badge.text-bg-info,
.badge.bg-warning,
.badge.bg-info,
.ra-badge--secondary,
.ra-badge--pending {
  border-color: transparent;
  background-color: var(--secondary) !important;
  color: var(--secondary-foreground) !important;
}

.badge.text-bg-secondary,
.badge.text-bg-light,
.badge.bg-secondary,
.badge.bg-light,
.ra-badge--outline,
.ra-badge--inactive {
  border-color: var(--border);
  background-color: transparent !important;
  color: var(--foreground) !important;
}

/* Alert — components/ui/alert.tsx: rounded-lg border px-4 py-3 text-sm bg-card; destructive keeps the card
   and takes the colour. The platform has no warning or success alert: they are the default one. */
.alert {
  --bs-alert-bg: var(--card);
  --bs-alert-color: var(--card-foreground);
  --bs-alert-border-color: var(--border);
  --bs-alert-border-radius: var(--ra-radius-lg);
  --bs-alert-padding-x: 1rem;
  --bs-alert-padding-y: 0.75rem;
  --bs-alert-link-color: inherit;
  font-size: 0.875rem;
}

.alert-danger {
  --bs-alert-color: var(--destructive);
}

/* Dropdown — the platform's DropdownMenuContent: rounded-md border bg-popover p-1 shadow-md, items
   rounded-sm px-2 py-1.5 text-sm, focus:bg-accent. */
.dropdown-menu {
  --bs-dropdown-bg: var(--popover);
  --bs-dropdown-color: var(--popover-foreground);
  --bs-dropdown-border-color: var(--border);
  --bs-dropdown-border-radius: var(--ra-radius-md);
  --bs-dropdown-inner-border-radius: var(--ra-radius-md);
  --bs-dropdown-box-shadow: var(--ra-shadow-md);
  --bs-dropdown-padding-x: 0.25rem;
  --bs-dropdown-padding-y: 0.25rem;
  --bs-dropdown-item-padding-x: 0.5rem;
  --bs-dropdown-item-padding-y: 0.375rem;
  --bs-dropdown-item-border-radius: var(--ra-radius-sm);
  --bs-dropdown-link-color: var(--popover-foreground);
  --bs-dropdown-link-hover-color: var(--accent-foreground);
  --bs-dropdown-link-hover-bg: var(--accent);
  --bs-dropdown-link-active-color: var(--accent-foreground);
  --bs-dropdown-link-active-bg: var(--accent);
  --bs-dropdown-divider-bg: var(--border);
  --bs-dropdown-divider-margin-y: 0.25rem;
  --bs-dropdown-header-color: var(--muted-foreground);
  --bs-dropdown-font-size: 0.875rem;
  min-width: 8rem;
  box-shadow: var(--ra-shadow-md);
}

.dropdown-item {
  border-radius: var(--ra-radius-sm);
}

/* Dialog — components/ui/dialog.tsx and alert-dialog: overlay bg-black/50, content rounded-lg border
   bg-background p-6 shadow-lg gap-4, footer flex-end gap-2. */
.modal {
  --bs-modal-bg: var(--background);
  --bs-modal-color: var(--foreground);
  --bs-modal-border-color: var(--border);
  --bs-modal-border-radius: var(--ra-radius-lg);
  --bs-modal-inner-border-radius: var(--ra-radius-lg);
  --bs-modal-box-shadow: var(--ra-shadow-lg);
  --bs-modal-padding: 0 1.5rem;
  --bs-modal-header-padding: 1.5rem 1.5rem 0.5rem;
  --bs-modal-header-border-width: 0;
  --bs-modal-footer-border-width: 0;
  --bs-modal-footer-gap: 0.5rem;
  --bs-modal-width: 32rem;
}

.modal-content {
  box-shadow: var(--ra-shadow-lg);
}

.modal-title {
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
}

.modal-body {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.modal-footer {
  padding: 1rem 1.5rem 1.5rem;
}

.modal-backdrop {
  --bs-backdrop-bg: #000;
  --bs-backdrop-opacity: 0.5;
}

/* Tabs — components/ui/tabs.tsx: a muted rounded-lg strip, the active tab bg-background shadow-sm. */
.nav-tabs {
  --bs-nav-tabs-border-width: 0;
  --bs-nav-tabs-border-radius: var(--ra-radius-md);
  --bs-nav-link-color: var(--foreground);
  --bs-nav-link-hover-color: var(--foreground);
  --bs-nav-link-font-size: 0.875rem;
  --bs-nav-link-font-weight: 500;
  --bs-nav-link-padding-x: 0.75rem;
  --bs-nav-link-padding-y: 0.25rem;
  --bs-nav-tabs-link-active-color: var(--foreground);
  --bs-nav-tabs-link-active-bg: var(--background);
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 1rem;
  border-radius: var(--ra-radius-lg);
  padding: 3px;
  background-color: var(--muted);
}

.nav-tabs .nav-link {
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--ra-radius-md);
}

.nav-tabs .nav-link.active {
  box-shadow: var(--ra-shadow-sm);
}

html[data-bs-theme='dark'] .nav-tabs {
  --bs-nav-link-color: var(--muted-foreground);
}

html[data-bs-theme='dark'] .nav-tabs .nav-link.active {
  border-color: var(--input);
  background-color: color-mix(in oklab, var(--input) 30%, transparent);
  color: var(--foreground);
}

/* Pagination — data-table/pagination.tsx: outline buttons, size-8. */
.pagination {
  --bs-pagination-color: var(--foreground);
  --bs-pagination-bg: var(--background);
  --bs-pagination-border-color: var(--border);
  --bs-pagination-border-radius: var(--ra-radius-md);
  --bs-pagination-hover-color: var(--accent-foreground);
  --bs-pagination-hover-bg: var(--accent);
  --bs-pagination-hover-border-color: var(--border);
  --bs-pagination-focus-color: var(--foreground);
  --bs-pagination-focus-bg: var(--accent);
  --bs-pagination-focus-box-shadow: var(--ra-ring);
  --bs-pagination-active-color: var(--primary-foreground);
  --bs-pagination-active-bg: var(--primary);
  --bs-pagination-active-border-color: var(--primary);
  --bs-pagination-disabled-color: var(--muted-foreground);
  --bs-pagination-disabled-bg: var(--background);
  --bs-pagination-disabled-border-color: var(--border);
  --bs-pagination-font-size: 0.875rem;
  gap: 0.5rem;
}

.pagination .page-link {
  min-width: 2rem;
  border-radius: var(--ra-radius-md) !important;
  text-align: center;
  box-shadow: var(--ra-shadow-xs);
}

/* Breadcrumbs and the details summary used for a secondary action. */
.breadcrumb {
  --bs-breadcrumb-item-active-color: var(--foreground);
  --bs-breadcrumb-divider-color: var(--muted-foreground);
  font-size: 0.875rem;
}

.ta-content details > summary {
  width: fit-content;
  color: var(--muted-foreground);
  cursor: pointer;
}

.ta-content details > summary:hover {
  color: var(--foreground);
}

/* Orchard's notifications (TheAdmin's Message: a Bootstrap toast coloured by its type) as the platform's
   toasts — sonner with --normal-bg popover, --normal-text popover-foreground, --normal-border border. An
   error keeps its meaning in the colour of its text. */
.oc-notify-toast-container .toast {
  --bs-toast-max-width: 22rem;
  --bs-toast-font-size: 0.8125rem;
  --bs-toast-border-radius: var(--ra-radius-lg);
  border: 1px solid var(--border) !important;
  background-color: var(--popover) !important;
  color: var(--popover-foreground) !important;
  box-shadow: var(--ra-shadow-lg) !important;
}

.oc-notify-toast-container .toast.text-bg-danger {
  color: var(--destructive) !important;
}

.oc-notify-toast-container .toast .toast-body {
  padding: 1rem;
  font-weight: 500;
}

.oc-notify-toast-container .toast .btn-close-white {
  filter: none;
}

html[data-bs-theme='dark'] .oc-notify-toast-container .toast .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* The sign-in page: AuthLayout — centred, sm:w-[480px], the platform's mark above, each block a Card with
   its title (CardTitle text-lg tracking-tight) inside. TheAdmin's login layout puts every block in a column
   of .auth-wrapper > .row: the column is the card. */
.auth-wrapper {
  max-width: 30rem;
  margin: 0 auto;
  padding: 2rem 0;
}

.auth-wrapper::before {
  content: '';
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 1.5rem;
  background: url(images/favicon.svg) center / contain no-repeat;
}

html[data-bs-theme='dark'] .auth-wrapper::before {
  background-image: url(images/favicon_light.svg);
}

.auth-wrapper > .row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0;
}

.auth-wrapper > .row > [class*='col-'] {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--ra-radius-xl);
  padding: 1.5rem;
  background-color: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--ra-shadow-sm);
}

.auth-wrapper h1,
.auth-wrapper h2,
.auth-wrapper h3 {
  margin-bottom: 1rem;
  font-size: 1.125rem !important;
  line-height: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.auth-wrapper hr {
  display: none;
}

.auth-wrapper .btn-primary,
.auth-wrapper .btn-secondary:not(#togglePassword) {
  width: 100%;
}

.auth-wrapper .input-group > .btn {
  border: 1px solid var(--input);
  box-shadow: none;
}

html:has(.auth-wrapper),
html:has(.auth-wrapper) body {
  background-color: var(--background);
}

/* 6. ra-* — the platform's patterns for our own screens. ------------------------------------------------- */

/* Main: flex flex-1 flex-col gap-4 sm:gap-6; the header row flex-wrap items-end justify-between gap-2. */
.ra-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.5rem;
}

.ra-page-header > :first-child {
  min-width: 0;
}

.ra-page-header p {
  margin: 0;
  font-size: 1rem;
  color: var(--muted-foreground);
}

.ra-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.ra-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 640px) {
  .ra-stack {
    gap: 1.5rem;
  }
}

.ra-stack > * {
  margin-bottom: 0 !important;
}

/* Card with header and content, as in dashboard and settings. */
.ra-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--ra-radius-xl);
  padding: 1.5rem;
  background-color: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--ra-shadow-sm);
}

.ra-card > * {
  margin-block: 0;
}

.ra-card > * + .hint {
  margin-top: -1rem;
}

.ra-card > .ra-card-header {
  display: grid;
  gap: 0.375rem;
}

.ra-card > .ra-card-header > :is(h2, h3, .ra-card-title) {
  margin: 0;
  font-size: 1rem;
  line-height: 1;
  font-weight: 600;
  letter-spacing: normal;
}

.ra-card > .ra-card-header > p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.ra-card > :last-child,
.ra-card > .hint:last-child {
  margin-bottom: 0;
}

/* A form drawn as a card: the card's gap spaces its fields. */
.ra-card > .mb-2,
.ra-card > .mb-3,
.ra-card > .mb-4 {
  margin-bottom: 0 !important;
}

.ra-narrow {
  max-width: 42rem;
}

/* A form's fields: FormItem gap-2 inside a form space-y-4. */
form.ra-card {
  gap: 1rem;
}

.ra-card > .ra-empty {
  margin: 0;
}

.validation-summary-valid {
  display: none;
}

.ra-card > .list-group,
.ra-card > ul.list-group {
  margin-bottom: 0;
}

/* The dashboard's counters: rounded-md border p-3, label text-xs font-medium muted, value text-xl bold. */
.ra-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.ra-stat {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--ra-radius-md);
  padding: 0.75rem;
  background-color: var(--card);
  color: var(--card-foreground);
  text-decoration: none;
}

a.ra-stat:hover {
  background-color: color-mix(in oklab, var(--muted) 50%, var(--card));
  color: var(--card-foreground);
  text-decoration: none;
}

.ra-stat[aria-current='true'] {
  border-color: var(--ring);
  box-shadow: var(--ra-ring);
}

.ra-stat-label {
  display: block;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
}

.ra-stat-value {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* The toolbar above a table: a search field and what it found. */
.ra-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ra-search {
  position: relative;
  flex: 1 1 16rem;
  max-width: 24rem;
}

.ra-search > svg {
  position: absolute;
  inset-inline-start: 0.625rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
  transform: translateY(-50%);
  pointer-events: none;
}

.ra-search > .form-control {
  padding-inline-start: 2rem;
}

.ra-toolbar-note {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* Empty state: the table shell's row h-24 text-center text-muted-foreground, inside the table surface. */
.ra-empty {
  display: grid;
  place-items: center;
  min-height: 6rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--ra-radius-md);
  padding: 1rem;
  background-color: var(--card);
  color: var(--muted-foreground);
  text-align: center;
}

.ra-empty > * {
  margin: 0;
}

/* A row's title and its secondary line, as name-cell.tsx draws them. */
.ra-row-title {
  font-weight: 500;
}

.ra-row-meta {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  line-height: 1rem;
}

.ra-row-attention {
  color: var(--destructive);
  font-size: 0.75rem;
  line-height: 1rem;
}

/* Inline lucide icons: size-4, the colour of the text. */
.ra-icon {
  display: inline-block;
  flex: none;
  width: 1rem;
  height: 1rem;
  vertical-align: -0.125em;
}

/* A definition list of facts inside a card. */
.ra-facts {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
  font-size: 0.875rem;
}

.ra-facts dt {
  color: var(--muted-foreground);
  font-weight: 400;
}

.ra-facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .form-control,
  .form-select,
  .list-group-item {
    transition: none;
  }
}

/* 7. The package's rules for new screens (docs/admin-ui.md) ------------------------------------------------- */

/* One filled button in a group: Orchard's list rows carry a blue and a green one side by side. */
.list-group-item .btn-sm:is(.btn-primary, .btn-success, .btn-info, .btn-warning),
.btn-sm.btn-success,
.btn-warning {
  --bs-btn-color: var(--foreground);
  --bs-btn-bg: var(--background);
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-color: var(--accent-foreground);
  --bs-btn-hover-bg: var(--accent);
  --bs-btn-hover-border-color: var(--border);
  --bs-btn-active-color: var(--accent-foreground);
  --bs-btn-active-bg: var(--accent);
  --bs-btn-active-border-color: var(--border);
  --bs-btn-disabled-color: var(--muted-foreground);
  --bs-btn-disabled-bg: var(--background);
  --bs-btn-disabled-border-color: var(--border);
}

.btn-outline-secondary:disabled,
.btn-outline-danger:disabled {
  border-color: var(--border);
}

/* A card's button keeps its own width: the card is a column, and a column would stretch it. */
.ra-card > .btn,
.ra-card > .ra-actions {
  align-self: flex-start;
}

.ra-card > form > .btn {
  align-self: flex-start;
}

/* Headings: one scale. A screen's sections are h2, what is inside them h3 and h4. */
.ta-content h2 {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
}

.ta-content h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
}

.ta-content h4 {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
}

.ta-content .ra-stack > h2 {
  margin-top: 0.5rem;
}

/* The title of a group of rows: a month, a category. */
.ta-content .ra-group-title {
  margin: 1.5rem 0 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
}

/* A form inside a card or alone: one column of a readable width, its last row the actions. */
.ra-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 42rem;
}

.ra-form > * {
  margin: 0;
}

.ra-form > label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
}

.ra-form > label > :is(.form-control, .form-select) {
  margin-top: 0.5rem;
  font-weight: 400;
}

.ra-form fieldset {
  display: grid;
  gap: 0.5rem;
}

.ra-form fieldset > .form-check {
  margin: 0;
}

/* A part of a card set apart from what is above it. */
.ra-divided {
  display: grid;
  gap: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.ra-divided > * {
  margin: 0;
}

/* Orchard's facts on a row (type, state, date): TheAdmin paints them for its dark bar, unreadable on a light one. */
.badge.ta-badge {
  border-color: var(--border);
  background-color: transparent !important;
  color: var(--muted-foreground) !important;
}

.badge.ta-badge a {
  color: inherit;
}

/* On a phone the open menu lies over the page; its edge says so. */
@media (max-width: 767.98px) {
  body:not(.left-sidebar-compact) #ta-left-sidebar {
    border-inline-end: 1px solid var(--sidebar-border);
    box-shadow: var(--ra-shadow-lg);
  }

  /* Orchard's filter rows and search: they wrap inside the screen instead of widening the page. */
  .ta-content .btn-group:has(> .bootstrap-select),
  .ta-content .btn-group:has(> .dropdown) {
    flex-wrap: wrap;
    max-width: 100%;
  }

  .ta-content .input-group {
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
  }

  .ta-content .input-group > .form-control {
    min-width: 0;
  }

  .ra-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.125rem;
  }

  .ra-facts dd {
    margin-bottom: 0.5rem;
  }
}
