/* ============================================================================
 * Ninatrans WMS — desktop styles
 *
 * Aligned with the Ninatrans CRM design system: brand red `#B91C4D`, light
 * card-style shell, soft gradient background, subtle elevation. HSL values
 * mirror the CRM `:root` tokens so the two apps feel like one product.
 * ========================================================================== */

:root {
  /* ---- Brand / palette (HSL components — hsl(var(--token)) in rules) ---- */
  --background: 240 10% 98%;
  --foreground: 240 10% 8%;

  --card: 0 0% 100%;
  --card-foreground: 240 10% 8%;
  --card-border: 240 6% 90%;

  --primary: 338 95% 29%;
  --primary-foreground: 0 0% 100%;
  --primary-light: 338 95% 85%;
  --primary-dark: 338 95% 20%;

  --secondary: 240 5% 96%;
  --secondary-foreground: 240 6% 10%;

  --muted: 240 5% 96%;
  --muted-foreground: 240 4% 46%;

  --accent: 240 5% 96%;
  --accent-foreground: 240 6% 10%;

  --success: 142 76% 36%;
  --success-light: 142 76% 90%;
  --warning: 45 93% 58%;
  --warning-light: 45 93% 90%;
  --danger: 0 84% 60%;
  --danger-light: 0 84% 95%;
  --info: 217 91% 60%;
  --info-light: 217 91% 90%;

  --border: 240 6% 90%;
  --input: 240 6% 90%;
  --ring: 338 95% 29%;

  --radius: 0.5rem;

  --gradient-primary: linear-gradient(135deg, hsl(338 95% 29%), hsl(338 95% 20%));
  --gradient-subtle: linear-gradient(180deg, hsl(240 10% 99%), hsl(240 10% 96%));

  --shadow-card: 0 1px 3px hsl(240 5% 0% / 0.08), 0 1px 2px hsl(240 5% 0% / 0.04);
  --shadow-elevated: 0 4px 14px hsl(240 5% 0% / 0.08), 0 2px 4px hsl(240 5% 0% / 0.04);
  --shadow-primary: 0 4px 14px hsl(338 95% 29% / 0.18);

  --wms-header-height: 64px;
  --wms-sidebar-width: 256px;
}

* { box-sizing: border-box; }

body.wms-app {
  margin: 0;
  background: var(--gradient-subtle);
  color: hsl(var(--foreground));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ---- Bootstrap override: brand colours ---------------------------------- */
/* Bootstrap utility classes are reused everywhere, so we re-skin them here
   rather than swapping every template. Use HSL via the design tokens so a
   future theme change is a one-liner. */
.btn-primary {
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius);
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--gradient-primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px hsl(338 95% 29% / 0.25);
  color: hsl(var(--primary-foreground));
}
.btn-primary:disabled {
  background: hsl(var(--primary) / 0.6);
  border-color: hsl(var(--primary) / 0.6);
}

a { color: hsl(var(--primary)); }
a:hover { color: hsl(var(--primary-dark)); }

/* Tighter, more modern badges */
.badge { font-weight: 600; letter-spacing: 0.01em; }

/* ---- Tenant onboarding form ---------------------------------------------- */
.tenant-form__hero {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid hsl(var(--primary) / 0.18);
  border-radius: 12px;
  background: linear-gradient(135deg, hsl(var(--primary) / 0.08), hsl(var(--card)));
}

.tenant-form__hero-icon {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.14);
}

.tenant-form__section {
  border: 1px solid hsl(var(--card-border));
  border-radius: 12px;
  background: hsl(var(--card));
  padding: 1rem;
}

.tenant-form__section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin: 0 0 0.75rem;
}

.tenant-form__slug-wrap {
  display: flex;
  align-items: center;
}

.tenant-form__slug-prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(1.5em + 0.75rem + 2px);
  padding: 0 0.65rem;
  border: 1px solid hsl(var(--input));
  border-right: 0;
  border-top-left-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.8);
  font-size: 0.86rem;
}

.tenant-form__slug-wrap .form-control {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.tenant-copy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.tenant-copy-option {
  border: 1px solid hsl(var(--card-border));
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
  background: hsl(var(--muted) / 0.35);
  cursor: pointer;
}

.tenant-copy-option:hover {
  border-color: hsl(var(--primary) / 0.35);
  background: hsl(var(--primary) / 0.05);
}

.tenant-copy-option .form-check-label {
  font-weight: 600;
  color: hsl(var(--foreground));
}

.tenant-copy-option__hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.35;
}

