/* Weighflow kiosk component classes.
 *
 * The custom DaisyUI theme `weighflow` is registered by a
 * <style type="text/tailwindcss"> block in templates/base.html (it has
 * to live there for the Tailwind v4 browser variant to compile it).
 * This file holds only the project-specific component classes
 * (wf-section-header, wf-queue-card, etc.), all expressed as plain
 * CSS that references DaisyUI's CSS variables once the theme is active.
 */

/* --- section header --- */
.wf-section-header {
  background-color: var(--color-base-300);
  color: var(--color-base-content);
  padding: 0.5rem 1rem;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --- queue card --- */
.wf-queue-card {
  background-color: var(--color-base-100);
  border: 1px solid var(--color-base-300);
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

/* --- active visit highlight (scale queue) ---
   The visit this kiosk has claimed; rendered at the top of the queue. */
.wf-queue-card--active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 35%, transparent);
}

.wf-section-header--active {
  background-color: var(--color-primary);
  color: var(--color-primary-content);
}

/* --- complete & ready-to-print section (scale queue) --- */
.wf-section-header--complete {
  background-color: var(--color-success);
  color: #fff;
}

/* --- weight cell (Tare/Gross/Net) --- */
.wf-weight-cell {
  background-color: rgba(11, 55, 188, 0.06);
  border: 1px solid rgba(11, 55, 188, 0.18);
  border-radius: 0.5rem;
  padding: 0.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.wf-weight-cell-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(26, 31, 44, 0.7);
}

.wf-weight-cell-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--color-base-content);
}

/* --- numeric keypad --- */
.wf-keypad-btn {
  height: 5.5rem;
  font-size: 2rem;
  font-weight: 700;
  border-radius: 0.5rem;
  background-color: var(--color-success);
  color: var(--color-success-content);
  border: none;
  cursor: pointer;
  transition: filter 0.1s ease;
}

.wf-keypad-btn:active {
  filter: brightness(0.92);
}

.wf-keypad-btn-clear {
  background-color: var(--color-error);
  color: var(--color-error-content);
}

.wf-keypad-btn-backspace {
  background-color: var(--color-warning);
  color: var(--color-warning-content);
}

.wf-keypad-btn-action {
  background-color: var(--color-primary);
  color: var(--color-primary-content);
}

/* --- PIN / weight display --- */
.wf-pin-display {
  background-color: #0a0e1a;
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  font-size: 2.25rem;
  letter-spacing: 0.4em;
  padding: 1.25rem 1.5rem;
  border-radius: 0.5rem;
  border: 2px solid transparent;
  text-align: center;
  min-height: 1.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wf-pin-display::placeholder {
  color: rgba(255, 255, 255, 0.18);
  font-weight: 400;
}

.wf-pin-display:not(:placeholder-shown) {
  border-color: var(--color-success);
  box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.25);
}

