/*
 * EV Souk Admin — the one stylesheet.
 *
 * Replaces css/tokens.css + css/app.css (stage 1 of the admin redesign).
 * Layered on purpose:
 *
 *   1. @font-face          self-hosted, Latin only (this tool is English)
 *   2. brand constants     --brand-*, the EV Souk palette, never themed
 *   3. semantic tokens     --c-*, --space-*, --radius-*, --text-* — these
 *                          are what components use, and these are what
 *                          flip between light and dark
 *   4. base + shell + components
 *   5. legacy aliases      --color-* from the old tokens.css, kept so the
 *                          handful of inline `var(--space-md)` style
 *                          attributes in js/ keep working
 *
 * Theme: light by default, dark via prefers-color-scheme, and either one
 * forced by data-theme="light" | "dark" on <html> (js/theme.js). Every
 * text/background pair below is >= 4.5:1 in both themes; UI boundaries are
 * >= 3:1.
 *
 * --brand-volt is graphics-only in BOTH themes, exactly as in the app
 * (2.07:1 against paper) — chart strokes and dots, never text, never a
 * background behind text. Dark mode therefore needs its own lighter green
 * for links and figures (--c-accent below): the brand green #12795C is
 * 1.6:1 on a dark ground and cannot carry text there.
 *
 * Logical properties throughout (inline-start/end, not left/right). The
 * admin tool is English-only and has no RTL requirement, but the app it
 * administers is bilingual and the habit is cheaper to keep than to learn
 * twice.
 */

/* ------------------------------------------------------------------ fonts */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/BricolageGrotesque-Variable.ttf") format("truetype-variations");
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/IBMPlexSans-Variable.ttf") format("truetype-variations");
  font-weight: 100 700;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/IBMPlexMono-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

/* --------------------------------------------------- tokens: brand + light */

:root {
  /* Brand constants — ported 1:1 from lib/core/theme/color_tokens.dart.
     Never redefined per theme; the semantic layer below picks from them. */
  --brand-paper: #fbfcfa;
  --brand-surface: #ffffff;
  --brand-surface-2: #edf3ec;
  --brand-mint: #e3f0e7;
  --brand-pine: #0c2c22;
  --brand-muted: #4a5b52;
  --brand-green: #12795c;
  --brand-green-deep: #0b5442;
  --brand-volt: #34c98a; /* graphics only — never text, never behind text */

  /* Type */
  --font-display: "Bricolage Grotesque", "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --text-xs: 11px;
  --text-sm: 12px;
  --text-md: 13px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 26px;
  --text-3xl: 32px;

  --lh-tight: 1.15;
  --lh-body: 1.5;
  --tracking-display: -0.02em;
  --tracking-caps: 0.04em;

  /* Space */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Shell geometry. The drawer breakpoint is 900px; a media query can't
     read a custom property, so that number is repeated literally in the
     @media rules below — change both together. */
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --z-topbar: 30;
  --z-scrim: 35;
  --z-sidebar: 40;
  --z-toast: 60;

  /* Semantic colour — light */
  color-scheme: light;

  --c-bg: var(--brand-paper);
  --c-bg-elev: var(--brand-surface);
  --c-bg-sunken: var(--brand-surface-2);
  --c-bg-accent: var(--brand-mint);
  --c-bg-hover: var(--brand-mint);

  --c-border: #dfe8df;
  --c-border-strong: #c3d4c6;

  --c-text: var(--brand-pine);
  --c-text-muted: var(--brand-muted);
  --c-text-inverse: #ffffff;

  --c-accent: var(--brand-green);
  --c-accent-hover: var(--brand-green-deep);
  --c-accent-figure: var(--brand-green-deep);
  --c-on-accent: #ffffff;
  --c-graphic: var(--brand-volt);

  --c-ok-bg: var(--brand-mint);
  --c-ok-text: var(--brand-green-deep);

  --c-warn-bg: #fdf3e2;
  --c-warn-text: #8a5a00;
  --c-warn-border: #e8cf9c;

  --c-danger: #b3261e;
  --c-danger-bg: #fbeceb;
  --c-danger-text: #b3261e;

  --c-focus: var(--brand-green-deep);
  --c-shadow: 12 44 34;
  --c-scrim: rgb(12 44 34 / 45%);
  --c-skeleton: #e7eee7;
  --c-scroll-shadow: rgb(12 44 34 / 16%);
}

/* ------------------------------------------------------ tokens: dark theme */