.tenant-form__steps {
  margin: 0;
  padding-left: 1.05rem;
}

.tenant-form__steps li {
  margin-bottom: 0.45rem;
  color: hsl(var(--muted-foreground));
}

.tenant-form__steps li:last-child {
  margin-bottom: 0;
}

@media (max-width: 767.98px) {
  .tenant-copy-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Top header + horizontal navigation --------------------------------- */

.wms-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1035;
  background: hsl(var(--card));
  border-bottom: 1px solid hsl(var(--card-border));
  box-shadow: var(--shadow-card);
}

.wms-header__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--wms-header-height);
  padding: 0 1rem 0 1.25rem;
  min-width: 0;
  overflow: visible;
}

.wms-header__start {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.wms-header__end {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  margin-left: auto;
}

.wms-header__brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.wms-header__brand-logo {
  height: 2rem;
  width: auto;
  object-fit: contain;
}

.wms-header__toggle {
  display: none;
  background: transparent;
  border: 0;
  color: hsl(var(--foreground));
  font-size: 18px;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.wms-header__user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  flex-shrink: 0;
}

.wms-topnav {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  overflow: visible;
}

.wms-topnav__list {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: max-content;
  height: 100%;
}

.wms-topnav__list > li {
  display: flex;
  align-items: stretch;
}

.wms-topnav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  height: auto;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  transition: color 120ms ease, background 120ms ease;
}

.wms-topnav__link i {
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}

.wms-topnav__link:hover,
.wms-topnav__link:focus,
.wms-topnav__link.show {
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
}

.wms-topnav__link:hover i,
.wms-topnav__link:focus i,
.wms-topnav__link.show i {
  color: hsl(var(--primary));
}

.wms-topnav__link.is-active {
  color: hsl(var(--primary));
  font-weight: 600;
  background: hsl(var(--primary) / 0.12);
}

.wms-topnav__link.is-active i {
  color: hsl(var(--primary));
}

.wms-topnav__dropdown .dropdown-toggle::after {
  margin-left: 0.15rem;
  vertical-align: 0.1em;
}

.wms-topnav__dropdown {
  position: static;
}

.wms-topnav__menu {
  margin-top: 0.35rem;
  padding: 0.35rem;
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-elevated);
  min-width: 13rem;
  z-index: 1060;
}

.wms-topnav__menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13.5px;
  padding: 0.45rem 0.65rem;
}

.wms-topnav__menu .dropdown-item i {
  width: 16px;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.wms-topnav__menu .dropdown-item.active,
.wms-topnav__menu .dropdown-item:active {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.wms-topnav__menu .dropdown-item.active i,
.wms-topnav__menu .dropdown-item:active i {
  color: hsl(var(--primary));
}

/* ---- Vertical sidebar navigation ---------------------------------------- */

.wms-nav-section {
  margin: 1rem 0.85rem 0.35rem;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground) / 0.7);
}

.wms-nav-group {
  margin-bottom: 0.35rem;
}

.wms-nav-group__label {
  margin: 0.65rem 0.85rem 0.2rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: hsl(var(--muted-foreground));
}

.wms-nav-group__label.is-active {
  color: hsl(var(--primary));
}

.wms-sidenav__sublink {
  padding-left: 1.35rem;
  font-size: 13.5px;
}

.wms-sidenav__sublink i {
  display: none;
}

.wms-sidenav {
  position: fixed;
  top: var(--wms-header-height);
  left: 0;
  bottom: 0;
  width: var(--wms-sidebar-width);
  background: hsl(var(--card));
  border-right: 1px solid hsl(var(--card-border));
  box-shadow: 2px 0 18px hsl(240 5% 0% / 0.06);
  overflow-y: auto;
  z-index: 1030;
}

.wms-sidenav__nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.65rem 1.5rem;
  gap: 0.125rem;
}

.wms-sidenav__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius);
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: background 120ms ease, color 120ms ease, border-left-color 120ms ease;
}

.wms-sidenav__link i {
  width: 18px;
  text-align: center;
  font-size: 15px;
  color: hsl(var(--muted-foreground));
}

.wms-sidenav__link:hover {
  background: hsl(var(--primary) / 0.07);
  color: hsl(var(--primary));
  border-left-color: hsl(var(--primary) / 0.35);
}

