/* Dialogs — theme-aware overlay (avoids harsh black wash in light mode) */
.ww-dialog-overlay {
  background: hsl(222 47% 11% / 0.4);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

html.dark .ww-dialog-overlay,
html:not(.light) .ww-dialog-overlay {
  background: hsl(0 0% 0% / 0.65);
}

.ww-dialog-panel {
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  box-shadow:
    0 0 0 1px hsl(var(--border) / 0.7),
    0 18px 40px hsl(0 0% 0% / 0.14);
}

html.dark .ww-dialog-panel,
html:not(.light) .ww-dialog-panel {
  box-shadow:
    0 0 0 1px hsl(0 0% 100% / 0.06),
    0 24px 48px hsl(0 0% 0% / 0.45);
}

/* Switch — off-state must stay visible in light mode (theme muted/input are too pale). */
.ww-switch {
  position: relative;
  display: inline-flex;
  height: 1.5rem;
  width: 2.75rem;
  flex-shrink: 0;
  cursor: pointer;
  align-items: center;
  border-radius: 9999px;
  border: 2px solid #64748b;
  background-color: #94a3b8;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  padding: 0;
}

.ww-switch[aria-checked="true"] {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--primary));
}

.ww-switch__thumb {
  pointer-events: none;
  display: block;
  height: 1.25rem;
  width: 1.25rem;
  transform: translateX(0);
  border-radius: 9999px;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.35);
  transition: transform 0.15s ease;
}

.ww-switch__thumb--on,
.ww-switch[aria-checked="true"] .ww-switch__thumb {
  transform: translateX(1.25rem);
}

html.dark .ww-switch:not([aria-checked="true"]),
html:not(.light) .ww-switch:not([aria-checked="true"]) {
  border-color: hsl(0 0% 55%);
  background-color: hsl(0 0% 42%);
}

/* Modern thin scrollbars for dialogs, sheets, and nested modal panes */
.ww-dialog-scroll,
.ww-dialog-scroll-pane {
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--muted-foreground) / 0.32) transparent;
}

/* Keep dialog footers / Close above AppSelect dismiss-scrim. */
.ww-dialog-actions {
  position: relative;
  z-index: 300;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.ww-dialog-scroll::-webkit-scrollbar,
.ww-dialog-scroll-pane::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.ww-dialog-scroll::-webkit-scrollbar-track,
.ww-dialog-scroll-pane::-webkit-scrollbar-track {
  background: transparent;
  margin-block: 10px;
  margin-inline: 2px;
}

.ww-dialog-scroll::-webkit-scrollbar-thumb,
.ww-dialog-scroll-pane::-webkit-scrollbar-thumb {
  background-color: hsl(var(--muted-foreground) / 0.28);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  min-height: 40px;
}

.ww-dialog-scroll::-webkit-scrollbar-thumb:hover,
.ww-dialog-scroll-pane::-webkit-scrollbar-thumb:hover {
  background-color: hsl(var(--muted-foreground) / 0.48);
}

.ww-dialog-scroll::-webkit-scrollbar-corner,
.ww-dialog-scroll-pane::-webkit-scrollbar-corner {
  background: transparent;
}

html.dark .ww-dialog-scroll,
html.dark .ww-dialog-scroll-pane,
html:not(.light) .ww-dialog-scroll,
html:not(.light) .ww-dialog-scroll-pane {
  scrollbar-color: hsl(0 0% 100% / 0.22) transparent;
}

html.dark .ww-dialog-scroll::-webkit-scrollbar-thumb,
html.dark .ww-dialog-scroll-pane::-webkit-scrollbar-thumb,
html:not(.light) .ww-dialog-scroll::-webkit-scrollbar-thumb,
html:not(.light) .ww-dialog-scroll-pane::-webkit-scrollbar-thumb {
  background-color: hsl(0 0% 100% / 0.16);
}

html.dark .ww-dialog-scroll::-webkit-scrollbar-thumb:hover,
html.dark .ww-dialog-scroll-pane::-webkit-scrollbar-thumb:hover,
html:not(.light) .ww-dialog-scroll::-webkit-scrollbar-thumb:hover,
html:not(.light) .ww-dialog-scroll-pane::-webkit-scrollbar-thumb:hover {
  background-color: hsl(0 0% 100% / 0.3);
}

/* Prefer scrolling inside the panel; hide the outer viewport bar when possible */
.ww-dialog-viewport {
  scrollbar-width: none;
}

.ww-dialog-viewport::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* Shared UI from accounting_standalone/src/index.css (animations + cards) */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up {
  animation: fade-in-up 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dashboard cards — dark theme uses very faded borders; light uses enhanced shadow */
.dark .card-enhanced,
html:not(.light) .card-enhanced {
  border: 1px solid var(--border-color);
}

.light .card-enhanced {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border, var(--border)));
  box-shadow: var(--card-shadow, 0 1px 3px 0 rgba(0, 0, 0, 0.1));
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.light .card-enhanced:hover {
  box-shadow: var(--card-shadow-hover, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
  transform: translateY(-1px);
  border-color: hsl(var(--primary) / 0.2);
}

.light .card-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 250, 252, 0.8) 100%);
  opacity: 0.6;
}