/*
 * Two blocks, deliberately duplicated: the media query handles "system
 * dark" (guarded so an explicit light choice still wins), the attribute
 * block handles "the admin pressed the toggle". Every colour has its
 * definition on bare :root above — nothing is defined only in here.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --c-bg: #07120e;
    --c-bg-elev: #0f2a21;
    --c-bg-sunken: #17382c;
    --c-bg-accent: #113a2c;
    --c-bg-hover: #1c4435;

    --c-border: #1f4536;
    --c-border-strong: #2e5c4a;

    --c-text: #e8f1eb;
    --c-text-muted: #9fb3a8;
    --c-text-inverse: var(--brand-pine);

    --c-accent: #3fbf93;
    --c-accent-hover: #6fd6b2;
    --c-accent-figure: #6fd6b2;
    --c-on-accent: #ffffff;

    --c-ok-bg: #113a2c;
    --c-ok-text: #6fd6b2;

    --c-warn-bg: #3a2a08;
    --c-warn-text: #f2c879;
    --c-warn-border: #5c4414;

    --c-danger: #ffb4ab;
    --c-danger-bg: #3b1512;
    --c-danger-text: #ffb4ab;

    --c-focus: #6fd6b2;
    --c-shadow: 0 0 0;
    --c-scrim: rgb(0 0 0 / 60%);
    --c-skeleton: #17382c;
    /* Black is invisible on a dark ground — the scroll hint has to be a
       highlight there, not a shadow. */
    --c-scroll-shadow: rgb(143 232 196 / 22%);

    /* Still volt's family, still graphics-only — just a lighter tint, so
       the trend chart's two series don't collapse into one colour now that
       --c-accent has itself been lightened for dark. */
    --c-graphic: #8fe8c4;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --c-bg: #07120e;
  --c-bg-elev: #0f2a21;
  --c-bg-sunken: #17382c;
  --c-bg-accent: #113a2c;
  --c-bg-hover: #1c4435;

  --c-border: #1f4536;
  --c-border-strong: #2e5c4a;

  --c-text: #e8f1eb;
  --c-text-muted: #9fb3a8;
  --c-text-inverse: var(--brand-pine);

  --c-accent: #3fbf93;
  --c-accent-hover: #6fd6b2;
  --c-accent-figure: #6fd6b2;
  --c-on-accent: #ffffff;

  --c-ok-bg: #113a2c;
  --c-ok-text: #6fd6b2;

  --c-warn-bg: #3a2a08;
  --c-warn-text: #f2c879;
  --c-warn-border: #5c4414;

  --c-danger: #ffb4ab;
  --c-danger-bg: #3b1512;
  --c-danger-text: #ffb4ab;

  --c-focus: #6fd6b2;
  --c-shadow: 0 0 0;
  --c-scrim: rgb(0 0 0 / 60%);
  --c-skeleton: #17382c;
  --c-graphic: #8fe8c4;
  --c-scroll-shadow: rgb(143 232 196 / 22%);
}

/* A filled green surface with white text is the one place the unlightened
   brand green still reads on dark (white on #12795C is 5.4:1, and the fill
   itself is 3.6:1 against the dark ground). */
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .dash-item__count--pending,
:root[data-theme="dark"] .nav-item__count--alert {
  --c-accent: var(--brand-green);
  --c-accent-hover: #158c6a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary,
  :root:not([data-theme="light"]) .dash-item__count--pending,
  :root:not([data-theme="light"]) .nav-item__count--alert {
    --c-accent: var(--brand-green);
    --c-accent-hover: #158c6a;
  }
}

/* --------------------------------------------------------- legacy aliases */

/*
 * The old css/tokens.css names. A few inline `style="…var(--space-md)…"`
 * attributes in js/ still reference the space/radius ones, and one row
 * outline in js/dealers.js reads `var(--green, #12795C)`. Aliasing instead
 * of renaming keeps those themed rather than frozen at their light values.
 */
:root {
  --color-paper: var(--c-bg);
  --color-surface: var(--c-bg-elev);
  --color-surface-2: var(--c-bg-sunken);
  --color-mint: var(--c-bg-accent);
  --color-pine: var(--c-text);
  --color-muted: var(--c-text-muted);
  --color-green: var(--c-accent);
  --color-green-deep: var(--c-accent-figure);
  --color-volt: var(--c-graphic);
  --color-error: var(--c-danger);
  --green: var(--c-accent);
}

/* ------------------------------------------------------------------- base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  /* Belt and braces: no page-level sideways scroll, ever. Wide content
     (tables, the trend chart) gets its own scroll container instead. */
  overflow-x: hidden;
}

/*
 * The pages toggle visibility with the `hidden` property (`el.hidden =
 * …`), but any author rule that sets `display` beats the UA sheet's
 * `[hidden] { display: none }` — which is why "Load more" showed on an
 * empty users/dealers list: `.load-more-wrap` sets `display: flex`. One
 * rule, and `hidden` means hidden everywhere.
 */