.wms-sidenav__link:hover i {
  color: hsl(var(--primary));
}

.wms-sidenav__link.is-active {
  background: linear-gradient(135deg, hsl(var(--primary) / 0.12), hsl(var(--primary) / 0.06));
  color: hsl(var(--primary));
  border-left-color: hsl(var(--primary));
  font-weight: 600;
}

.wms-sidenav__link.is-active i {
  color: hsl(var(--primary));
}

.wms-sidenav__link .wms-nav-badge {
  margin-left: auto;
}

body.wms-nav-vertical .wms-main {
  margin-left: var(--wms-sidebar-width);
}

body.wms-nav-horizontal .wms-main {
  margin-left: 0;
}

/* ---- Main column -------------------------------------------------------- */

.wms-main {
  margin-top: var(--wms-header-height);
  min-height: calc(100vh - var(--wms-header-height));
  display: flex;
  flex-direction: column;
}

/* Settings cards (landing page) ----------------------------------------- */

.wms-settings-card {
  color: hsl(var(--foreground));
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.wms-settings-card:hover {
  transform: translateY(-1px);
  border-color: hsl(var(--primary) / 0.4);
  box-shadow: 0 6px 20px -10px hsl(var(--primary) / 0.5);
}
.wms-settings-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: hsl(var(--primary) / 0.08);
  color: hsl(var(--primary));
  flex-shrink: 0;
}
.wms-settings-card__icon i {
  font-size: 18px;
}

/* User profile menu (mirrors the CRM `.crm-usermenu` in FMS) ------------- */
.wms-usermenu {
  position: relative;
}

.wms-usermenu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background 120ms ease;
}
.wms-usermenu__trigger:hover {
  background: hsl(var(--accent));
}

.wms-usermenu__id {
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.wms-usermenu__name {
  font-weight: 500;
  font-size: 13px;
  color: hsl(var(--foreground));
}
.wms-usermenu__role {
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
}

.wms-usermenu__chev {
  font-size: 10px;
  color: hsl(var(--muted-foreground));
  transition: transform 200ms ease;
}
.wms-usermenu.is-open .wms-usermenu__chev {
  transform: rotate(180deg);
}

.wms-usermenu__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 14rem;
  display: none;
  padding: 0.35rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-elevated);
  z-index: 1050;
}
.wms-usermenu.is-open .wms-usermenu__dropdown {
  display: block;
}

.wms-usermenu__label {
  padding: 0.4rem 0.6rem;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
  font-weight: 700;
}

.wms-usermenu__item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  font-size: 13px;
  color: hsl(var(--foreground));
  text-decoration: none;
  cursor: pointer;
  text-align: left;
}
.wms-usermenu__item i {
  width: 16px;
  text-align: center;
  color: hsl(var(--muted-foreground));
}
.wms-usermenu__item:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.wms-usermenu__item--danger,
.wms-usermenu__item--danger i {
  color: hsl(var(--danger));
}
.wms-usermenu__item--danger:hover {
  background: hsl(var(--danger) / 0.08);
  color: hsl(var(--danger));
}

.wms-usermenu__sep {
  height: 1px;
  background: hsl(var(--card-border));
  margin: 0.3rem 0;
}

/* Round avatar with brand-red initials */
.wms-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.wms-content {
  flex: 1;
  padding: 1.75rem;
  max-width: 100%;
}

.wms-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.wms-page-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.wms-flash-stack {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ---- Cards -------------------------------------------------------------- */

.wms-card,
.card.wms-card,
.crm-skin .card {
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  box-shadow: var(--shadow-card);
}

.wms-card .card-header {
  background: transparent;
  border-bottom: 1px solid hsl(var(--card-border));
  font-weight: 600;
  padding: 0.85rem 1.1rem;
}

/* ---- Tables (CRM-aligned global style) ---------------------------------- */

.table-responsive {
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  box-shadow: var(--shadow-card);
  overflow: auto;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: hsl(var(--foreground));
  --bs-table-border-color: hsl(var(--card-border));
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  padding: 0.65rem 0.85rem;
  border-bottom-color: hsl(var(--card-border));
}

.table > thead,
.table-light {
  --bs-table-bg: hsl(var(--muted));
  --bs-table-color: hsl(var(--muted-foreground));
}

.table > thead th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  border-bottom: 1px solid hsl(var(--card-border));
  white-space: nowrap;
}