.light .btn-enhanced {
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.light .btn-enhanced:hover {
  background: hsl(var(--primary) / 0.1);
  border-color: hsl(var(--primary) / 0.3);
  color: hsl(var(--primary));
}

.light .table-enhanced {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border, var(--border)));
  box-shadow: var(--card-shadow);
}

.light .table-enhanced thead {
  background: hsl(var(--muted) / 0.5);
  border-bottom: 2px solid hsl(var(--border));
}

.light .table-enhanced tbody tr:hover {
  background: hsl(var(--muted) / 0.3);
}

/* shadcn Card */
.ui-card {
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

html.dark .ui-card,
html:not(.light) .ui-card {
  border-color: transparent;
  box-shadow: none;
}

/* Base resets (from React index.css) */
*, *::before, *::after {
  border-color: var(--border-color);
}

/*
 * Dark mode: force very faded outlines (Tailwind CDN ignores nested CSS vars).
 * Semantic colored borders (green/red/emerald/etc.) are excluded.
 */
html.dark,
html:not(.light),
html[data-theme="dark"] {
  --border-color: hsl(0 0% 100% / 0.03);
  --input-color: hsl(0 0% 100% / 0.03);
}

/* Shell chrome: keep faded borders even if html class/data-theme flickers during navigation */
html:not(.light) .ww-app-chrome,
html:not(.light) .ww-app-chrome [class*="border-border"],
html[data-theme="dark"] .ww-app-chrome,
html[data-theme="dark"] .ww-app-chrome [class*="border-border"] {
  border-color: hsl(0 0% 100% / 0.03) !important;
}

/* Pin dark tokens on shell so nav/icons never flash light-mode blue during enhanced navigation */
html:not(.light) .ww-app-chrome,
html[data-theme="dark"] .ww-app-chrome {
  color-scheme: dark;
  --foreground: 0 0% 98%;
  --muted-foreground: 0 0% 60%;
  --primary: 0 0% 100%;
  --primary-foreground: 0 0% 10%;
  --secondary: 0 0% 20%;
  --secondary-foreground: 0 0% 98%;
  --card: 0 0% 14%;
  --card-foreground: 0 0% 98%;
  --background: 0 0% 10%;
  --border-color: transparent;
  background-color: hsl(0 0% 10%);
}

html:not(.light) #ww-app-header.ww-app-chrome,
html[data-theme="dark"] #ww-app-header.ww-app-chrome {
  background-color: hsl(0 0% 10%) !important;
}

.ww-app-chrome nav a.ww-nav-link {
  text-decoration: none;
  transition: none;
  -webkit-tap-highlight-color: transparent;
}

/* Almost.thr mark in desktop sidebar (LMS-style attribution) */
.ww-sidebar-almost.almost-thr-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  color: inherit;
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.ww-sidebar-almost.almost-thr-link:hover,
.ww-sidebar-almost.almost-thr-link:focus-visible {
  opacity: 1;
  background-color: hsl(var(--muted) / 0.6);
}

.ww-sidebar-almost .almost-thr-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.ww-sidebar-almost .almost-thr-icon--on-dark {
  display: none;
}

html:not(.light) .ww-sidebar-almost .almost-thr-icon--on-light,
html[data-theme="dark"] .ww-sidebar-almost .almost-thr-icon--on-light {
  display: none;
}