[hidden] {
  display: none !important;
}

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  line-height: var(--lh-tight);
  margin: 0 0 var(--space-md);
  color: var(--c-text);
}

h1 {
  font-size: var(--text-2xl);
}
h2 {
  font-size: var(--text-xl);
}
h3 {
  font-size: var(--text-lg);
}
h4 {
  font-size: var(--text-base);
}

p {
  margin: 0 0 var(--space-md);
}

a {
  color: var(--c-accent);
}

a:hover {
  color: var(--c-accent-hover);
}

img,
svg,
video {
  max-width: 100%;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--c-text-muted);
}

.mb-lg {
  margin-block-end: var(--space-lg);
}

/* -------------------------------------------------- focus, skip link, a11y */

:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  inset-block-start: var(--space-sm);
  inset-inline-start: var(--space-sm);
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: var(--c-bg-elev);
  color: var(--c-text);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-300%);
}

.skip-link:focus {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------------------------------------------ shell */

.topbar {
  display: none;
  position: sticky;
  inset-block-start: 0;
  z-index: var(--z-topbar);
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--topbar-h);
  padding: var(--space-sm) var(--space-md);
  background: var(--c-bg-elev);
  border-block-end: 1px solid var(--c-border);
}

.topbar__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-display);
  margin-inline-end: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  padding: var(--space-lg) var(--space-md);
  background: var(--c-bg-elev);
  border-inline-end: 1px solid var(--c-border);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-sm) var(--space-lg);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-display);
  color: var(--c-text);
  text-decoration: none;
}

.sidebar__mark {
  flex: none;
  color: var(--c-accent);
}

/* Scrolls on its own so the user/sign-out footer stays pinned to the
   bottom even on a short phone viewport, where the full nav doesn't fit. */
.sidebar__nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.nav-group + .nav-group {
  margin-block-start: var(--space-lg);
}

.nav-group__title {
  margin: 0 0 var(--space-xs);
  padding-inline: var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.nav-group__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 40px;
  padding: var(--space-xs) var(--space-sm);
  margin-block-end: 2px;
  border-radius: var(--radius-sm);
  color: var(--c-text-muted);
  font-size: var(--text-md);
  font-weight: 500;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--c-bg-hover);
  color: var(--c-text);
}

.nav-item[aria-current="page"] {
  background: var(--c-bg-accent);
  color: var(--c-text);
  font-weight: 600;
  box-shadow: inset 3px 0 0 0 var(--c-accent);
}

.nav-item[aria-disabled="true"],
.nav-item[aria-disabled="true"]:hover {
  background: none;
  color: var(--c-text-muted);
  opacity: 0.7;
  cursor: default;
}

.nav-item__icon {
  flex: none;
}

.nav-item__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item__count {
  flex: none;
  min-width: 22px;
  padding: 1px var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--c-bg-sunken);
  color: var(--c-text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
}

.nav-item__count--alert {
  background: var(--c-accent);
  color: var(--c-on-accent);
}

.nav-item__soon {
  flex: none;
  padding: 1px var(--space-xs);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}

.sidebar__footer {
  margin-block-start: var(--space-lg);
  padding-block-start: var(--space-md);
  border-block-start: 1px solid var(--c-border);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm) var(--space-sm);
}

.sidebar__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--c-bg-accent);
  color: var(--c-accent-figure);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar__email {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__actions {
  display: flex;
  gap: var(--space-xs);
}

.sidebar__actions .btn {
  flex: 1;
  min-height: 36px;
  padding-inline: var(--space-sm);
  font-size: var(--text-md);
}

.sidebar__actions .btn-icon {
  flex: none;
  width: 36px;
  min-width: 36px;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-scrim);
  background: var(--c-scrim);
  border: none;
}

.scrim[hidden] {
  display: none;
}

.shell-main {
  padding-inline-start: var(--sidebar-w);
  min-height: 100vh;
}

/* ---- under 900px: the sidebar becomes a drawer ---- */

@media (max-width: 899px) {
  .topbar {
    display: flex;
  }

  .shell-main {
    padding-inline-start: 0;
  }

  .sidebar {
    inset-inline-start: calc(-1 * var(--sidebar-w) - 4px);
    width: min(var(--sidebar-w), 86vw);
    transition: inset-inline-start 0.18s ease;
  }

  .sidebar.is-open {
    inset-inline-start: 0;
    box-shadow: 0 8px 32px rgb(var(--c-shadow) / 28%);
  }

  body.drawer-open {
    overflow: hidden;
  }
}

@media (min-width: 900px) {
  /* No drawer at this width, so no scrim either. */
  .scrim {
    display: none;
  }
}