.table > tbody td {
  color: hsl(var(--foreground));
}

.table > tfoot th,
.table > tfoot td {
  background: hsl(var(--muted) / 0.65);
  font-weight: 600;
}

.table-hover > tbody > tr:hover > * {
  background: hsl(var(--muted));
}

.table-sm > :not(caption) > * > * {
  padding: 0.5rem 0.7rem;
}

/* Micro-pass: table typography by context ---------------------------------- */
/* Most operational listing pages use `table-hover`; keep them compact. */
.table.table-hover:not(.wms-table-finance) > :not(caption) > * > * {
  padding: 0.55rem 0.75rem;
}

.table.table-hover:not(.wms-table-finance) > thead th {
  font-size: 11px;
  letter-spacing: 0.045em;
}

/* Finance tables (invoicing/pricelists): slightly roomier and clearer totals. */
.table.wms-table-finance > :not(caption) > * > * {
  padding: 0.75rem 0.95rem;
}

.table.wms-table-finance > thead th {
  font-size: 11.25px;
}

.table.wms-table-finance .text-end,
.table.wms-table-finance td[data-money] {
  font-variant-numeric: tabular-nums;
}

/* Action-column buttons stay visually consistent in all table contexts. */
.table td.text-end .btn.btn-sm {
  min-width: 2rem;
}

/* ---- Stat cards (dashboard) -------------------------------------------- */

.wms-stat .card-body { padding: 1.25rem; }

.wms-stat__icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: hsl(var(--primary) / 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--primary));
  margin-bottom: 0.75rem;
}

.wms-stat__label {
  color: hsl(var(--muted-foreground));
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.wms-stat__value {
  font-size: 28px;
  font-weight: 700;
  color: hsl(var(--foreground));
}

/* Keep KPI cards visually identical even when labels wrap differently. */
.wms-kpi-row .wms-kpi-card {
  min-height: 110px;
}

.wms-kpi-row .wms-kpi-card .card-body {
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem 1.1rem;
}

.wms-kpi-row .wms-stat__label {
  min-height: 2.2em;
  line-height: 1.1;
  margin-bottom: 0.45rem;
}

.wms-kpi-row .wms-stat__value {
  line-height: 1;
}

.wms-stat--alert .wms-stat__icon {
  background: hsl(var(--danger) / 0.1);
  color: hsl(var(--danger));
}
.wms-stat--success .wms-stat__icon {
  background: hsl(var(--success) / 0.1);
  color: hsl(var(--success));
}
.wms-stat--warning .wms-stat__icon {
  background: hsl(var(--warning) / 0.15);
  color: hsl(45 93% 35%);
}

/* ---- Activity feed icons ----------------------------------------------- */

.wms-feed-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  flex-shrink: 0;
  font-size: 14px;
}
.wms-feed-icon--success {
  background: hsl(var(--success) / 0.1);
  color: hsl(var(--success));
}
.wms-feed-icon--info {
  background: hsl(var(--info) / 0.1);
  color: hsl(var(--info));
}
.wms-feed-icon--primary {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

/* ---- Nav badges (dropdown items) --------------------------------------- */

.wms-topnav__menu .dropdown-item {
  position: relative;
}

.wms-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: hsl(var(--primary));
  color: #fff;
}
.wms-nav-badge:empty,
.wms-nav-badge[data-count="0"] {
  display: none;
}

/* ---- Global search input in header bar --------------------------------- */

.wms-header__search {
  position: relative;
  flex: 0 1 14rem;
  width: 14rem;
  max-width: 14rem;
  margin: 0;
}
.wms-header__search input.form-control {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.85rem 0 2.25rem;
  border-radius: var(--radius);
  background: hsl(var(--muted));
  border-color: hsl(var(--card-border));
}
.wms-header__search input.form-control:focus {
  background: hsl(var(--card));
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.12);
}
.wms-header__search i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--muted-foreground));
  pointer-events: none;
}
@media (max-width: 640px) {
  .wms-header__search {
    max-width: none;
  }
}

/* ---- Form polish -------------------------------------------------------- */

.form-control,
.form-select {
  border-color: hsl(var(--input));
}
.form-control:focus,
.form-select:focus {
  border-color: hsl(var(--ring) / 0.4);
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}

/* Select2 parity with Bootstrap form-select controls. */
select.form-select + .select2 {
  width: 100% !important;
}