/* --- status badges --- */
.wf-badge-status {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.wf-badge-weighing {
  background-color: var(--color-error);
  color: var(--color-error-content);
}

.wf-badge-outbound {
  background-color: var(--color-primary);
  color: var(--color-primary-content);
}

.wf-badge-inbound {
  background-color: var(--color-secondary);
  color: var(--color-secondary-content);
}

.wf-badge-waiting {
  background-color: var(--color-warning);
  color: var(--color-warning-content);
}

.wf-badge-checkedin {
  background-color: var(--color-error);
  color: var(--color-error-content);
}

.wf-badge-loading {
  background-color: var(--color-warning);
  color: var(--color-warning-content);
}

.wf-badge-loaded {
  background-color: var(--color-success);
  color: var(--color-success-content);
}

.wf-badge-complete {
  background-color: var(--color-success);
  color: var(--color-success-content);
}

.wf-badge-printed {
  background-color: var(--color-base-300);
  color: var(--color-base-content);
}

.wf-badge-voided {
  background-color: var(--color-base-content);
  color: var(--color-base-100);
}

/* --- order-entry keypad buttons --- */
/* Numeric keys — kiosk-scale for easy tapping. Height/font-size scale to
   viewport height so the search screen never overflows on iPad landscape
   while still using comfortable kiosk-sized hit targets on tall screens. */
.wf-keypad-btn-sm {
  height: clamp(2.75rem, 7.5vh, 5rem);
  font-size: clamp(1.125rem, 2.5vh, 1.75rem);
  font-weight: 700;
  border-radius: 0.5rem;
  background-color: var(--color-success);
  color: var(--color-success-content);
  border: none;
  cursor: pointer;
  transition: filter 0.1s ease;
}

.wf-keypad-btn-sm:active {
  filter: brightness(0.92);
}

/* The order keypad's Search and the operator PIN pad's Login: each screen's
   one action, set apart from the keys by colour alone — a darker green, a
   raised shadow and a soft green ring. Lettering is the keys' own (same size,
   weight and case), and so is the height, so the screens still fit. */
.wf-keypad-btn-search,
.wf-keypad-btn.wf-keypad-btn-enter {
  /* The keys' green, a shade darker, so it reads as the heavier button. */
  background-color: color-mix(in oklab, var(--color-success) 80%, black);
  color: var(--color-success-content);
  box-shadow:
    0 0 0 3px color-mix(in oklab, var(--color-success) 35%, transparent),
    0 6px 14px -4px color-mix(in oklab, var(--color-success) 70%, black);
}

/* Alpha keys — taller than the cramped default so the full-width keys keep a
   key-like proportion rather than stubby wide bars. */
.wf-keypad-btn-alpha {
  height: clamp(3rem, 9vh, 5.5rem);
  font-size: clamp(1.25rem, 3vh, 2rem);
  font-weight: 700;
  border-radius: 0.5rem;
  background-color: var(--color-success);
  color: var(--color-success-content);
  border: none;
  cursor: pointer;
  transition: filter 0.1s ease;
}

.wf-keypad-btn-alpha:active {
  filter: brightness(0.92);
}

/* Keyboard keys and [data-press] buttons: scale is animated by
   assets/keypress.js (Motion), so CSS only supplies the brightness dip and
   hosts the tap ripple. */
[data-keyboard] button,
#order-keypad button,
[data-press] .btn,
[data-press] .wf-keypad-btn {
  position: relative;
  overflow: hidden;
  transition: filter 0.1s ease;  /* no transform transition: Motion owns it */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.wf-key-ripple {
  position: absolute;
  border-radius: 9999px;
  background-color: currentColor;
  pointer-events: none;
  opacity: 0;
}

/* ABC / 123 mode-toggle button */
/* ABC / 123 toggle on the order keypad: plain black, apart from the green keys. */
.wf-keypad-btn-mode {
  background-color: #000;
  color: #fff;
}

/* Alpha keypad uses the full row width so QWERTY keys stay kiosk-sized. The
   order preview is only relevant after a numeric-mode Search, so it yields.
   Scoped to sm+ where the keypad column is fixed-width; on mobile the layout
   is already stacked full-width. */
@media (min-width: 640px) {
  #order-select-layout.kb-alpha #keypad-col {
    width: 100%;
    flex: 1 1 auto;   /* override sm:shrink-0 + the fixed sm:w-105/lg:w-115 */
  }
  #order-select-layout.kb-alpha #preview-col {
    display: none;
  }
}

/* --- touch-friendly secondary nav button (page-header action slot) ---
   Used as `class="btn btn-ghost btn-nav"` (or btn-outline btn-nav).
   Min 44px tap target on mobile, 48px on desktop. */