/* ------------------------------------------------------------------- page */

/*
 * Data pages run to the full width of the window, capped at 1600px so a
 * line of body copy never gets unreadably long on an ultrawide, with fluid
 * side padding instead of fixed gutters. Before this, a 1100px column on a
 * 1900px screen left ~400px of empty space on each side while the ten-column
 * Listings table squeezed "AED 95,000" onto two lines inside it.
 *
 * Form-style pages (App settings, Moderation settings) keep the narrow
 * measure — a pair of number inputs stretched across 1600px is worse, not
 * better.
 */
.page {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 40px);
}

.page--narrow {
  max-width: 440px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  margin-block-end: var(--space-lg);
}

.page-head h1 {
  margin: 0;
}

.page-head__lede {
  flex-basis: 100%;
  margin: 0;
  max-width: 72ch;
  color: var(--c-text-muted);
  font-size: var(--text-md);
}

.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.4fr);
  gap: var(--space-xl);
  align-items: start;
}

@media (max-width: 800px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* `clamp()` already handles the narrow end of the page padding — nothing to
   override here any more. */

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.card + .card {
  margin-block-start: var(--space-lg);
}

.card--table {
  padding: 0;
  /* The scroll lives on the inner .table-scroll, so the card's own rounded
     corners and border stay put while the table slides under them. */
  overflow: hidden;
}

/*
 * The one horizontal scroll container in this tool.
 *
 * A wide table scrolls inside this; the page never does. It's focusable
 * (keyboard users need some way to pan it) but only when it actually
 * overflows — js/ui.js's enhanceTableScrollers() adds and removes the
 * tabindex/role on load and on resize, so a table that fits doesn't leave a
 * dead tab stop behind.
 *
 * The edge shadows are the classic local/scroll background pair: the two
 * `local` gradients travel with the content and cover the shadow when
 * you're at that end, the two `scroll` gradients stay pinned to the box.
 * No JS, no scroll listener.
 */
.table-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  background:
    linear-gradient(to right, var(--c-bg-elev) 30%, rgb(255 255 255 / 0%)) 0 0 / 28px 100% no-repeat
      local,
    linear-gradient(to left, var(--c-bg-elev) 30%, rgb(255 255 255 / 0%)) 100% 0 / 28px 100%
      no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--c-scroll-shadow), rgb(255 255 255 / 0%)) 0 0 /
      12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--c-scroll-shadow), rgb(255 255 255 / 0%)) 100% 0 /
      12px 100% no-repeat scroll;
  background-color: var(--c-bg-elev);
}

.table-scroll:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: -2px;
}

/* Shown only while the table is actually wider than its box. */
.table-scroll__hint {
  display: none;
  padding: var(--space-xs) var(--space-md) var(--space-sm);
  color: var(--c-text-muted);
  font-size: var(--text-sm);
}

.card--table.is-scrollable .table-scroll__hint {
  display: block;
}

.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-block-end: var(--space-md);
}

.card__title {
  margin: 0;
  font-size: var(--text-lg);
}

.card__hint {
  margin: 0;
  color: var(--c-text-muted);
  font-size: var(--text-md);
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-block-start: var(--space-lg);
}

/* ---------------------------------------------------------------- buttons */

.btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-base);
  min-height: 44px;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: none;
  color: var(--c-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--c-accent);
  color: var(--c-on-accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--c-accent-hover);
  color: var(--c-on-accent);
}

.btn-outline {
  background: transparent;
  border-color: var(--c-border-strong);
  color: var(--c-text);
}

.btn-outline:hover:not(:disabled) {
  background: var(--c-bg-sunken);
  color: var(--c-text);
}

.btn-ghost {
  background: transparent;
  color: var(--c-text-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--c-bg-hover);
  color: var(--c-text);
}

.btn-danger {
  background: transparent;
  border-color: var(--c-danger);
  color: var(--c-danger-text);
}

.btn-danger:hover:not(:disabled) {
  background: var(--c-danger);
  color: var(--c-text-inverse);
}

.btn-sm {
  min-height: 36px;
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-md);
}

.btn-icon {
  width: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  border-color: var(--c-border);
  color: var(--c-text-muted);
}

.btn-icon:hover:not(:disabled) {
  background: var(--c-bg-hover);
  color: var(--c-text);
}

.btn-link {
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--c-accent);
  font-family: var(--font-body);
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  border: 1px solid var(--c-border-strong);
  border-block-end-width: 2px;
  border-radius: 5px;
  background: var(--c-bg-sunken);
  color: var(--c-text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-align: center;
}

/* ----------------------------------------------------------------- badges */

.badge {
  display: inline-block;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}