html:not(.light) .ww-sidebar-almost .almost-thr-icon--on-dark,
html[data-theme="dark"] .ww-sidebar-almost .almost-thr-icon--on-dark {
  display: block;
}

html:not(.light) .ww-app-chrome .ww-nav-active,
html[data-theme="dark"] .ww-app-chrome .ww-nav-active {
  background-color: hsl(0 0% 100%) !important;
  color: hsl(0 0% 10%) !important;
}

html:not(.light) .ww-app-chrome .ww-nav-inactive,
html[data-theme="dark"] .ww-app-chrome .ww-nav-inactive {
  color: hsl(0 0% 60%) !important;
}

html:not(.light) .ww-app-chrome .ww-nav-inactive:hover,
html[data-theme="dark"] .ww-app-chrome .ww-nav-inactive:hover {
  background-color: hsl(0 0% 20%) !important;
  color: hsl(0 0% 100%) !important;
}

/* Phone / small tablet: never flash desktop sidebar during enhanced navigation.
   Cutover matches Tailwind lg (1024) so phone landscape keeps mobile chrome. */
@media (max-width: 1023px) {
  .ww-desktop-sidebar,
  #ww-desktop-sidebar {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* ---- Orientation / short-viewport shell ---- */
:root {
  --ww-vvh: 100dvh;
  --ww-vvw: 100vw;
}

.ww-app-main {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Compact bottom nav + content padding on short landscape phones */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1023px) {
  #ww-app-header {
    height: 3.25rem;
  }

  .ww-app-main {
    padding-top: 4.25rem !important;
    padding-bottom: 4.25rem !important;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  #ww-bottom-nav {
    padding-top: 0.25rem;
    padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
  }

  #ww-bottom-nav .ww-bottom-nav-pill,
  #ww-bottom-nav .ww-bottom-nav-icon {
    min-height: 2.25rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
  }

  /* Prefer denser financial tables when landscape width is available */
  .ww-doc-mobile-list {
    display: none;
  }

  .ww-doc-desktop-table {
    display: block;
  }

  .ww-doc-desktop-table > .overflow-x-auto,
  .ww-doc-desktop-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Prefer dynamic viewport units for sticky KB / tall panels */
@supports (height: 100dvh) {
  .ww-kb-panel,
  .ww-sticky-panel {
    max-height: calc(100dvh - 8rem);
  }
}

/* Short landscape: keep dialogs/sheets usable with keyboard chrome */
@media (orientation: landscape) and (max-height: 500px) {
  .ww-dialog-scroll,
  .ww-dialog-viewport .ww-dialog-scroll {
    max-height: calc(100dvh - 0.75rem) !important;
  }
}

/* Shared table scrollport — use on dense financial tables */
.ww-table-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* Bottom nav: one icon shape per slot — no pill+circle overlap during DOM morph */
.ww-bottom-nav-item {
  overflow: hidden;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.ww-bottom-nav .ww-bottom-nav-pill,
.ww-bottom-nav .ww-bottom-nav-icon {
  transition: none;
}

html[data-theme="dark"] .ww-bottom-nav .ww-bottom-nav-pill-dark {
  background-color: #fff !important;
  border-color: #fff !important;
  color: #000 !important;
}

html[data-theme="dark"] .ww-bottom-nav .ww-bottom-nav-pill-dark svg {
  color: #000 !important;
  stroke: #000 !important;
}

#ww-bottom-nav[data-permanent] + #ww-bottom-nav,
#ww-desktop-sidebar[data-permanent] + #ww-desktop-sidebar,
#ww-app-header[data-permanent] + #ww-app-header {
  display: none !important;
}

/* Hide while scrolling — JS toggles class; menu-open forces visible */
#ww-bottom-nav {
  transition: transform 0.28s ease-out, opacity 0.28s ease-out;
  will-change: transform, opacity;
}

#ww-bottom-nav.ww-bottom-nav--scroll-hidden:not(.ww-bottom-nav--menu-open) {
  transform: translate3d(0, 110%, 0) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#ww-bottom-nav.ww-bottom-nav--menu-open {
  transform: translate3d(0, 0, 0) !important;
  opacity: 1 !important;
}

/* Desktop sidebar: keep tooltips unclipped (do not pair overflow-y:auto with visible-x). */
#ww-desktop-sidebar,
#ww-desktop-sidebar > nav {
  overflow: visible !important;
}