.btn-nav {
  height: 2.75rem;
  min-width: 4.5rem;
  padding-inline: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

@media (min-width: 640px) {
  .btn-nav {
    height: 3rem;
    padding-inline: 1.25rem;
    font-size: 1rem;
  }
}

/* Larger nav variant — ~20% bigger tap target for operator screens.
   Stack on .btn-nav: `class="btn btn-outline btn-nav btn-nav-lg"`. */
.btn-nav-lg {
  height: 3.3rem;
  min-width: 5.4rem;
  padding-inline: 1.2rem;
  font-size: 1.15rem;
}

@media (min-width: 640px) {
  .btn-nav-lg {
    height: 3.6rem;
    padding-inline: 1.5rem;
    font-size: 1.2rem;
  }
}

/* =========================================================================
   Responsive feedback for slow IoT operations
   ------------------------------------------------------------------------
   Goal: every tap feels instant, every slow operation looks intentional.
   Powered by kiosk_feedback.js (handles is-loading and the overlay) plus
   HTMX's built-in .htmx-request class for inline indicators.
   ========================================================================= */

/* Global tap feedback on every DaisyUI button. Mirrors the existing
   .wf-keypad-btn pattern (scale 0.97 + brightness dip) so kiosk buttons
   feel consistent everywhere. */
.btn {
  transition: transform 0.05s ease, filter 0.1s ease, opacity 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:active:not(:disabled):not(.is-loading):not([data-keyboard] .btn):not(#order-keypad .btn):not([data-press] .btn) {
  transform: scale(0.97);
  filter: brightness(0.92);
}

/* Tap feedback for everything else: any link or non-.btn button. The
   existing .btn / .wf-keypad-btn* rules above already give those their own
   active state, so they are excluded here to avoid double-feedback. */
a, button, [role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

a:not(.btn):active,
button:not(.btn):not([class*="wf-keypad-btn"]):not(:disabled):not(.is-loading):active,
[role="button"]:not(.btn):not(:disabled):not(.is-loading):active {
  opacity: 0.55;
  transform: scale(0.98);
}

/* Loading button state — applied by kiosk_feedback.js after submit.
   Hides label text and centers a spinner in the button's own color so it
   reads on any DaisyUI variant (primary/success/error/etc.). */
.btn.is-loading {
  pointer-events: none;
  color: transparent !important;
  position: relative;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.25em;
  height: 1.25em;
  margin: -0.625em 0 0 -0.625em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: inherit;
  opacity: 0.9;
  animation: wf-spin 0.6s linear infinite;
  /* currentColor is transparent on .is-loading; restore via the parent
     button's foreground-color CSS var when present. */
}

/* For DaisyUI themed buttons the foreground variable is *-content. The
   spinner picks that up so it remains visible on every variant. */
.btn-primary.is-loading::after {
  border-color: var(--color-primary-content);
  border-top-color: transparent;
}

.btn-secondary.is-loading::after {
  border-color: var(--color-secondary-content);
  border-top-color: transparent;
}

.btn-success.is-loading::after {
  border-color: var(--color-success-content);
  border-top-color: transparent;
}

.btn-warning.is-loading::after {
  border-color: var(--color-warning-content);
  border-top-color: transparent;
}

.btn-error.is-loading::after {
  border-color: var(--color-error-content);
  border-top-color: transparent;
}

.btn-info.is-loading::after {
  border-color: var(--color-info-content);
  border-top-color: transparent;
}

.btn-neutral.is-loading::after {
  border-color: var(--color-neutral-content);
  border-top-color: transparent;
}

/* Standard HTMX indicator recipe — opacity 0 by default, 1 while the
   triggering element is mid-request. Works with any element marked
   .htmx-indicator and referenced via hx-indicator="…". */
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* Full-screen "working…" overlay used for known slow IoT operations
   (RFID reads, Weighflow weight saves, certificate print). Injected once
   by kiosk_feedback.js and toggled via .is-visible. */
.wf-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(10, 14, 26, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.wf-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.wf-overlay-card {
  background-color: var(--color-base-100);
  border-radius: 1rem;
  padding: 2.25rem 2.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  min-width: 18rem;
  max-width: 90vw;
  text-align: center;
}

.wf-overlay-spinner {
  width: 4rem;
  height: 4rem;
  border: 4px solid var(--color-base-300);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: wf-spin 0.8s linear infinite;
}

.wf-overlay-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-base-content);
  line-height: 1.3;
}

.wf-overlay-subtext {
  font-size: 0.9rem;
  color: var(--color-base-content);
  opacity: 0.65;
  line-height: 1.4;
  max-width: 22rem;
}

@keyframes wf-spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================================
   FSMA pre-check form
   ------------------------------------------------------------------------
   Touch-first kiosk styling: large tap tiles for product selection,
   prominent YES/NO toggle for trailer cleanliness, clear step indicators.
   ========================================================================= */

/* Step badge — small pill before each section heading */
.wf-step-badge {
  display: inline-flex;
  align-items: center;
  background-color: var(--color-primary);
  color: var(--color-primary-content);
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Product tile — large tap target, two-row layout (label + optional flag) */
.wf-fsma-tile {
  min-height: 6rem;
  padding: 1rem 1.25rem;
  background-color: var(--color-base-100);
  border: 2px solid var(--color-base-300);
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  text-align: center;
  cursor: pointer;
  color: var(--color-base-content);
  transition: transform 0.05s ease, filter 0.1s ease, border-color 0.15s ease, background-color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.wf-fsma-tile:active:not(:disabled) {
  transform: scale(0.97);
}

.wf-fsma-tile-label {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .wf-fsma-tile {
    min-height: 7rem;
  }

  .wf-fsma-tile-label {
    font-size: 1.25rem;
  }
}

.wf-fsma-tile-flag {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-warning);
  margin-top: 0.25rem;
}

/* Selected tile state */
.wf-fsma-tile.is-selected {
  border-color: var(--color-primary);
  background-color: rgba(11, 55, 188, 0.08);
  box-shadow: 0 0 0 4px rgba(11, 55, 188, 0.18);
  color: var(--color-primary);
}

.wf-fsma-tile.is-selected .wf-fsma-tile-label {
  color: var(--color-primary);
}

/* Contaminant tile — amber border + warning flag visible */
.wf-fsma-tile-warn {
  border-color: rgba(245, 158, 11, 0.5);
}

.wf-fsma-tile-warn.is-selected {
  border-color: var(--color-warning);
  background-color: rgba(245, 158, 11, 0.12);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25);
  color: var(--color-base-content);
}

.wf-fsma-tile-warn.is-selected .wf-fsma-tile-label {
  color: var(--color-base-content);
}

/* "Other — type my own" tile — dashed border to distinguish */
.wf-fsma-tile-other {
  border-style: dashed;
  color: var(--color-base-content);
  opacity: 0.85;
}

.wf-fsma-tile-other.is-selected {
  border-style: solid;
}

/* Big YES / NO buttons for cleanliness */
.wf-fsma-yesno {
  min-height: 7.5rem;
  border: 2px solid var(--color-base-300);
  border-radius: 0.75rem;
  background-color: var(--color-base-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-base-content);
  cursor: pointer;
  transition: transform 0.05s ease, filter 0.1s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  padding: 1rem;
}

.wf-fsma-yesno:active:not(:disabled) {
  transform: scale(0.98);
}

.wf-fsma-yesno-icon {
  font-size: 2.5rem;
  line-height: 1;
  font-weight: 800;
}

@media (min-width: 640px) {
  .wf-fsma-yesno {
    min-height: 9rem;
    font-size: 1.5rem;
  }

  .wf-fsma-yesno-icon {
    font-size: 3rem;
  }
}

.wf-fsma-yes.is-selected {
  background-color: var(--color-success);
  border-color: var(--color-success);
  color: var(--color-success-content);
}

.wf-fsma-no.is-selected {
  background-color: var(--color-error);
  border-color: var(--color-error);
  color: var(--color-error-content);
}

/* Step indicator — clickable tabs across the top of the FSMA form so the
   driver only sees one step at a time (no vertical scrolling on the kiosk). */
.wf-fsma-stepper {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  background-color: var(--color-base-100);
  border: 1px solid var(--color-base-300);
  border-radius: 0.625rem;
  padding: 0.375rem;
}

.wf-fsma-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  background-color: transparent;
  color: var(--color-base-content);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.wf-fsma-step:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wf-fsma-step.is-active {
  background-color: var(--color-primary);
  color: var(--color-primary-content);
}

.wf-fsma-step.is-complete:not(.is-active) {
  color: var(--color-success);
}

.wf-fsma-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  background-color: var(--color-base-300);
  color: var(--color-base-content);
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.wf-fsma-step.is-active .wf-fsma-step-num {
  background-color: rgba(255, 255, 255, 0.25);
  color: var(--color-primary-content);
}

.wf-fsma-step.is-complete:not(.is-active) .wf-fsma-step-num {
  background-color: var(--color-success);
  color: var(--color-success-content);
}

.wf-fsma-step-label {
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

@media (min-width: 640px) {
  .wf-fsma-step {
    font-size: 1.125rem;
    padding: 0.75rem 1.25rem;
  }

  .wf-fsma-step-label {
    font-size: 1.05rem;
  }

  .wf-fsma-step-num {
    width: 2rem;
    height: 2rem;
  }
}

/* =========================================================================
   User menu — top-nav account dropdown
   ------------------------------------------------------------------------
   Pill-shaped trigger with avatar + chevron. Panel uses a soft elevated
   card look (rounded, shadow + ring) matching the Weighflow design system.
   ========================================================================= */

/* Trigger pill (the <summary> of the <details> dropdown). */
.wf-usermenu-trigger {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  height: 2.75rem;
  padding: 0.25rem 0.875rem 0.25rem 0.3rem;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--color-primary-content);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.wf-usermenu-trigger::-webkit-details-marker {
  display: none;
}

.wf-usermenu-trigger:hover {
  background-color: rgba(255, 255, 255, 0.14);
}

.wf-usermenu[open] .wf-usermenu-trigger {
  background-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

@media (min-width: 640px) {
  .wf-usermenu-trigger {
    height: 3rem;
  }
}

/* Avatar circle inside the trigger and the user-card. */
.wf-usermenu-avatar {
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.16));
  color: var(--color-primary-content);
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.wf-usermenu-name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-usermenu-chev {
  width: 0.875rem;
  height: 0.875rem;
  opacity: 0.7;
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.wf-usermenu[open] .wf-usermenu-chev {
  transform: rotate(180deg);
  opacity: 1;
}

/* The dropdown panel. */
.wf-usermenu-panel {
  position: absolute;
  right: 0;
  margin-top: 0.5rem;
  min-width: 17rem;
  background-color: var(--color-base-100);
  color: var(--color-base-content);
  border-radius: 0.875rem;
  box-shadow:
    0 20px 40px -12px rgba(10, 14, 26, 0.28),
    0 8px 16px -8px rgba(10, 14, 26, 0.16);
  border: 1px solid rgba(10, 14, 26, 0.06);
  padding: 0.375rem;
  z-index: 50;
  transform-origin: top right;
  animation: wf-usermenu-in 0.14s ease-out;
}

@keyframes wf-usermenu-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Identity header inside the panel. */
.wf-usermenu-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.75rem 0.875rem;
  border-bottom: 1px solid var(--color-base-300);
  margin-bottom: 0.375rem;
}

.wf-usermenu-card-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 70%, white));
  color: var(--color-primary-content);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  flex-shrink: 0;
}