.badge-pending {
  background: var(--c-bg-sunken);
  color: var(--c-text-muted);
}

.badge-approved,
.badge-verified,
.badge-active {
  background: var(--c-ok-bg);
  color: var(--c-ok-text);
}

.badge-rejected,
.badge-removed {
  background: var(--c-danger-bg);
  color: var(--c-danger-text);
}

/* D-023 — plausibilityFlags chips. An admin-review signal, never a
   rejection state, so visually distinct from .badge-rejected. */
.badge-warning {
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  margin-inline-end: var(--space-xs);
}

.badge-info {
  background: var(--c-bg-accent);
  color: var(--c-accent-figure);
}

.age-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--c-bg-sunken);
  color: var(--c-text-muted);
}

.age-chip--overdue {
  background: var(--c-danger-bg);
  color: var(--c-danger-text);
}

/* ------------------------------------------------------------------ forms */

label {
  display: block;
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--c-text-muted);
  margin-block-end: var(--space-xs);
}

input,
select,
textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--c-text);
  background: var(--c-bg);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
}

input,
select {
  min-height: 44px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: -1px;
}

.field {
  margin-block-end: var(--space-md);
}

.field-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-block-end: var(--space-md);
}

/* Capped, now that a data page is up to 1600px wide — a date picker or a
   quota input stretched across the whole window is just harder to aim at.
   `.field--grow` is the opt-out for the one field that should take the
   slack (the Users search box). */
.field-row > .field {
  flex: 0 1 auto;
  min-width: 200px;
  max-width: 320px;
  margin-block-end: 0;
}

.field--grow,
.field-row > .field--grow {
  flex: 1 1 auto;
  max-width: none;
}

.filter-field {
  max-width: 220px;
}

.review-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: flex-end;
  margin-block-end: var(--space-md);
}

.review-filters .field {
  margin-block-end: 0;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.checkbox-row label,
.checkbox-row-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-md);
  color: var(--c-text);
  font-weight: 400;
  margin-block-end: 0;
}

.checkbox-row input[type="checkbox"],
.checkbox-row-label input[type="checkbox"] {
  width: auto;
  min-height: 0;
  accent-color: var(--c-accent);
}

@media (max-width: 480px) {
  .filter-field {
    max-width: none;
  }
}

/* ----------------------------------------------------------------- tables */

table {
  width: 100%;
  border-collapse: collapse;
}

/*
 * Cells do NOT wrap by default.
 *
 * The old rule was `overflow-wrap: anywhere` on every cell, which is what
 * split "AED 95,000" into "AED 95,0 / 00" and spread a date down five
 * lines. A number, a date, a status chip and a uid are all atomic values —
 * breaking them isn't a graceful degradation, it's corruption of the thing
 * being read. They stay on one line and the table scrolls inside
 * .table-scroll instead.
 *
 * Only genuinely prose-ish columns opt back into wrapping, with
 * `.cell-text` below.
 */
th,
td {
  text-align: start;
  padding: var(--space-sm) var(--space-md);
  border-block-end: 1px solid var(--c-border);
  font-size: var(--text-md);
  white-space: nowrap;
}

/* Vehicle titles, business names, support messages — the columns where a
   second line is better than a wider table. The min-width stops a one-word
   value collapsing to a sliver; the max-width stops a long description
   taking the whole table. */
.cell-text {
  white-space: normal;
  overflow-wrap: anywhere;
  min-width: 14ch;
  max-width: 34ch;
}

/* A row's buttons, as one unbreakable group rather than one column each —
   four separate <td>s of actions were taking roughly a third of the
   Listings table's width. */
.row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-xs);
}

.row-actions .btn {
  flex: none;
}

th {
  color: var(--c-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  font-size: var(--text-xs);
  white-space: nowrap;
  background: var(--c-bg-elev);
}

tbody tr:last-child td {
  border-block-end: none;
}

tr.row-link {
  cursor: pointer;
}

tr.row-link:hover td {
  background: var(--c-bg-hover);
}

tr.row-link.is-selected td {
  background: var(--c-bg-accent);
}

tr.row-link.is-selected td:first-child {
  box-shadow: inset 3px 0 0 0 var(--c-accent);
}

tr.row-link:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: -2px;
}

/* ---- under 640px: every table becomes stacked cards ---- */