select.form-select + .select2 .select2-selection--single {
  height: calc(1.5em + 0.75rem + 2px);
  border: 1px solid hsl(var(--input));
  border-radius: 0.375rem;
}

select.form-select + .select2 .select2-selection--single .select2-selection__rendered {
  line-height: calc(1.5em + 0.75rem);
  padding-left: 0.75rem;
  color: hsl(var(--foreground));
}

select.form-select + .select2 .select2-selection--single .select2-selection__arrow {
  height: calc(1.5em + 0.75rem);
  right: 0.35rem;
}

select.form-select.form-select-sm + .select2 .select2-selection--single {
  height: calc(1.5em + 0.5rem + 2px);
}

select.form-select.form-select-sm + .select2 .select2-selection--single .select2-selection__rendered {
  line-height: calc(1.5em + 0.5rem);
  font-size: 0.875rem;
}

select.form-select + .select2 .select2-selection--multiple {
  min-height: calc(1.5em + 0.75rem + 2px);
  border: 1px solid hsl(var(--input));
  border-radius: 0.375rem;
}

select.form-select.form-select-sm + .select2 .select2-selection--multiple {
  min-height: calc(1.5em + 0.5rem + 2px);
}

select.form-select + .select2.select2-container--focus .select2-selection--single,
select.form-select + .select2.select2-container--focus .select2-selection--multiple {
  border-color: hsl(var(--ring) / 0.4);
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}

/* Select2 dropdown must stack above Bootstrap modals (z-index 1055). */
.select2-container--open {
  z-index: 1060 !important;
}

.select2-dropdown {
  z-index: 1060 !important;
}

.modal .select2-dropdown {
  z-index: 1 !important;
}

/* ---- Login screen (split panel, matches CRM Auth.tsx) ------------------ */

body.wms-login-page {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  background: hsl(var(--background));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: hsl(var(--foreground));
}

.wms-login {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.wms-login__panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.wms-login__form-wrap {
  width: min(448px, 100%);
}

.wms-login__logo {
  height: 64px;
  width: auto;
  margin-bottom: 2rem;
}

.wms-login__title {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: hsl(var(--foreground));
}

.wms-login__subtitle {
  color: hsl(var(--muted-foreground));
  font-size: 18px;
  margin-bottom: 2rem;
}

.wms-login__form .form-label {
  font-weight: 500;
  font-size: 13px;
  color: hsl(var(--foreground));
}

.wms-login__form .btn-primary {
  height: 56px;
  font-size: 16px;
  font-weight: 600;
  background: #b91c4d;
  border-color: #b91c4d;
}

.wms-login__form .btn-primary:hover,
.wms-login__form .btn-primary:focus,
.wms-login__form .btn-primary:active {
  background: #9a1741 !important;
  border-color: #9a1741 !important;
}

.wms-login__hero {
  flex: 1;
  display: none;
  position: relative;
  padding: 3rem;
  color: #fff;
  overflow: hidden;
}
@media (min-width: 992px) {
  .wms-login__hero { display: flex; flex-direction: column; justify-content: space-between; }
}

.wms-login__hero-bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
}
.wms-login__hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(185, 28, 77, 0.9), rgba(154, 23, 65, 0.85));
}
.wms-login__hero > *:not(.wms-login__hero-bg):not(.wms-login__hero-overlay) {
  position: relative;
  z-index: 1;
}

.wms-login__hero-title {
  font-size: 48px;
  font-weight: 700;
  margin: 0;
  line-height: 1;
}

.wms-login__hero-subtitle {
  font-size: 20px;
  font-weight: 600;
  opacity: 0.9;
  margin: 1rem 0 0;
}

.wms-login__hero-lead {
  font-size: 18px;
  line-height: 1.6;
  max-width: 448px;
  opacity: 0.8;
  margin: 1rem 0 0;
}

.wms-login__features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 2rem;
  max-width: 672px;
}

