/* ============================================================================
 * ninatrans-components.css  —  the `.wms-*` component library for FMS
 *
 * Load order: crm-skin.css (tokens) → ninatrans-theme.css (brand overlay) →
 * THIS FILE → ninatrans-buttons.css (§5.1 enforcement).
 *
 * WHY THIS FILE EXISTS
 * The spec (documentation/NINATRANS_UI_RULES.md) tells you to build pages from
 * `.wms-page-header`, `.wms-card`, `.wms-stat`, `.wms-status-pill`,
 * `.wms-info-list`, `.wms-timeline` and friends. Those base rules ship in
 * `wms-style.css`, which this project deliberately does not install — its
 * global `.table`, `.form-control`, `.badge` and bare `a` rules collide with
 * `style.css`. `ninatrans-theme.css` only carries the `--modifier` half of the
 * set. §1 covers the gap: "If the target project can't take new CSS files,
 * inline the token block from §2 plus the rules you need."
 *
 * So this file is our implementation of that component library. Every value
 * below comes from §2 (tokens), §3 (type scale) or a §5 component pattern —
 * nothing is invented. It follows the same conventions as
 * ninatrans-theme.css so the two read as one system.
 *
 * The second half re-skins FMS's own legacy class names onto the same tokens
 * (§8.3: "override, don't rewrite"), so pages that have not been rebuilt yet
 * still land on the palette.
 *
 * To revert: remove the single <link> in the base templates.
 * ========================================================================== */


/* ============================================================================
 * PART 1 — the `.wms-*` component library
 * ========================================================================== */

/* ---- §4  Page shell ------------------------------------------------------
 * FMS keeps its own 256px fixed sidebar and top bar, so only the content-side
 * pieces of the §4 skeleton are implemented here.
 * <main class="wms-content">
 *   <header class="wms-page-header">
 *     <div><h1 class="wms-page-title">…</h1><p class="wms-page-sub">…</p></div>
 *     <div class="wms-toolbar">…buttons…</div>
 *   </header>                                                                */
.wms-content {
  padding: 1.5rem;
}

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

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

.wms-page-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}

/* `.wms-toolbar` is defined in ninatrans-theme.css. */

/* ---- §5.2  Cards ---------------------------------------------------------
 * <div class="card wms-card">
 *   <div class="card-header">Section title</div>
 *   <div class="card-body">…</div>
 * </div>                                                                     */
.wms-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.wms-card > .card-header {
  padding: 0.85rem 1.1rem;
  background: hsl(var(--card));
  border-bottom: 1px solid hsl(var(--card-border));
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
}

/* A card header often wraps its text in a heading plus a subtitle rather than
   sitting bare, so both need to inherit the header's type rather than the
   browser's default h1–h6 sizing. */
.wms-card__title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.wms-card__sub {
  display: block;
  margin: 2px 0 0;
  font-size: 12.5px;
  font-weight: 400;
  color: hsl(var(--muted-foreground));
}

.wms-card > .card-body {
  padding: 1.1rem;
}

.wms-card > .card-body.p-0 {
  padding: 0;
}