/* Desktop sidebar icon tooltips (matches React TooltipContent side=right) */
.ww-sidebar-tooltip-host {
  overflow: visible;
  position: relative;
  z-index: 1;
}

.ww-sidebar-tooltip-host:hover,
.ww-sidebar-tooltip-host:focus-within {
  z-index: 300;
}

.ww-sidebar-tooltip {
  position: absolute;
  left: calc(100% + 0.625rem);
  top: 50%;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: max-content;
  max-width: 14rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.12);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
  white-space: nowrap;
}

.ww-sidebar-tooltip-label {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
}

.ww-sidebar-tooltip-hint {
  font-size: 0.75rem;
  line-height: 1rem;
  color: hsl(var(--muted-foreground));
  white-space: normal;
}

.ww-sidebar-tooltip-host:hover .ww-sidebar-tooltip,
.ww-sidebar-tooltip-host:focus-within .ww-sidebar-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

html.dark :is(
    .border-border,
    .border-input,
    .border-t.border-border,
    .border-b.border-border,
    .border-l.border-border,
    .border-r.border-border,
    .border.border-border,
    .border.border-input,
    .border.border-dashed,
    .divide-border > :not([hidden]) ~ :not([hidden]),
    .rounded-lg.border,
    .rounded-xl.border,
    .rounded-2xl.border,
    .rounded-md.border,
    .rounded-lg.border.bg-card,
    aside.border-r,
    header.border-b
  ):not(
    [class*="border-green"],
    [class*="border-red"],
    [class*="border-emerald"],
    [class*="border-rose"],
    [class*="border-amber"],
    [class*="border-primary"],
    [class*="border-destructive"]
  ),
html:not(.light) :is(
    .border-border,
    .border-input,
    .border-t.border-border,
    .border-b.border-border,
    .border-l.border-border,
    .border-r.border-border,
    .border.border-border,
    .border.border-input,
    .border.border-dashed,
    .divide-border > :not([hidden]) ~ :not([hidden]),
    .rounded-lg.border,
    .rounded-xl.border,
    .rounded-2xl.border,
    .rounded-md.border,
    .rounded-lg.border.bg-card,
    aside.border-r,
    header.border-b
  ):not(
    [class*="border-green"],
    [class*="border-red"],
    [class*="border-emerald"],
    [class*="border-rose"],
    [class*="border-amber"],
    [class*="border-primary"],
    [class*="border-destructive"]
  ) {
  border-color: hsl(0 0% 100% / 0.03) !important;
}

html.dark .border-white\/10,
html:not(.light) .border-white\/10,
html.dark .border-white\/\[0\.06\],
html:not(.light) .border-white\/\[0\.06\] {
  border-color: hsl(0 0% 100% / 0.03) !important;
}

html.dark .border-white\/15,
html:not(.light) .border-white\/15,
html.dark .border-white\/\[0\.08\],
html:not(.light) .border-white\/\[0\.08\] {
  border-color: hsl(0 0% 100% / 0.04) !important;
}

html.dark .border-2.border-input,
html:not(.light) .border-2.border-input,
html.dark .border-2.border-border,
html:not(.light) .border-2.border-border {
  border-width: 1px;
}

/* Catch border-border/60, border-input/50, etc. */
html.dark [class*="border-border"]:not([class*="border-green"]):not([class*="border-red"]):not([class*="border-emerald"]):not([class*="border-rose"]):not([class*="border-amber"]):not([class*="border-primary"]),
html:not(.light) [class*="border-border"]:not([class*="border-green"]):not([class*="border-red"]):not([class*="border-emerald"]):not([class*="border-rose"]):not([class*="border-amber"]):not([class*="border-primary"]),
html.dark [class*="border-input"],
html:not(.light) [class*="border-input"] {
  border-color: hsl(0 0% 100% / 0.03) !important;
}
button, [role="button"] {
  cursor: pointer;
}

/* No full-screen loading chrome during enhanced navigation */
html.blazor-loading::before,
html.blazor-loading::after,
.loading-progress,
.loading-progress-text {
  display: none !important;
}

/* Page heading — single-line title on all screen sizes */
.ww-page-heading {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.1;
  color: hsl(var(--foreground));
}