.wms-login__feature {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.wms-login__feature i {
  font-size: 18px;
  margin-bottom: 0.5rem;
  display: block;
}

.wms-login__hero-footer {
  font-size: 14px;
  opacity: 0.7;
}

.wms-login__info {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: hsl(var(--muted) / 0.6);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  font-size: 13.5px;
  color: hsl(var(--muted-foreground));
}
.wms-login__info i {
  color: hsl(var(--danger));
  margin-top: 2px;
}

/* ---- Responsive horizontal nav ----------------------------------------- */

@media (max-width: 992px) {
  .wms-header__toggle {
    display: inline-flex;
  }

  .wms-header__bar {
    flex-wrap: wrap;
    padding: 0 0.75rem;
  }

  .wms-header__end {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0;
  }

  .wms-header__search {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
  }

  body.wms-nav-horizontal .wms-topnav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex: none;
    height: auto;
    max-height: calc(100vh - var(--wms-header-height));
    overflow-y: auto;
    background: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--card-border));
    box-shadow: var(--shadow-elevated);
  }

  body.wms-nav-horizontal .wms-topnav.is-open {
    display: block;
  }

  body.wms-nav-vertical .wms-sidenav {
    transform: translateX(-100%);
    transition: transform 200ms ease;
    z-index: 1040;
    top: 0;
    height: 100vh;
  }

  body.wms-nav-vertical .wms-sidenav.is-open {
    transform: translateX(0);
  }

  body.wms-nav-vertical .wms-main {
    margin-left: 0;
  }

  body.wms-nav-horizontal .wms-topnav__list {
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    padding: 0.5rem;
    gap: 0.15rem;
  }

  .wms-topnav__list > li {
    display: block;
  }

  .wms-topnav__link {
    width: 100%;
    height: auto;
    padding: 0.65rem 0.85rem;
    border-bottom: 0;
    border-radius: var(--radius);
  }

  body.wms-nav-horizontal .wms-topnav__link.is-active,
  body.wms-nav-horizontal .wms-topnav__link.show {
    border-bottom: 0;
    background: hsl(var(--primary) / 0.1);
  }

  body.wms-nav-horizontal .wms-topnav__dropdown .dropdown-menu {
    position: static !important;
    transform: none !important;
    float: none;
    width: 100%;
    margin: 0.15rem 0 0.35rem 0.75rem;
    box-shadow: none;
    border: 0;
    background: transparent;
    padding: 0;
  }

  .wms-usermenu__id {
    display: none !important;
  }

  .wms-page-title {
    font-size: 1.15rem;
  }
}

/* ---- Stock pallet detail page ------------------------------------------ */

.wms-detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  flex-wrap: wrap;
}

.wms-detail-breadcrumb__link {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.wms-detail-breadcrumb__link:hover {
  color: hsl(var(--primary));
}

.wms-detail-breadcrumb__sep {
  color: hsl(var(--border));
}

.wms-detail-breadcrumb__current {
  color: hsl(var(--foreground));
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.wms-detail-hero {
  border-left: 4px solid hsl(var(--primary));
}

.wms-detail-hero__sscc {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
}

.wms-detail-hero__product {
  font-size: 15px;
  color: hsl(var(--foreground));
}

.wms-detail-hero__meta {
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}

.wms-detail-hero__qty {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}

.wms-detail-hero__uom {
  font-size: 0.95rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  margin-left: 0.25rem;
}

.wms-detail-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 500;
}

.wms-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.wms-status-pill--sm {
  font-size: 11px;
  padding: 0.15rem 0.5rem;
}

.wms-status-pill--received  { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.wms-status-pill--putaway   { background: hsl(var(--info-light)); color: hsl(217 91% 35%); }
.wms-status-pill--in-stock  { background: hsl(var(--success-light)); color: hsl(var(--success)); }
.wms-status-pill--blocked   { background: hsl(0 85% 96%); color: hsl(0 70% 38%); }
.wms-status-pill--allocated { background: hsl(var(--warning-light)); color: hsl(32 95% 30%); }
.wms-status-pill--picked    { background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); }
.wms-status-pill--dispatched { background: hsl(var(--foreground) / 0.08); color: hsl(var(--foreground)); }
.wms-status-pill--neutral   { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }

.wms-stat__value--sm {
  font-size: 1.05rem;
  line-height: 1.3;
}

.wms-lifecycle {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.wms-lifecycle__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 72px;
  flex-shrink: 0;
}

.wms-lifecycle__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
}