.wms-card > .card-footer {
  padding: 0.8rem 1.1rem;
  background: hsl(var(--card));
  border-top: 1px solid hsl(var(--card-border));
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ---- §5.3 / §3  Tables ---------------------------------------------------
 * Density comes from ninatrans-theme.css; this is the header, foot and
 * numeric treatment from §3.                                                 */
.table > thead > tr > th {
  background: hsl(var(--muted));
  border-bottom: 1px solid hsl(var(--card-border));
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

.table > tbody > tr > td {
  font-size: 13px;
  border-bottom: 1px solid hsl(var(--card-border));
  color: hsl(var(--foreground));
  vertical-align: middle;
}

.table > tfoot > tr > td,
.table > tfoot > tr > th {
  background: hsl(var(--muted));
  border-top: 1px solid hsl(var(--card-border));
  font-size: 12.5px;
}

/* §3: codes, quantities and money are monospace with tabular numerals. */
.font-monospace,
.wms-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    'Liberation Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
}

.wms-num {
  white-space: nowrap;
}

/* A table wrapped in a card should not double up on borders. */
.wms-card > .card-body.p-0 > .table-responsive > .table,
.wms-card > .table-responsive > .table {
  margin-bottom: 0;
}

.wms-card > .card-body.p-0 > .table-responsive > .table > tbody > tr:last-child > td,
.wms-card > .table-responsive > .table > tbody > tr:last-child > td {
  border-bottom: 0;
}

/* ---- §5.4  Status pills --------------------------------------------------
 * <span class="wms-status-pill wms-status-pill--active">Active</span>
 * ninatrans-theme.css already ships --expected, --receiving, --completed,
 * --picking, --draft and --held; those are not repeated here.               */
.wms-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border: 0;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

/* green — done / positive */
.wms-status-pill--active,
.wms-status-pill--valid,
.wms-status-pill--complete,
.wms-status-pill--in-stock {
  background: hsl(var(--success-light));
  color: hsl(142 71% 26%);
}

/* amber — in progress / warning */
.wms-status-pill--pending,
.wms-status-pill--expiring,
.wms-status-pill--allocated {
  background: hsl(var(--warning-light));
  color: hsl(32 95% 30%);
}

/* red — blocked / failed */
.wms-status-pill--expired,
.wms-status-pill--overdue {
  background: hsl(var(--danger-light));
  color: hsl(0 70% 38%);
}

/* blue — informational */
.wms-status-pill--info,
.wms-status-pill--putaway {
  background: hsl(var(--info-light));
  color: hsl(217 91% 35%);
}

/* grey — inert */
.wms-status-pill--inactive,
.wms-status-pill--neutral {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

/* ---- §5.5  KPI / stat cards ----------------------------------------------
 * <div class="row g-3 wms-kpi-row">
 *   <div class="col"><div class="card wms-card wms-stat wms-kpi-card">
 *     <div class="card-body">
 *       <span class="wms-stat__icon"><i class="fa-solid fa-users"></i></span>
 *       <div class="wms-stat__label">Active headcount</div>
 *       <div class="wms-stat__value">642</div>
 *     </div>
 *   </div></div>
 * </div>
 * The variant class sits on the card and recolours the icon chip only.       */
.wms-kpi-card > .card-body {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.wms-stat__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  font-size: 1.3rem;
  /* §0 lists chips as a grey secondary surface. Keeping the default neutral
     also stops a plain count reading as an alert next to a status card. */
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

.wms-stat__icon i {
  color: inherit;
}

.wms-stat--success .wms-stat__icon {
  background: hsl(var(--success-light));
  color: hsl(142 71% 26%);
}

.wms-stat--warning .wms-stat__icon {
  background: hsl(var(--warning-light));
  color: hsl(32 95% 30%);
}

.wms-stat--alert .wms-stat__icon {
  background: hsl(var(--danger-light));
  color: hsl(0 70% 38%);
}

.wms-stat--primary .wms-stat__icon {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.wms-stat__value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}

.wms-stat__label {
  margin-top: 0.2rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: hsl(var(--muted-foreground));
}

/* ---- §5.8  Forms ---------------------------------------------------------
 * <div class="set-fld">
 *   <label>Field name<span class="req">*</span></label>
 *   <input class="form-control" placeholder="…">
 *   <div class="set-hint">Helper text</div>
 * </div>                                                                     */
.set-fld {
  margin-bottom: 0.9rem;
}

.set-fld > label,
.wms-label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}

.set-fld .req,
.wms-label .req {
  margin-left: 2px;
  color: hsl(var(--primary));
}

.set-hint {
  margin-top: 0.25rem;
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

/* ---- §5.9  Detail pages — info list --------------------------------------
 * <dl class="wms-info-list">
 *   <div class="wms-info-list__row"><dt>Label</dt><dd>Value</dd></div>
 * </dl>                                                                      */
.wms-info-list {
  margin: 0;
}

.wms-info-list__row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid hsl(var(--card-border));
}

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

.wms-info-list__row > dt {
  flex: 0 0 40%;
  max-width: 40%;
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.wms-info-list__row > dd {
  flex: 1;
  margin: 0;
  font-size: 13px;
  color: hsl(var(--foreground));
}

/* Uppercase label above value — the `.di` block from §5.9. */
.di {
  margin-bottom: 0.9rem;
}

.di__label {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: hsl(var(--muted-foreground));
}

.di__value {
  font-size: 13px;
  color: hsl(var(--foreground));
}

/* ---- §5.9  Detail pages — event timeline ---------------------------------
 * <ol class="wms-timeline">
 *   <li class="wms-timeline__item">
 *     <span class="wms-timeline__icon wms-timeline__icon--success"><i …></i></span>
 *     <div class="wms-timeline__body">…</div>
 *   </li>
 * </ol>                                                                      */
.wms-timeline {
  position: relative;
  margin: 0;
  padding: 0 0 0 0.25rem;
  list-style: none;
}

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

.wms-timeline__item:last-child {
  padding-bottom: 0;
}

/* The rail runs behind the icons, stopping at the last item. */
.wms-timeline__item:not(:last-child)::before {
  content: '';
  position: absolute;
  top: 28px;
  left: 13px;
  bottom: 0;
  width: 1px;
  background: hsl(var(--card-border));
}

.wms-timeline__icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 27px;
  height: 27px;
  border-radius: 999px;
  font-size: 11px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

.wms-timeline__icon i {
  color: inherit;
}

.wms-timeline__icon--primary {
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}

.wms-timeline__icon--success {
  background: hsl(var(--success-light));
  color: hsl(142 71% 26%);
}

.wms-timeline__icon--warning {
  background: hsl(var(--warning-light));
  color: hsl(32 95% 30%);
}

.wms-timeline__icon--danger {
  background: hsl(var(--danger-light));
  color: hsl(0 70% 38%);
}

.wms-timeline__icon--info {
  background: hsl(var(--info-light));
  color: hsl(217 91% 35%);
}

.wms-timeline__body {
  flex: 1;
  min-width: 0;
  padding-top: 3px;
}

.wms-timeline__title {
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.wms-timeline__meta {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

/* ---- Empty state ---------------------------------------------------------
 * Not a §5 component, but every listing in FMS needs one. Built only from §2
 * tokens so it stays inside the system.                                      */
.wms-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.wms-empty__icon {
  margin-bottom: 0.6rem;
  font-size: 1.8rem;
  color: hsl(var(--card-border));
}

.wms-empty__title {
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.wms-empty__text {
  margin: 0.15rem 0 0;
  font-size: 12.5px;
}


/* ---- Settings menu in the top bar ----------------------------------------
 * Sits left of the profile card and reuses the .crm-usermenu dropdown
 * mechanics, so there is one open/close behaviour in the header.            */
.crm-settings {
  padding: 0.35rem 0.55rem;
}

.crm-settings-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: hsl(var(--muted-foreground));
}

.crm-settings.open .crm-settings-icon,
.crm-settings:hover .crm-settings-icon {
  color: hsl(var(--primary));
}

.crm-settings-dropdown {
  min-width: 17rem;
  padding: 0.35rem 0.6rem 0.7rem;
}

/* Marks the current page in the profile menu, the way the nav does. */
.crm-usermenu-item.is-active {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  font-weight: 600;
}

.crm-usermenu-item.is-active i {
  color: hsl(var(--primary));
}

.crm-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.6rem 0;
}

.crm-settings-row__text {
  display: flex;
  flex-direction: column;
}

.crm-settings-row__title {
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.crm-settings-row .set-hint {
  margin-top: 0;
}

.crm-settings-row .wms-seg__item {
  padding: 0.35rem 0.6rem;
  font-size: 12px;
}

/* ---- §4  Header search ---------------------------------------------------
 * Side nav (vertical): full search field always visible in the topbar.
 * Top nav (horizontal): magnifier opens a dropdown panel so nav stays roomy.
 * ------------------------------------------------------------------------ */
.crm-topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 16rem;
  width: 16rem;
  max-width: 16rem;
}

.crm-topbar-search-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  background: #fff;
  color: hsl(var(--muted-foreground));
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.crm-topbar-search-toggle:hover,
.crm-topbar-search.is-open .crm-topbar-search-toggle {
  color: hsl(var(--primary));
  border-color: hsl(var(--primary) / 0.35);
  background: hsl(var(--primary) / 0.08);
}

/* Default (vertical / side nav): panel is the always-visible field. */
.crm-topbar-search-panel {
  position: static;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.crm-topbar-search-field {
  position: relative;
}

.crm-topbar-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--muted-foreground));
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 1;
}

.crm-topbar-search .crm-topbar-input {
  width: 100%;
  height: 2.35rem;
  padding: 0 0.75rem 0 2.1rem;
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  background: hsl(var(--muted));
  font-size: 0.84rem;
  color: hsl(var(--foreground));
  outline: none;
  opacity: 1;
  pointer-events: auto;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.crm-topbar-search .crm-topbar-input:focus {
  background: #fff;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.12);
}

.crm-topbar-search .crm-topbar-results {
  position: absolute;
  top: calc(100% + 6px);
  left: auto;
  right: 0;
  display: none;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: 320px;
  overflow-y: auto;
  margin-top: 0;
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-elevated, var(--shadow-card));
  z-index: 2200;
}

/* Horizontal nav: collapse to magnifier + dropdown panel. */
@media (min-width: 992px) {
  body.wms-nav-horizontal .crm-topbar-search {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
  }

  body.wms-nav-horizontal .crm-topbar-search-toggle {
    display: inline-flex;
  }

  body.wms-nav-horizontal .crm-topbar-search-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(22rem, calc(100vw - 1.5rem));
    padding: 0.65rem;
    background: #fff;
    border: 1px solid hsl(var(--card-border));
    border-radius: calc(var(--radius) + 2px);
    box-shadow: var(--shadow-elevated, var(--shadow-card));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    z-index: 2200;
  }

  body.wms-nav-horizontal .crm-topbar-search.is-open .crm-topbar-search-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  body.wms-nav-horizontal .crm-topbar-search .crm-topbar-results {
    position: static;
    width: auto;
    margin-top: 0.55rem;
    box-shadow: none;
  }
}

/* ---- §1/§4  Top-bar navigation (body.wms-nav-horizontal) -----------------
 * The sidebar's own <ul> is moved into `.wms-topnav` in the header by the
 * layout script; this styles it as a row of items with hover dropdowns. It is
 * moved rather than duplicated so the permission-gated menu exists once.
 *
 * Desktop only: below the 992px breakpoint base.html already turns the
 * sidebar into an off-canvas drawer, which is the right mobile behaviour.
 * ------------------------------------------------------------------------ */
.wms-topnav {
  display: none;
}

@media (min-width: 992px) {
  body.wms-nav-horizontal .wms-topnav {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 1rem;
    overflow: visible;
  }

  /* The sidebar shell is empty once its list has moved out. */
  body.wms-nav-horizontal .sidebar {
    display: none;
  }

  /* Bootstrap's .flex-column utility is !important, so this has to be too.
     Overflow stays visible: clipping either axis cuts off the dropdowns. */
  body.wms-nav-horizontal .wms-topnav > .nav {
    flex-direction: row !important;
    align-items: center;
    justify-content: flex-start;
    gap: 0.1rem;
    flex-wrap: nowrap;
    overflow: visible;
    margin: 0;
    padding: 0;
  }

  /* The Dashboard item carries inline padding meant for a vertical stack. */
  body.wms-nav-horizontal .wms-topnav > .nav > .nav-item {
    padding: 0 !important;
    flex-shrink: 0;
  }

  body.wms-nav-horizontal .wms-topnav .nav-link {
    padding: 0.4rem 0.65rem;
    white-space: nowrap;
    border-left: 0;
  }

  body.wms-nav-horizontal .wms-topnav .nav-category {
    position: relative;
    flex-shrink: 0;
  }

  body.wms-nav-horizontal .wms-topnav .nav-category-header {
    margin: 0;
    padding: 0.4rem 0.65rem;
    white-space: nowrap;
  }

  /* Chevron always points down: these are dropdowns, not accordions. */
  body.wms-nav-horizontal .wms-topnav .nav-category.collapsed .nav-category-toggle {
    transform: none;
  }

  /* Sidebar accordion state (collapsed, inline max-height) must not apply here. */
  body.wms-nav-horizontal .wms-topnav .nav-category.collapsed .nav-category-items,
  body.wms-nav-horizontal .wms-topnav .nav-category-items {
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible !important;
    height: auto !important;
  }

  /* max-height is set inline by the accordion script, so it needs overriding. */
  body.wms-nav-horizontal .wms-topnav .nav-category-items {
    position: absolute;
    top: calc(100% - 2px);
    left: 0;
    z-index: 1040;
    display: none;
    min-width: 15rem;
    padding: 0.35rem;
    padding-top: calc(0.35rem + 2px);
    background: hsl(var(--card));
    border: 1px solid hsl(var(--card-border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
  }

  /* Extends the category hit area below the header while the menu is open. */
  body.wms-nav-horizontal .wms-topnav .nav-category.is-open::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 0.75rem;
  }

  body.wms-nav-horizontal .wms-topnav .nav-category.is-open > .nav-category-items,
  body.wms-nav-horizontal .wms-topnav .nav-category:focus-within > .nav-category-items {
    display: block;
  }

  body.wms-nav-horizontal .wms-topnav .nav-category-header {
    cursor: default;
  }

  /* Only the header remains above the content — there is no second bar. */
  body.wms-nav-horizontal .main-content,
  body.wms-nav-horizontal .main-content.expanded {
    margin-left: 0;
    margin-top: var(--wms-header-height);
  }
}


/* ============================================================================
 * PART 2 — legacy FMS class names re-skinned onto the same tokens (§8.3)
 *
 * "Override, don't rewrite — write a small theme overlay that re-skins the
 * project's existing class names to the tokens in §2. Cascading from one file
 * beats editing every template, and future pages inherit it for free."
 *
 * These rules are scoped with `.crm-skin` (which sits on <body> in every base
 * template) purely for specificity: style.css declares them at (0,1,0) and
 * crm-skin.css at (0,2,0), and this file has to outrank both.
 *
 * Everything below can be deleted as each page is rebuilt onto Part 1.
 * ========================================================================== */

/* ---- Release-notes notice ----------------------------------------------- */
.release-notes-notice-wrap {
  padding: 1rem 1.5rem 0.75rem;
}

/* ---- Page header — reads as §4's .wms-page-header ------------------------ */
.crm-skin .admin-header {
  background: transparent;
  border: 0;
  border-bottom: 0;
  box-shadow: none;
  padding: 0;
  margin-bottom: 1.25rem;
}

.crm-skin .admin-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: hsl(var(--foreground));
  margin: 0;
}

.crm-skin .admin-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 400;
  color: hsl(var(--muted-foreground));
}