.wf-usermenu-card-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
}

.wf-usermenu-card-eyebrow {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(26, 31, 44, 0.55);
  font-weight: 600;
  line-height: 1;
}

.wf-usermenu-card-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-base-content);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-usermenu-card-email {
  font-size: 0.8125rem;
  color: rgba(26, 31, 44, 0.6);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Menu items. */
.wf-usermenu-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5625rem 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-base-content);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  line-height: 1.2;
}

.wf-usermenu-item:hover {
  background-color: var(--color-base-200);
}

.wf-usermenu-item-icon {
  width: 1.05rem;
  height: 1.05rem;
  opacity: 0.65;
  flex-shrink: 0;
}

.wf-usermenu-item:hover .wf-usermenu-item-icon {
  opacity: 0.9;
}

/* Sign-out: subtle red tint on hover. */
.wf-usermenu-item-danger:hover {
  background-color: color-mix(in srgb, var(--color-error) 12%, transparent);
  color: var(--color-error);
}

.wf-usermenu-item-danger:hover .wf-usermenu-item-icon {
  opacity: 1;
  color: var(--color-error);
}

/* Divider line between sections inside the menu. */
.wf-usermenu-divider {
  height: 1px;
  background-color: var(--color-base-300);
  margin: 0.375rem -0.375rem;
}