@media (min-width: 640px) {
  .ww-page-heading {
    gap: 0.75rem;
    font-size: 1.5rem;
  }
}

@media (min-width: 768px) {
  .ww-page-heading {
    margin-bottom: 0.5rem;
    font-size: 1.875rem;
  }
}

.ww-page-heading__title {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ww-page-heading__icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  color: hsl(var(--primary));
}

@media (min-width: 768px) {
  .ww-page-heading__icon {
    width: 2rem;
    height: 2rem;
  }
}

.ww-page-heading__description {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.35;
  color: hsl(var(--muted-foreground));
}

@media (min-width: 768px) {
  .ww-page-heading__description {
    margin-left: 2.75rem;
    font-size: 1rem;
  }
}

/* Tabs — reliable layout (Tailwind CDN misses dynamic grid-cols-*; load this file after Tailwind) */
.ww-tabs-list {
  display: grid;
  width: 100%;
  max-width: 100%;
  gap: 0.25rem;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
  border-radius: 0.375rem;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  box-sizing: border-box;
  align-items: stretch;
}

.ww-tabs-list--cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ww-tabs-list--cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ww-tabs-list--cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ww-tabs-list--cols-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ww-tabs-list--wrap {
  display: flex;
  flex-wrap: wrap;
  height: auto;
  gap: 0.25rem;
}

.ww-tabs-list--wrap .ww-tabs-trigger {
  width: auto;
  flex: 0 1 auto;
}

.ww-tabs-list--wrap .ww-tabs-trigger__content {
  width: auto;
}

/* Company settings — scroll on mobile, 4-column grid on tablet+ */
.ww-tabs-list--scroll {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  gap: 0.25rem;
}

.ww-tabs-list--scroll::-webkit-scrollbar {
  display: none;
}

.ww-tabs-list--scroll .ww-tabs-trigger {
  flex: 0 0 auto;
  width: auto;
  scroll-snap-align: start;
}

.ww-tabs-list--scroll .ww-tabs-trigger__content {
  flex-direction: row;
  gap: 0.375rem;
  width: auto;
  min-width: 4.25rem;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .ww-tabs-list--settings-org {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow-x: visible;
    flex-wrap: wrap;
  }

  .ww-tabs-list--settings-org .ww-tabs-trigger {
    width: 100%;
  }

  .ww-tabs-list--settings-org .ww-tabs-trigger__content {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }
}

.ww-settings-org-tabs-nav {
  position: relative;
  border-radius: 1rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.45);
  padding: 0.375rem;
}

@media (max-width: 767px) {
  .ww-settings-org-tabs-nav::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1.75rem;
    border-radius: 0 1rem 1rem 0;
    background: linear-gradient(to right, transparent, hsl(var(--muted) / 0.9));
    pointer-events: none;
  }
}

.ww-tabs-list--settings-org.ww-tabs-list {
  margin-bottom: 0;
  background: transparent;
  padding: 0;
}

.ww-tabs-trigger {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent !important;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

a.ww-tabs-trigger {
  text-decoration: none;
  color: inherit;
}

.ww-tabs-trigger__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.375rem 0.25rem;
  border-radius: 0.125rem;
  box-sizing: border-box;
  /* No color transition — dark-mode icon strokes were flashing white on tab activate/nav */
  transition: none;
}

@media (min-width: 640px) {
  .ww-tabs-trigger__content {
    flex-direction: row;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0.375rem 0.75rem;
  }
}

.ww-tabs-trigger--active .ww-tabs-trigger__content {
  background: hsl(var(--background)) !important;
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}

.ww-tabs-trigger__icon {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  display: block;
  transition: none;
}

/* Pin tab/header icon strokes in dark mode so remounts cannot flash light-theme blue/white */
html:not(.light) .ww-tabs-trigger__icon,
html[data-theme="dark"] .ww-tabs-trigger__icon,
html:not(.light) .ww-tabs-trigger svg,
html[data-theme="dark"] .ww-tabs-trigger svg {
  color: hsl(0 0% 70%) !important;
  stroke: currentColor !important;
}