.wms-lifecycle__step.is-complete .wms-lifecycle__dot,
.wms-lifecycle__step.is-current .wms-lifecycle__dot {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.wms-lifecycle__step.is-current .wms-lifecycle__dot {
  box-shadow: 0 0 0 4px hsl(var(--primary) / 0.15);
}

.wms-lifecycle__label {
  font-size: 11px;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-align: center;
  white-space: nowrap;
}

.wms-lifecycle__step.is-current .wms-lifecycle__label,
.wms-lifecycle__step.is-complete .wms-lifecycle__label {
  color: hsl(var(--foreground));
}

.wms-lifecycle__connector {
  flex: 1 1 auto;
  height: 2px;
  background: hsl(var(--border));
  margin-top: 13px;
  min-width: 12px;
}

.wms-lifecycle__connector.is-complete {
  background: hsl(var(--primary));
}

.wms-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.wms-timeline__item {
  display: flex;
  gap: 1rem;
  padding-bottom: 1.35rem;
  position: relative;
}

.wms-timeline__item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 40px;
  bottom: 0;
  width: 2px;
  background: hsl(var(--border));
}

.wms-timeline__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  z-index: 1;
}

.wms-timeline__icon--success { background: hsl(var(--success-light)); color: hsl(var(--success)); }
.wms-timeline__icon--info    { background: hsl(var(--info-light)); color: hsl(var(--info)); }
.wms-timeline__icon--warning { background: hsl(var(--warning-light)); color: hsl(32 95% 35%); }
.wms-timeline__icon--primary { background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); }
.wms-timeline__icon--danger  { background: hsl(var(--danger-light)); color: hsl(var(--danger)); }

.wms-timeline__body {
  flex: 1;
  min-width: 0;
  padding-top: 0.15rem;
}

.wms-timeline__title {
  font-weight: 600;
  font-size: 14px;
  color: hsl(var(--foreground));
  margin-bottom: 0.15rem;
}

.wms-timeline__detail {
  font-size: 13px;
  color: hsl(var(--muted-foreground));
  line-height: 1.45;
}

.wms-timeline__link {
  display: inline-block;
  margin-top: 0.35rem;
  text-decoration: none;
}

.wms-timeline__meta {
  flex-shrink: 0;
}

.wms-info-list__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid hsl(var(--card-border));
}

.wms-info-list__row:last-child {
  border-bottom: 0;
}

.wms-info-list__row dt {
  font-size: 12px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

.wms-info-list__row dd {
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  margin: 0;
}

.wms-detail-grid .wms-detail-field {
  height: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  background: hsl(var(--muted) / 0.35);
}

.wms-detail-field__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.35rem;
}

.wms-detail-field__value {
  font-size: 15px;
  font-weight: 600;
  color: hsl(var(--foreground));
  line-height: 1.35;
  word-break: break-word;
}

.wms-detail-field__value--lg {
  font-size: 1.35rem;
  font-weight: 700;
}

.wms-detail-field__value--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  letter-spacing: 0.02em;
}

/* Compact header filters for list views */
.wms-list-filters {
  margin-bottom: 0;
}

.wms-list-filter-row th {
  padding: 0.45rem 0.5rem;
  background: hsl(var(--card));
  border-top: 0;
}

.wms-list-filter-row .form-control,
.wms-list-filter-row .form-select {
  font-size: 12px;
  min-height: 30px;
  padding: 0.25rem 0.45rem;
}

/* In-app documentation */
.wms-docs-nav-card {
  position: sticky;
  top: 1rem;
}

.wms-docs-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.wms-docs-nav__link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--foreground));
  text-decoration: none;
}

.wms-docs-nav__link:hover {
  background: hsl(var(--muted) / 0.55);
  color: hsl(var(--foreground));
}

.wms-docs-nav__link.is-active {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.wms-docs-nav__link i {
  width: 1.1rem;
  text-align: center;
  opacity: 0.85;
}

.wms-docs-body {
  font-size: 14px;
  line-height: 1.6;
  color: hsl(var(--foreground));
}

.wms-docs-body .lead {
  font-size: 15px;
}

.wms-docs-heading {
  margin-top: 1.5rem;
  margin-bottom: 0.65rem;
  font-size: 1rem;
  font-weight: 600;
}

.wms-docs-heading:first-of-type {
  margin-top: 0;
}

.wms-docs-list {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.wms-docs-list li {
  margin-bottom: 0.35rem;
}

.wms-docs-tip {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  background: hsl(var(--muted) / 0.45);
  border-left: 3px solid hsl(var(--primary));
  font-size: 13px;
  color: hsl(var(--foreground));
}

.wms-docs-tip i {
  color: hsl(var(--primary));
  margin-top: 0.15rem;
}