/* The <form> wrapping a button should be a no-op layout-wise. */
.wf-usermenu-form {
  margin: 0;
  padding: 0;
}
/* =========================================================================
   Setup area — wizard stepper + form helpers
   ------------------------------------------------------------------------
   .wf-stepper is a neutral (non-interactive) generalization of the FSMA
   stepper above, used by the setup wizards. The FSMA classes are left
   untouched so the check-in flow is unaffected.
   ========================================================================= */
.wf-stepper {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  background-color: var(--color-base-100);
  border: 1px solid var(--color-base-300);
  border-radius: 0.625rem;
  padding: 0.375rem;
}

.wf-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--color-base-content);
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0.55;
}

.wf-step.is-active {
  background-color: var(--color-primary);
  color: var(--color-primary-content);
  opacity: 1;
}

.wf-step.is-complete {
  color: var(--color-success);
  opacity: 1;
}

.wf-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  background-color: var(--color-base-300);
  color: var(--color-base-content);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.wf-step.is-active .wf-step-num {
  background-color: rgba(255, 255, 255, 0.25);
  color: var(--color-primary-content);
}

.wf-step.is-complete .wf-step-num {
  background-color: var(--color-success);
  color: var(--color-success-content);
}

@media (max-width: 639px) {
  .wf-step-label {
    display: none;
  }
}