html:not(.light) .ww-tabs-trigger--active .ww-tabs-trigger__icon,
html[data-theme="dark"] .ww-tabs-trigger--active .ww-tabs-trigger__icon,
html:not(.light) .ww-tabs-trigger--active svg,
html[data-theme="dark"] .ww-tabs-trigger--active svg {
  color: hsl(0 0% 98%) !important;
  stroke: currentColor !important;
}

html:not(.light) #ww-app-header svg,
html[data-theme="dark"] #ww-app-header svg {
  color: hsl(0 0% 98%) !important;
  stroke: currentColor !important;
  transition: none !important;
}

html:not(.light) #ww-app-header button,
html[data-theme="dark"] #ww-app-header button,
html:not(.light) #ww-app-header a,
html[data-theme="dark"] #ww-app-header a {
  transition: none !important;
}

.ww-tabs-trigger__label {
  font-size: 0.625rem;
  font-weight: 500;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .ww-tabs-trigger__label {
    font-size: 0.875rem;
  }
}

.ww-tabs-trigger__label--long {
  display: none;
}

@media (min-width: 640px) {
  .ww-tabs-trigger__label--long {
    display: inline;
  }

  .ww-tabs-trigger__label--short {
    display: none;
  }
}

/* Settings hub & profile menu */
.ww-settings-nav a,
.ww-settings-row {
  text-decoration: none;
}

.ww-profile-menu {
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
}

.ww-settings-category-list .ww-settings-row:active {
  background: hsl(var(--muted) / 0.7);
}

/* Support hub */
.ww-support-status-open { color: hsl(142 76% 36%); }
.ww-support-status-in-progress { color: hsl(38 92% 50%); }
.ww-support-status-waiting { color: hsl(217 91% 60%); }
.ww-support-status-resolved { color: hsl(160 84% 39%); }
.ww-support-status-closed { color: hsl(var(--muted-foreground)); }

.ww-support-msg {
  word-break: break-word;
}

.ww-support-table table {
  min-width: 640px;
}

@media (max-width: 640px) {
  .ww-support-table {
    -webkit-overflow-scrolling: touch;
  }
}

/* Knowledge base — sidebar + content */
.ww-kb-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

@media (min-width: 1024px) {
  .ww-kb-layout {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
  }
}

.ww-kb-sidebar {
  flex-direction: column;
  min-width: 0;
}

@media (min-width: 1024px) {
  .ww-kb-sidebar {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 8rem);
    max-height: calc(100dvh - 8rem);
  }
}

.ww-kb-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  max-height: min(60vh, 60dvh, 640px);
  padding-right: 0.25rem;
}

@media (min-width: 1024px) {
  .ww-kb-nav {
    max-height: calc(100vh - 12rem);
    max-height: calc(100dvh - 12rem);
  }
}

.ww-kb-nav-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ww-kb-nav-item:hover {
  background: hsl(var(--muted) / 0.5);
}

.ww-kb-nav-item--active {
  background: hsl(var(--primary) / 0.08);
  border-color: hsl(var(--primary) / 0.25);
}

.ww-kb-nav-item__title {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  line-height: 1.35;
}

.ww-kb-nav-item--active .ww-kb-nav-item__title {
  color: hsl(var(--primary));
}

.ww-kb-nav-item__meta {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.ww-kb-main {
  flex: 1;
}

/* Support hub — list + main panel */
.ww-support-hub-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

@media (min-width: 1024px) {
  .ww-support-hub-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
  }
}

.ww-support-hub-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.ww-support-hub-link:hover {
  background: hsl(var(--muted) / 0.45);
}

/* Brief post-login persona confirmation */
.ww-persona-flash {
  animation: ww-persona-flash-in 0.25s ease-out, ww-persona-flash-out 0.35s ease-in 1.45s forwards;
}

@keyframes ww-persona-flash-in {
  from { opacity: 0; transform: translateY(-0.35rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ww-persona-flash-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Module sub-nav (Payroll / Assets / Petty Cash) — horizontal slide on mobile */
.ww-module-tabs-nav {
  position: relative;
  border-radius: 0.9rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.5);
  padding: 0.3rem;
}

.ww-module-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.2rem;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.ww-module-tabs::-webkit-scrollbar {
  display: none;
}

.ww-module-tabs__link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: 0.4rem 0.85rem;
  border-radius: 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  scroll-snap-align: start;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.ww-module-tabs__link:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--background) / 0.55);
}