@media (max-width: 640px) {
  .btn-sm {
    min-height: 44px;
  }

  table thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  .card--table {
    background: transparent;
    border: none;
    overflow: visible;
  }

  /* Cards, not a grid — nothing to scroll sideways, and the edge shadows
     would just be two grey smudges down the side of every card. */
  .table-scroll {
    overflow-x: visible;
    background: none;
  }

  .card--table.is-scrollable .table-scroll__hint {
    display: none;
  }

  tbody tr:not(.row-message) {
    background: var(--c-bg-elev);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
  }

  tbody tr:not(.row-message) + tr:not(.row-message) {
    margin-block-start: var(--space-md);
  }

  tbody tr:not(.row-message) td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xs) 0;
    border-block-end: none;
    text-align: end;
    /* A stacked card is as wide as the phone, so a long value has to wrap
       here — there is no sideways scroll to escape into. */
    white-space: normal;
    max-width: none;
    min-width: 0;
  }

  /* One full-width button per line beats four squeezed onto one. */
  .row-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .row-actions .btn {
    flex: 1 1 100%;
  }

  tbody tr:not(.row-message) td[data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    color: var(--c-text-muted);
    text-align: start;
    flex-shrink: 0;
  }

  tbody tr:not(.row-message) td[data-label=""] {
    justify-content: stretch;
  }

  tbody tr:not(.row-message) td[data-label=""] .btn {
    width: 100%;
  }

  tr.row-link.is-selected {
    border-color: var(--c-accent);
    background: var(--c-bg-accent);
  }

  tr.row-link.is-selected td:first-child {
    box-shadow: none;
  }
}

/* -------------------------------------------------- states: empty/skeleton */

/* No `display` here on purpose: several pages put this class straight on a
   `<td colspan="n">`, and turning that into a block box drops it out of the
   table layout and squeezes it to the first column's width. */
.empty-state {
  color: var(--c-text-muted);
  text-align: center;
  padding: var(--space-xxl) var(--space-lg);
}

.empty-state__icon {
  color: var(--c-border-strong);
  margin-block-end: var(--space-sm);
}

.empty-state__title {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-display);
  color: var(--c-text);
}

.empty-state__body {
  margin: 0 auto;
  max-width: 46ch;
  font-size: var(--text-md);
}

.empty-state__actions {
  margin-block-start: var(--space-lg);
}

.loading {
  color: var(--c-text-muted);
  padding: var(--space-lg) 0;
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(
    100deg,
    var(--c-skeleton) 40%,
    var(--c-bg-elev) 55%,
    var(--c-skeleton) 70%
  );
  background-size: 200% 100%;
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}

.skeleton--text {
  height: 12px;
  margin-block-end: var(--space-sm);
}

.skeleton--title {
  height: 20px;
  width: 45%;
  margin-block-end: var(--space-md);
}

.skeleton--card {
  height: 92px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-lg);
}

.skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
}

@keyframes skeleton-sweep {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.error-banner {
  background: var(--c-danger-bg);
  color: var(--c-danger-text);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-block-end: var(--space-lg);
  font-size: var(--text-md);
}

.notice-banner {
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  border: 1px solid var(--c-warn-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-size: var(--text-md);
}

/* ----------------------------------------------------------------- toasts */

/*
 * The D-016 warning ("this admin account also has a marketplace user
 * profile"). It used to be a sticky element prepended to <body>, which
 * pushed the whole shell down by its own height — on a phone that's a
 * third of the first screen, for a message that is a standing warning
 * rather than anything actionable right now.
 *
 * Fixed to the bottom-start corner, so it overlays instead of displacing,
 * and sits clear of the toast region at bottom-end. Dismissal is
 * sessionStorage, so it comes back next time the tool is opened — the
 * condition it reports hasn't gone away just because it was read.
 */
.session-banner {
  position: fixed;
  inset-block-end: var(--space-lg);
  inset-inline-start: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  width: min(420px, calc(100vw - 2 * var(--space-lg)));
  padding: var(--space-md);
  border: 1px solid var(--c-warn-border);
  border-radius: var(--radius-md);
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  box-shadow: 0 6px 20px rgb(var(--c-shadow) / 16%);
  font-size: var(--text-md);
}

@media (max-width: 899px) {
  /* Below the drawer breakpoint the two would stack on top of each other. */
  .session-banner {
    inset-block-end: calc(var(--space-lg) + 64px);
  }
}

.session-banner__body {
  flex: 1;
  min-width: 0;
}

.session-banner__dismiss {
  flex: none;
  min-height: 0;
  padding: 0 var(--space-xs);
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: var(--text-lg);
  line-height: 1;
}

.toast-region {
  position: fixed;
  inset-block-end: var(--space-lg);
  inset-inline-end: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: min(360px, calc(100vw - 2 * var(--space-lg)));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-md);
  background: var(--c-bg-elev);
  color: var(--c-text);
  box-shadow: 0 6px 20px rgb(var(--c-shadow) / 16%);
  font-size: var(--text-md);
  pointer-events: auto;
  animation: toast-in 0.16s ease-out;
}

.toast__body {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast--ok {
  border-inline-start: 3px solid var(--c-accent);
}

.toast--error {
  border-inline-start: 3px solid var(--c-danger);
}

.toast--warn {
  border-inline-start: 3px solid var(--c-warn-text);
}

.toast__close {
  flex: none;
  min-height: 0;
  padding: 0 var(--space-xs);
  border: none;
  background: none;
  color: var(--c-text-muted);
  cursor: pointer;
  font-size: var(--text-lg);
  line-height: 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------------------------------------------------------------- dialogs */

dialog {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 440px;
  width: min(90vw, 440px);
  background: var(--c-bg-elev);
  color: var(--c-text);
}

dialog.dialog--wide {
  max-width: 640px;
  width: min(92vw, 640px);
}

dialog::backdrop {
  background: var(--c-scrim);
}

dialog h3 {
  margin-block-start: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-block-start: var(--space-lg);
}

/* ------------------------------------------------------------ detail lists */

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-xs) 0;
  border-block-end: 1px solid var(--c-border);
  font-size: var(--text-md);
}

.detail-row:last-child {
  border-block-end: none;
}

.detail-row dt {
  color: var(--c-text-muted);
  flex: none;
  max-width: 45%;
}

.detail-row dd {
  margin: 0;
  text-align: end;
  overflow-wrap: anywhere;
}

.detail-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-block-end: var(--space-md);
}