/* Setup forms: widgets fill their column. */
.wf-form .input,
.wf-form .select,
.wf-form .textarea {
  width: 100%;
}

/* Kiosk wizard terminal step: the inline "new terminal" fields only appear
   while the "Add a new terminal" radio (value="new") is selected. */
.wf-new-terminal-fields {
  display: none;
}

.wf-terminal-choice:has(input[value="new"]:checked) .wf-new-terminal-fields {
  display: flex;
}

/* Kiosk loading targets: show only the selected limit mode's input — a
   percentage of the max, or a fixed lbs buffer under it. */
.wf-target-pct-field,
.wf-target-buffer-field {
  display: none;
}

.wf-target-limit-choice:has(input[value="pct"]:checked) .wf-target-pct-field,
.wf-target-limit-choice:has(input[value="buffer"]:checked) .wf-target-buffer-field {
  display: flex;
}

/* ------------------------------------------------------------------ */
/* Live camera wall                                                     */
/* ------------------------------------------------------------------ */

/* Thumbnails fade up as they arrive. The animation runs when the element is
   inserted, which is exactly once per genuinely new photo: the wall morphs its
   cards rather than replacing them, so an unchanged <img> is never re-inserted
   and never re-animates. Tailwind has no insertion animation to compose here. */
.wf-cam-thumb {
  animation: wf-cam-fade-in 450ms ease-out both;
}

@keyframes wf-cam-fade-in {
  from {
    opacity: 0;
    transform: scale(1.015);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Dimmed while its refresh is in flight, so a card visibly hands over rather
   than blinking between two trucks. */
.wf-cam-card {
  transition: opacity 180ms ease-out;
}

.wf-cam-card--refreshing {
  opacity: 0.45;
}

/* Transport indicator: a pulsing dot for the pushed feed, a still one when the
   page is falling back to polling. */
.wf-live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: var(--color-success, #4caf50);
  animation: wf-live-pulse 1.8s ease-in-out infinite;
}

.wf-live-dot--polling {
  background-color: var(--color-base-content, #1a1f2c);
  opacity: 0.35;
  animation: none;
}

@keyframes wf-live-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wf-cam-thumb,
  .wf-live-dot {
    animation: none;
  }
}