/* ---- Cards — read as §5.2's .wms-card ------------------------------------ */
.crm-skin .modern-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* §7 bans the hover lift. */
.crm-skin .modern-card:hover {
  transform: none;
  box-shadow: var(--shadow-card);
}

.crm-skin .card-header-modern {
  padding: 0.85rem 1.1rem;
  background: hsl(var(--card));
  border-bottom: 1px solid hsl(var(--card-border));
}

.crm-skin .card-title-modern {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.crm-skin .card-subtitle-modern {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
}

.crm-skin .card-body-modern {
  padding: 1.1rem;
}

.crm-skin .card-body-modern.p-0 {
  padding: 0;
}

/* ---- Tables — §3 header treatment and §5.3 density ----------------------- */
.crm-skin .modern-table-container {
  border: 0;
  border-radius: 0;
  overflow-x: auto;
}

.crm-skin .modern-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  background: hsl(var(--card));
}

.crm-skin .modern-table thead {
  background: hsl(var(--muted));
}

.crm-skin .modern-table th {
  padding: 0.7rem 0.95rem;
  background: hsl(var(--muted));
  border-bottom: 1px solid hsl(var(--card-border));
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

.crm-skin .modern-table td {
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid hsl(var(--card-border));
  font-size: 13px;
  color: hsl(var(--foreground));
  vertical-align: middle;
}

.crm-skin .modern-table tbody tr:hover {
  background: hsl(var(--primary) / 0.04);
}

.crm-skin .modern-table tbody tr:last-child td {
  border-bottom: 0;
}

/* ---- Form controls — §5.8 ------------------------------------------------ */
.crm-skin .form-group-modern {
  margin-bottom: 0.9rem;
}

.crm-skin .form-label-modern {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}

.crm-skin .form-control-modern {
  display: block;
  width: 100%;
  padding: 0.45rem 0.7rem;
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  font-size: 13px;
  color: hsl(var(--foreground));
  box-sizing: border-box;
}

.crm-skin .form-control-modern:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.13);
}