.ww-module-tabs__link--active,
.ww-module-tabs__link.active {
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  box-shadow: 0 1px 2px hsl(0 0% 0% / 0.06), 0 0 0 1px hsl(var(--border) / 0.55);
}

.ww-module-tabs__end {
  flex: 0 0 0.85rem;
  width: 0.85rem;
}

@media (max-width: 767px) {
  .ww-module-tabs-nav::before,
  .ww-module-tabs-nav::after {
    content: "";
    position: absolute;
    top: 0.3rem;
    bottom: 0.3rem;
    width: 1.5rem;
    z-index: 1;
    pointer-events: none;
  }

  .ww-module-tabs-nav::before {
    left: 0.3rem;
    border-radius: 0.65rem 0 0 0.65rem;
    background: linear-gradient(to right, hsl(var(--muted) / 0.95), transparent);
  }

  .ww-module-tabs-nav::after {
    right: 0.3rem;
    border-radius: 0 0.65rem 0.65rem 0;
    background: linear-gradient(to left, hsl(var(--muted) / 0.95), transparent);
  }

  .ww-module-tabs__link {
    min-height: 2.35rem;
    padding: 0.45rem 0.95rem;
    font-size: 0.8125rem;
  }
}

.ww-select {
  appearance: none;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  padding-right: 2.25rem;
}

.dark .ww-select {
  color-scheme: dark;
}