@media (max-width: 480px) {
  .detail-row {
    flex-direction: column;
    gap: 2px;
  }

  .detail-row dt {
    max-width: none;
  }

  .detail-row dd {
    text-align: start;
  }

  .actions {
    flex-direction: column;
  }

  .actions .btn {
    width: 100%;
  }
}

/* ------------------------------------------------------------- stat blocks */

.stat-card {
  display: block;
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-decoration: none;
  color: var(--c-text);
}

a.stat-card:hover {
  border-color: var(--c-border-strong);
  background: var(--c-bg-hover);
  color: var(--c-text);
}

.stat-card__value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--c-accent-figure);
}

.stat-card__label {
  color: var(--c-text-muted);
  font-size: var(--text-md);
  margin-block-start: var(--space-xs);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-lg);
}

/* ---------------------------------------------- dashboard: needs attention */

.dash-attention {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-block-end: var(--space-xl);
  box-shadow: 0 1px 3px rgb(var(--c-shadow) / 6%);
}

.dash-attention__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-block-end: var(--space-sm);
}

.dash-attention__head h2 {
  margin: 0;
}

.dash-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-item {
  border-block-end: 1px solid var(--c-border);
}

.dash-item:last-child {
  border-block-end: none;
}

.dash-item__link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  text-decoration: none;
}

.dash-item__link:hover {
  background: var(--c-bg-hover);
  color: var(--c-text);
}

.dash-item__count {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 48px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  background: var(--c-bg-sunken);
  color: var(--c-text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: var(--lh-tight);
}

.dash-item__count--pending {
  background: var(--c-accent);
  color: var(--c-on-accent);
}

.dash-item__count--unknown {
  background: var(--c-danger-bg);
  color: var(--c-danger-text);
}

.dash-item__text {
  flex: 1;
  min-width: 0;
}

.dash-item__label {
  font-weight: 600;
  font-size: var(--text-base);
}

.dash-item__status {
  color: var(--c-text-muted);
  font-size: var(--text-sm);
}

.dash-item__chevron {
  flex: none;
  color: var(--c-text-muted);
}

.dash-section {
  background: var(--c-bg-sunken);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-block-end: var(--space-xl);
}

.dash-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: start;
}

.dash-columns > * {
  min-width: 0;
}

@media (max-width: 800px) {
  .dash-columns {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------- dashboard: trend chart */

.trend-chart,
.activity-feed {
  background: var(--c-bg-elev);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  min-width: 0;
}

.trend-chart__header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-block-end: var(--space-md);
}

.trend-chart__stat {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-base);
  color: var(--c-text-muted);
}

.trend-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.trend-line--users {
  background: var(--c-accent);
}

.trend-line--listings {
  background: var(--c-graphic);
}

.trend-chart__scroll {
  overflow-x: auto;
  max-width: 100%;
}

.trend-chart__svg {
  display: block;
}

.trend-baseline {
  stroke: var(--c-border-strong);
  stroke-width: 1;
}

.trend-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

path.trend-line--users {
  stroke: var(--c-accent);
}

path.trend-line--listings {
  stroke: var(--c-graphic);
  stroke-dasharray: 5 4;
}

circle.trend-dot.trend-line--users {
  fill: var(--c-accent);
}