/* ---- Tabs — read as §5.6's segmented control ----------------------------- */
.crm-skin .modern-tabs-container {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.crm-skin .modern-tabs {
  background: hsl(var(--muted));
}

.crm-skin .modern-tab {
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.crm-skin .modern-tab:hover {
  background: hsl(var(--primary) / 0.08);
  color: hsl(var(--primary));
}

.crm-skin .modern-tab.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: none;
}

/* ---- Toolbar stat chips -------------------------------------------------- */
.crm-skin .stat-badge {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
}

/* ---- Bootstrap badges mapped onto the §5.4 palette ----------------------- */
.crm-skin .badge {
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 11.5px;
  font-weight: 600;
}

.crm-skin .badge.bg-success {
  background: hsl(var(--success-light)) !important;
  color: hsl(142 71% 26%) !important;
}

.crm-skin .badge.bg-warning {
  background: hsl(var(--warning-light)) !important;
  color: hsl(32 95% 30%) !important;
}

.crm-skin .badge.bg-danger {
  background: hsl(var(--danger-light)) !important;
  color: hsl(0 70% 38%) !important;
}

.crm-skin .badge.bg-info {
  background: hsl(var(--info-light)) !important;
  color: hsl(217 91% 35%) !important;
}

/* Bootstrap's "primary" is the brand, not a status, so it takes the brand
   tint rather than a second accent colour (§7). */
.crm-skin .badge.bg-primary {
  background: hsl(var(--primary) / 0.12) !important;
  color: hsl(var(--primary)) !important;
}

.crm-skin .badge.bg-secondary,
.crm-skin .badge.bg-light,
.crm-skin .badge.bg-dark {
  background: hsl(var(--muted)) !important;
  color: hsl(var(--muted-foreground)) !important;
}

/* ---- Alerts — solid tint with a left accent border (§8.5) ---------------- */
.crm-skin .alert {
  border: 0;
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
}

.crm-skin .alert-success {
  background: hsl(var(--success-light));
  border-left-color: hsl(var(--success));
  color: hsl(142 71% 26%);
}

.crm-skin .alert-warning {
  background: hsl(var(--warning-light));
  border-left-color: hsl(var(--warning));
  color: hsl(32 95% 30%);
}

.crm-skin .alert-danger {
  background: hsl(var(--danger-light));
  border-left-color: hsl(var(--danger));
  color: hsl(0 70% 38%);
}

.crm-skin .alert-info,
.crm-skin .alert-primary {
  background: hsl(var(--info-light));
  border-left-color: hsl(var(--info));
  color: hsl(217 91% 35%);
}

/* ---- Progress bars — brand red (§8.5) ------------------------------------ */
.crm-skin .progress {
  height: 6px;
  border-radius: 999px;
  background: hsl(var(--muted));
}

.crm-skin .progress-bar {
  background: hsl(var(--primary));
}

/* ---- Legacy component classes -------------------------------------------- */

/* §7: one accent only, and status colours are for status, never decoration.
   A fleet number and a vehicle type are identifiers, so they read as neutral
   chips; §3 puts codes in monospace with tabular numerals. */
.fleet-number,
.license-plate,
.vehicle-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.fleet-number,
.license-plate {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    'Liberation Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--foreground));
}

.vehicle-plate-cell {
  font-weight: 600;
}

.vehicle-brand-cell,
.vehicle-model-cell,
.vehicle-company-cell {
  color: hsl(var(--muted-foreground));
}

/* Inspection and expiry dates are genuine status, so they take the pill
   palette rather than the saturated solid fills they had. */
.date-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.6rem;
  border: 0;
  border-radius: 999px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  cursor: help;
}

.date-badge.valid {
  background: hsl(var(--success-light));
  color: hsl(142 71% 26%);
}

.date-badge.warning {
  background: hsl(var(--warning-light));
  color: hsl(32 95% 30%);
}

.date-badge.expired {
  background: hsl(var(--danger-light));
  color: hsl(0 70% 38%);
}

.date-badge.ignored {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

.vehicle-status-badge {
  padding: 0.22rem 0.6rem;
  border: 0;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.vehicle-status-badge.status-active {
  background: hsl(var(--success-light));
  color: hsl(142 71% 26%);
}

.vehicle-status-badge.status-maintenance {
  background: hsl(var(--warning-light));
  color: hsl(32 95% 30%);
}

.vehicle-status-badge.status-rented {
  background: hsl(var(--info-light));
  color: hsl(217 91% 35%);
}

/* FMS's own `.modern-table` is not a Bootstrap `.table`, so the theme's rules
   miss it. Give it the same §3 header treatment. */
.modern-table thead th {
  background: hsl(var(--muted));
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: hsl(var(--muted-foreground));
}

.modern-table tbody td {
  font-size: 13px;
}