.ww-select option {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

/* System Admin shell — mobile-first */
.sa-shell {
  max-width: 100vw;
}

.sa-header .ww-tabs-list {
  margin-bottom: 0;
}

.sa-header .ww-tabs-list--scroll {
  margin-left: -0.25rem;
  margin-right: -0.25rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.sa-nav {
  padding-top: env(safe-area-inset-top);
}

@media (max-width: 767px) {
  .sa-shell main table {
    font-size: 0.8125rem;
  }
}

/* Platform Admin shell — mirrors System Admin mobile patterns */
.pa-shell {
  max-width: 100vw;
}

.pa-header .ww-tabs-list {
  margin-bottom: 0;
}

.pa-header .ww-tabs-list--scroll {
  margin-left: -0.25rem;
  margin-right: -0.25rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.pa-nav {
  padding-top: env(safe-area-inset-top);
}

@media (max-width: 767px) {
  .pa-shell main table {
    font-size: 0.8125rem;
  }

  .pa-shell main .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }
}

/* —— Centred action feedback overlay (ActionResultHost) —— */
.ww-action-feedback {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
}

.ww-action-feedback__backdrop {
  position: absolute;
  inset: 0;
  background: hsl(var(--foreground) / 0.12);
  pointer-events: none;
}

.dark .ww-action-feedback__backdrop,
html:not(.light) .ww-action-feedback__backdrop {
  background: rgb(0 0 0 / 0.35);
}

.ww-action-feedback__card {
  position: relative;
  pointer-events: auto;
  width: min(100%, 22rem);
  border-radius: 1rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  box-shadow:
    0 10px 40px -12px rgb(0 0 0 / 0.28),
    0 0 0 1px hsl(var(--border) / 0.4);
  padding: 1.5rem 1.35rem 1.35rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.ww-action-feedback__icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.ww-action-feedback__svg {
  width: 1.65rem;
  height: 1.65rem;
}

.ww-action-feedback__svg--check {
  width: 3rem;
  height: 3rem;
}

.ww-action-feedback__card[data-kind="success"] .ww-action-feedback__icon {
  background: rgb(22 163 74 / 0.12);
  color: rgb(21 128 61);
}
.dark .ww-action-feedback__card[data-kind="success"] .ww-action-feedback__icon,
html:not(.light) .ww-action-feedback__card[data-kind="success"] .ww-action-feedback__icon {
  color: rgb(74 222 128);
}

.ww-action-feedback__card[data-kind="error"] .ww-action-feedback__icon {
  background: hsl(var(--destructive) / 0.12);
  color: hsl(var(--destructive));
}

.ww-action-feedback__card[data-kind="warning"] .ww-action-feedback__icon {
  background: rgb(245 158 11 / 0.14);
  color: rgb(180 83 9);
}
.dark .ww-action-feedback__card[data-kind="warning"] .ww-action-feedback__icon,
html:not(.light) .ww-action-feedback__card[data-kind="warning"] .ww-action-feedback__icon {
  color: rgb(251 191 36);
}

.ww-action-feedback__card[data-kind="info"] .ww-action-feedback__icon {
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}

.ww-action-feedback__title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0;
}

.ww-action-feedback__message {
  font-size: 0.875rem;
  line-height: 1.45;
  color: hsl(var(--muted-foreground));
  margin: 0;
  max-width: 22rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.ww-action-feedback__dismiss {
  margin-top: 0.65rem;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  cursor: pointer;
}
.ww-action-feedback__dismiss:hover {
  background: hsl(var(--muted));
}
.ww-action-feedback__dismiss:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* Enter / leave */
.ww-action-feedback--enter .ww-action-feedback__backdrop {
  animation: ww-af-backdrop-in 0.28s ease-out both;
}
.ww-action-feedback--enter .ww-action-feedback__card {
  animation: ww-af-card-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.ww-action-feedback--leaving .ww-action-feedback__backdrop {
  animation: ww-af-backdrop-out 0.2s ease-in both;
}
.ww-action-feedback--leaving .ww-action-feedback__card {
  animation: ww-af-card-out 0.2s ease-in both;
}

@keyframes ww-af-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes ww-af-backdrop-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes ww-af-card-in {
  from { opacity: 0; transform: translateY(10px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ww-af-card-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(6px) scale(0.96); }
}

/* Animated check stroke */
.ww-action-feedback__circle {
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: ww-af-circle 0.45s ease-out 0.05s forwards;
}
.ww-action-feedback__check {
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: ww-af-check 0.35s ease-out 0.28s forwards;
}
@keyframes ww-af-circle {
  to { stroke-dashoffset: 0; }
}
@keyframes ww-af-check {
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ww-action-feedback--enter .ww-action-feedback__backdrop,
  .ww-action-feedback--enter .ww-action-feedback__card,
  .ww-action-feedback--leaving .ww-action-feedback__backdrop,
  .ww-action-feedback--leaving .ww-action-feedback__card,
  .ww-action-feedback__circle,
  .ww-action-feedback__check {
    animation: none !important;
  }
  .ww-action-feedback__circle,
  .ww-action-feedback__check {
    stroke-dashoffset: 0;
  }
}

/* Documents list — compact mobile rows + horizontal action scrub (table on md+) */
.ww-doc-mobile-list {
  display: block;
}

.ww-doc-mobile-row {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.55rem 0.85rem 0.45rem;
  border-bottom: 1px solid hsl(var(--border));
}

.ww-doc-mobile-row:last-child {
  border-bottom: 0;
}

.ww-doc-mobile-row__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  min-height: 1.15rem;
}

.ww-doc-mobile-row__id {
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.2;
  color: hsl(var(--foreground));
  text-align: left;
}

.ww-doc-mobile-row__party {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.25;
  color: hsl(var(--muted-foreground));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ww-doc-mobile-row__amount {
  flex-shrink: 0;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  line-height: 1.2;
}

.ww-doc-mobile-row__meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem 0.45rem;
  min-height: 1.15rem;
  font-size: 0.65rem;
  line-height: 1.2;
  color: hsl(var(--muted-foreground));
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ww-doc-mobile-row__meta::-webkit-scrollbar {
  display: none;
}

.ww-doc-mobile-row__meta .ww-badge,
.ww-doc-mobile-row__meta [class*="badge"] {
  flex-shrink: 0;
  transform: scale(0.92);
  transform-origin: left center;
}

.ww-doc-mobile-row__actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0.15rem 0 0.05rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
}

.ww-doc-mobile-row__actions::-webkit-scrollbar {
  display: none;
}

.ww-doc-mobile-row__actions > * {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.ww-doc-mobile-row__actions .ww-btn,
.ww-doc-mobile-row__actions button {
  min-height: 1.85rem !important;
  height: 1.85rem !important;
  width: 1.85rem !important;
  min-width: 1.85rem !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

.ww-doc-mobile-row__actions .ww-btn svg,
.ww-doc-mobile-row__actions button svg {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .ww-doc-mobile-list {
    display: none;
  }
}

.ww-doc-desktop-table {
  display: none;
}

@media (min-width: 768px) {
  .ww-doc-desktop-table {
    display: block;
  }
}