circle.trend-dot.trend-line--listings {
  fill: var(--c-graphic);
}

.trend-dot-hit {
  cursor: default;
}

.trend-axis-label {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--c-text-muted);
}

.trend-end-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  fill: var(--c-text);
  dominant-baseline: middle;
}

/* ------------------------------------------------ dashboard: activity feed */

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-row {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-block-end: 1px solid var(--c-border);
}

.activity-row:last-child {
  border-block-end: none;
}

.activity-row__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-block-start: 6px;
  flex-shrink: 0;
}

.activity-row__dot--positive {
  background: var(--c-accent);
}

.activity-row__dot--negative {
  background: var(--c-danger);
}

.activity-row__dot--neutral {
  background: var(--c-text-muted);
}

.activity-row__body {
  flex: 1;
  min-width: 0;
  font-size: var(--text-md);
  overflow-wrap: anywhere;
}

.activity-row__label {
  font-weight: 500;
  color: var(--c-text);
}

/* ---------------------------------------------- review queue: split layout */

/*
 * Desktop: list on the start side, detail on the end side, both live at
 * once. Under 900px it's one pane at a time — data-mode on .split says
 * which — so a phone gets the list, taps through to the detail, and comes
 * back via the detail's own Back button.
 */
.split {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
}

.split > * {
  min-width: 0;
}

.split__detail-empty {
  display: grid;
  place-items: center;
  min-height: 240px;
  background: var(--c-bg-elev);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--radius-lg);
}

@media (max-width: 1100px) {
  .split {
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  }
}

@media (max-width: 899px) {
  .split {
    grid-template-columns: 1fr;
  }

  .split[data-mode="list"] .split__detail,
  .split[data-mode="detail"] .split__list {
    display: none;
  }
}

/*
 * The queue pane is a list, not a data table.
 *
 * It started as the same six-column table the other pages use, but a
 * list/detail layout gives it ~320–420px to live in, and six columns in
 * that space broke "Individual" across lines and made every row six lines
 * tall on a phone. Two lines of real information per row — vehicle and
 * seller, then price and the waiting chip — reads at every width without a
 * breakpoint, and each row is a real <button>, so it's focusable, has
 * Enter/Space for free, and needs no tabindex.
 */
.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.queue-list__item + .queue-list__item {
  border-block-start: 1px solid var(--c-border);
}

.queue-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  width: 100%;
  padding: var(--space-md);
  border: none;
  background: none;
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  text-align: start;
  cursor: pointer;
}

.queue-row:hover {
  background: var(--c-bg-hover);
}

.queue-row[aria-current="true"] {
  background: var(--c-bg-accent);
  box-shadow: inset 3px 0 0 0 var(--c-accent);
}

.queue-row:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: -2px;
}

.queue-row__main {
  flex: 1;
  min-width: 0;
}

.queue-row__title {
  display: block;
  font-weight: 600;
  font-size: var(--text-base);
  overflow-wrap: anywhere;
}

.queue-row__meta {
  display: block;
  color: var(--c-text-muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.queue-row__side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-xs);
}

.queue-row__price {
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--c-accent-figure);
  white-space: nowrap;
}

.queue-row__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-xs);
}

.shortcut-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  color: var(--c-text-muted);
  font-size: var(--text-sm);
}

/* No physical keyboard down here, and the header has no room for it. The
   help dialog stays reachable from the button next to it. */
@media (max-width: 1023px) {
  .shortcut-hint {
    display: none;
  }
}

/* On desktop both panes are always on screen, so "back" means "clear the
   selection" — Esc does that, and the shortcut help says so. */
@media (min-width: 900px) {
  #detail-back {
    display: none;
  }
}

.shortcut-table th,
.shortcut-table td {
  border: none;
  padding: var(--space-xs) var(--space-md) var(--space-xs) 0;
  background: none;
}

.shortcut-table td:first-child {
  width: 1%;
  white-space: nowrap;
}

/* ------------------------------------------------- listing review: detail */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-sm);
  margin: var(--space-sm) 0 var(--space-lg);
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border);
  background: var(--c-bg-sunken);
}

.duplicate-hint {
  margin: var(--space-sm) 0;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--c-warn-border);
  border-radius: var(--radius-md);
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  font-size: var(--text-md);
}

/* --------------------------------------------------------- sign-in (index) */

.signin-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--space-lg);
}

.signin-card {
  width: 100%;
  max-width: 400px;
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.signin-card__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-block-end: var(--space-xs);
  color: var(--c-accent);
}

.signin-card .btn-primary {
  width: 100%;
}

.signin-card__foot {
  margin-block-start: var(--space-md);
  text-align: center;
}
