/*
 * Wemasoft E-Procurement Design System
 * Version 1.1 — April 2026 (Mobile-responsive update)
 * ─────────────────────────────────────────────────────────────
 * Usage: <link rel="stylesheet" href="wemasoft-design-system.css">
 * Breakpoints:
 *   Mobile  : < 768px  → hamburger drawer + scrollable sub-tabs
 *   Tablet  : 768–1024px → condensed top nav
 *   Desktop : > 1024px → full horizontal nav
 * ─────────────────────────────────────────────────────────────
 */



:root {
  --wn-primary:        #2a9147;
  --wn-primary-dark:   #1f7238;
  --wn-primary-light:  #e8f7ed;
  --wn-primary-muted:  rgba(42, 145, 71, 0.12);

  --wn-bg:             #f4f5f7;
  --wn-surface:        #ffffff;
  --wn-border:         #eaecef;
  --wn-border-strong:  #d0d3d9;

  --wn-text-primary:   #1a1a2e;
  --wn-text-secondary: #555770;
  --wn-text-muted:     #8a8fa8;

  --wn-success-bg:   #e8f7ed; --wn-success-text: #1a7a3c;
  --wn-warning-bg:   #fff8e1; --wn-warning-text: #a06000;
  --wn-danger-bg:    #fce8e8; --wn-danger-text:  #a01a1a;
  --wn-info-bg:      #e8f0fb; --wn-info-text:    #1a4fa0;
  --wn-danger-vivid: #e53935;

  --wn-font:           'Segoe UI', system-ui, -apple-system, sans-serif;
  --wn-font-size-xs:   10px;
  --wn-font-size-sm:   11px;
  --wn-font-size-base: 12px;
  --wn-font-size-md:   13px;
  --wn-font-size-lg:   15px;
  --wn-font-size-xl:   18px;
  --wn-font-size-2xl:  22px;

  --wn-space-xs: 4px;  --wn-space-sm: 8px;
  --wn-space-md: 12px; --wn-space-lg: 16px;
  --wn-space-xl: 20px; --wn-space-2xl: 28px;

  --wn-radius-sm: 4px; --wn-radius-md: 6px;
  --wn-radius-lg: 8px; --wn-radius-pill: 100px;

  --wn-topbar-height: 48px;
  --wn-subnav-height: 40px;
  --wn-drawer-width:  260px;
  --wn-transition:    0.15s ease;
  --wn-drawer-trans:  0.25s ease;
}


/* ─── 2. RESET & BASE ──────────────────────────────────────── */

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

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


/* ─── 20. UTILITY CLASSES ──────────────────────────────────── */

.wn-text-primary   { color: var(--wn-text-primary); }
.wn-text-secondary { color: var(--wn-text-secondary); }
.wn-text-muted     { color: var(--wn-text-muted); }
.wn-text-brand     { color: var(--wn-primary); }
.wn-text-danger    { color: var(--wn-danger-vivid); }

.wn-fw-normal { font-weight: 400; }
.wn-fw-medium { font-weight: 500; }
.wn-fw-bold   { font-weight: 700; }

.wn-flex         { display: flex; }
.wn-flex-center  { display: flex; align-items: center; }
.wn-flex-between { display: flex; align-items: center; justify-content: space-between; }
.wn-flex-wrap    { flex-wrap: wrap; }
.wn-gap-xs { gap: var(--wn-space-xs); }
.wn-gap-sm { gap: var(--wn-space-sm); }
.wn-gap-md { gap: var(--wn-space-md); }
.wn-gap-lg { gap: var(--wn-space-lg); }
.wn-mt-sm { margin-top: var(--wn-space-sm); }
.wn-mt-md { margin-top: var(--wn-space-md); }
.wn-mt-lg { margin-top: var(--wn-space-lg); }
.wn-mb-sm { margin-bottom: var(--wn-space-sm); }
.wn-mb-md { margin-bottom: var(--wn-space-md); }
.wn-mb-lg { margin-bottom: var(--wn-space-lg); }

.wn-hidden-mobile  { }
.wn-hidden-desktop { display: none; }

@media (max-width: 767px) {
  .wn-hidden-mobile  { display: none !important; }
  .wn-hidden-desktop { display: block; }
}

.wn-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}





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

:root {
  --teal: #1D9E75;
  --teal-dark: #0F6E56;
  --teal-light: #E1F5EE;
  --teal-mid: #5DCAA5;
  --amber: #EF9F27;
  --amber-light: #FAEEDA;
  --amber-dark: #854F0B;
  --red: #E24B4A;
  --red-light: #FCEBEB;
  --red-dark: #A32D2D;
  --blue: #378ADD;
  --blue-light: #E6F1FB;
  --blue-dark: #185FA5;
  --gray: #B4B2A9;
  --gray-light: #F1EFE8;
  --gray-dark: #5F5E5A;
  --bg: #f0efeb;
  --surface: #ffffff;
  --surface2: #f7f6f2;
  --text: #1a1a18;
  --text2: #5f5e5a;
  --text3: #8a8980;
  --border: rgba(0, 0, 0, 0.09);
  --border2: rgba(0, 0, 0, 0.16);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}


/* ── NAV ── */
/*
.top-nav {
  background: var(--teal);
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 20px;
  text-decoration: none;
}

.logo-circle {
  width: 36px;
  height: 36px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--teal);
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  flex: 1;
}

.nav-link {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  padding: 0 14px;
  height: 56px;
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-link.active-nav {
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  font-weight: 500;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.nav-right a {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  text-decoration: none;
}

.nav-right a:hover {
  color: #fff;
}

.nav-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.nav-item.dropdown:hover .dropdown-menu-custom {
  display: block;
}

.dropdown-menu-custom {
  display: none;
  position: absolute;
  top: 56px;
  left: 0;
  background: var(--surface);
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 8px 0;
  list-style: none;
  z-index: 200;
}

.dropdown-menu-custom li a {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  transition: background .1s;
}

.dropdown-menu-custom li a:hover {
  background: var(--surface2);
  color: var(--teal-dark);
}
*/
/* ── TAB STRIP ── */
.tab-strip {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  gap: 0;
  position: sticky;
  top: 56px;
  z-index: 90;
  box-shadow: 0 1px 0 var(--border);
}

.tab-btn {
  padding: 0 20px;
  height: 44px;
  font-size: 13px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text2);
  font-weight: 400;
  transition: color .15s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--teal-dark);
  border-bottom-color: var(--teal);
  font-weight: 500;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
}

.main {
  padding: 20px 24px 40px;
  max-width: 1280px;
  margin: 0 auto;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.section-hd {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-hd::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border2);
}

.alert-bar {
  background: var(--red-light);
  border: 1px solid #f7c1c1;
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--red-dark);
}

.alert-bar strong {
  font-weight: 600;
}

.alert-bar-amber {
  background: var(--amber-light);
  border-color: #FAC775;
  color: var(--amber-dark);
}

.ops-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.ops-grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ops-grid-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .ops-grid-5, .ops-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .ops-grid-5, .ops-grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.ops-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px 12px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
  position: relative;
  overflow: hidden;
}

.ops-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border2);
}

.ops-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--teal);
  opacity: 0;
  transition: opacity .15s;
}

.ops-card:hover::before {
  opacity: 1;
}

.ops-card.has-alert::before {
  opacity: 1;
  background: var(--red);
}

.ops-card.has-warn::before {
  opacity: 1;
  background: var(--amber);
}

.ops-card-label {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 6px;
  font-weight: 400;
}

.ops-card-value {
  font-size: 34px;
  font-weight: 600;
  color: var(--teal);
  line-height: 1;
  margin-bottom: 8px;
}

.ops-card-value.zero {
  color: var(--gray);
}

.ops-card-sub {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sub-ok {
  color: var(--teal-dark);
}

.sub-warn {
  color: var(--amber-dark);
  font-weight: 500;
}

.sub-alert {
  color: var(--red-dark);
  font-weight: 500;
}

.sub-muted {
  color: var(--text3);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-r {
  background: var(--red);
}

.dot-a {
  background: var(--amber);
}

.dot-g {
  background: var(--teal);
}

.dot-m {
  background: var(--gray);
}

/* ── BOTTOM ROW ── */
.ops-bottom {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 12px;
  margin-top: 4px;
}

@media (max-width: 900px) {
  .ops-bottom {
    grid-template-columns: 1fr;
  }
}

.pq-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.pq-header {
  background: var(--teal);
  padding: 12px 16px;
}

.pq-header-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.pq-header-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 1px;
}

.pq-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  transition: background .1s;
}

.pq-item:hover {
  background: var(--surface2);
}

.pq-item:last-child {
  border-bottom: none;
}

.pq-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 8px;
  flex-shrink: 0;
}

.pq-title {
  flex: 1;
  color: var(--text);
  font-weight: 500;
}

.pq-meta {
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
}

/* ── SHORTCUTS ── */
.sc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.sc-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
}

.sc-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  color: var(--blue-dark);
  font-size: 12px;
  text-decoration: none;
  transition: background .1s;
  margin-bottom: 2px;
  cursor: pointer;
}

.sc-link:hover {
  background: var(--blue-light);
}

.sc-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

/* ── INTEL PANELS ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.kpi {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  border: 1px solid var(--border);
}

.kpi-l {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 3px;
}

.kpi-v {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text);
}

.kpi-s {
  font-size: 11px;
  color: var(--text2);
}

.up {
  color: var(--teal-dark);
}

.dn {
  color: var(--red-dark);
}

.wn {
  color: var(--amber-dark);
}

.intel-alerts {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ialert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.ialert-c {
  background: var(--red-light);
  color: var(--red-dark);
  border: 1px solid #f7c1c1;
}

.ialert-w {
  background: var(--amber-light);
  color: var(--amber-dark);
  border: 1px solid #fac775;
}

.ialert-i {
  background: var(--blue-light);
  color: var(--blue-dark);
  border: 1px solid #b5d4f4;
}

.ialert-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ialert-c .ialert-dot {
  background: var(--red-dark);
}

.ialert-w .ialert-dot {
  background: var(--amber-dark);
}

.ialert-i .ialert-dot {
  background: var(--blue-dark);
}

.ialert-act {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}

.charts-2 {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 10px;
  margin-bottom: 10px;
}

.charts-eq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}



@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    margin-left: auto;
    padding: 4px 8px;
  }


  .mobile-collapse {
    display: none !important;;
    position: absolute;
    top: 56px;
    left: 0;
    width: 100%;
    background: var(--teal);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    flex-direction: column;
    padding-bottom: 16px;
  }
  /*
  .top-nav {
    position: relative;
    justify-content: space-between;
    padding: 0 16px;
  }

  .top-nav.nav-open .mobile-collapse {
    display: flex !important;
  }

  .nav-links {
    display: flex;
    width: 100%;
    flex-direction: column;
    margin: 0;
  }

  .nav-link {
    height: auto;
    padding: 12px 20px;
    width: 100%;*/
  }

  .nav-right {
    display: flex;
    margin-top: 10px;
    padding: 15px 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .dropdown-menu-custom {
    position: static;
    box-shadow: none;
    border: none;
    border-left: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0;
    background: rgba(0, 0, 0, 0.05);
    min-width: 100%;
  }

  .dropdown-menu-custom li a {
    color: #fff;
    padding: 10px 30px;
  }

  .dropdown-menu-custom li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
}

.nav-link i {
  margin-right: 6px;
  font-size: 16px;
}

.zmdi {
  line-height: 1;
}

.btn-primary {
  background-color: #1D9E75 !important;
  border-color: #1D9E75 !important;
}

.btn-primary:hover {
  background-color: #0F6E56 !important;
  border-color: #0F6E56 !important;
}


/* ─────────────────────────────────────────────────────────────
 * STRICT MOBILE ONLY RESPONSIVE ENHANCEMENTS (<= 768px ONLY)
 * ZERO IMPACT ON DESKTOP AND LARGE SCREENS (> 768px)
 * ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {

  /* Global mobile container & overflow protection */
  html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .main {
    padding: 12px 12px 28px !important;
    width: 100% !important;
  }

  /* 1. Main Tab Strip on Mobile (Scrollable horizontally without wrapping) */
  .tab-strip {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 8px !important;
    margin-bottom: 14px !important;
  }

  .tab-strip::-webkit-scrollbar {
    display: none !important;
  }

  .tab-btn {
    padding: 0 12px !important;
    height: 38px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  /* 2. Spend Intelligence Header & Reporting Period Badge Mobile Stacking */
  #pn-spend_intelligence > div:first-child,
  .panel > div[style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
    width: 100% !important;
  }

  #pn-spend_intelligence > div:first-child > div:last-child,
  .panel > div[style*="justify-content: space-between"] > div:last-child {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  /* 3. CONSISTENT METRIC CARDS ON MOBILE (100% Full Width + Centered Content) */
  .ops-grid-5,
  .ops-grid-6,
  .ops-grid,
  .metric-row,
  .kpi-grid,
  .kpi-grid[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
  }

  .ops-card,
  .kpi,
  .metric-card,
  .wn-metric-card {
    width: 100% !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px 14px !important;
  }

  .ops-card-label,
  .kpi-l,
  .wn-metric-label {
    text-align: center !important;
    width: 100% !important;
    font-size: 12px !important;
  }

  .ops-card-value,
  .kpi-v,
  .wn-metric-value {
    text-align: center !important;
    width: 100% !important;
    font-size: 32px !important;
    margin: 4px 0 6px !important;
  }

  .ops-card-sub,
  .kpi-s,
  .wn-metric-delta {
    text-align: center !important;
    justify-content: center !important;
    width: 100% !important;
    font-size: 12px !important;
    display: flex !important;
  }

  /* 4. Chart Grids on Mobile (Single Column) */
  .charts-2,
  .charts-eq,
  .panel > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* 5. Card Container & Table Horizontal Scrolling */
  .card {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
  }

  .table-responsive,
  .card > table,
  .panel table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* 6. Risk Register Table (Pipeline Tab) - Link Pills wrapping cleanly */
  .card table.table {
    width: 100% !important;
    min-width: 540px !important;
  }

  .card table.table td:last-child {
    word-break: break-word !important;
    white-space: normal !important;
  }

  .card table.table td a {
    display: inline-flex !important;
    align-items: center !important;
    padding: 3px 8px !important;
    margin: 3px 3px 3px 0 !important;
    background: #E1F5EE !important;
    color: #0F6E56 !important;
    border: 1px solid #5DCAA5 !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
  }

  /* 7. Supplier Scorecard Table (Supplier Performance Tab) - All 7 Columns Scrollable */
  table.dt-responsive,
  .card table.dt-responsive,
  #supplierBody {
    min-width: 850px !important;
    display: table !important;
    width: 100% !important;
  }

  .card table.dt-responsive th {
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.3 !important;
    font-size: 11px !important;
    min-width: 110px !important;
    padding: 8px 10px !important;
    background: #f7f6f2 !important;
  }

  .card table.dt-responsive td {
    padding: 8px 10px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  .card table.dt-responsive th:first-child,
  .card table.dt-responsive td:first-child {
    min-width: 160px !important;
    font-weight: 600 !important;
    white-space: normal !important;
  }

  .score-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
  }

  .score-a { background: #E1F5EE !important; color: #0F6E56 !important; }
  .score-b { background: #FAEEDA !important; color: #854F0B !important; }
  .score-c { background: #FCEBEB !important; color: #A32D2D !important; }

}


/* =====================================================================
   Inventory Dashboard
   Extends wemasoft-design-responsive.css. Load after it.
   Prefix: inv-
   ===================================================================== */

/* ---------- Header and period filter ---------- */

.inv-dashboard .inv-header {
  align-items: center;
  margin-bottom: var(--wn-space-lg);
}

.inv-period {
  display: flex;
  align-items: center;
  gap: var(--wn-space-sm);
  flex-wrap: wrap;
}

.inv-period-field {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--wn-surface);
  border: 1px solid var(--wn-border-strong);
  border-radius: var(--wn-radius-md);
  padding: 4px 10px;
}

.inv-period-field:focus-within {
  border-color: var(--wn-primary);
  box-shadow: 0 0 0 2px var(--wn-primary-muted);
}

.inv-period-field input[type="date"] {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: var(--wn-font-size-base);
  color: var(--wn-text-primary);
  padding: 2px 0;
}

.inv-period-field input[type="date"]:focus {
  outline: none;
}

.inv-period-sep {
  color: var(--wn-text-muted);
}

/* ---------- Alerts ---------- */

.inv-dashboard a.ialert-act,
.inv-dashboard a.ialert-act:hover {
  text-decoration: none;
  color: inherit;
}

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

.inv-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--wn-space-md);
  margin-bottom: var(--wn-space-md);
}

.inv-kpi-card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color var(--wn-transition);
}

a.inv-kpi-card:hover {
  border-color: var(--wn-primary);
  color: inherit;
  text-decoration: none;
}

a.inv-kpi-card:focus-visible {
  outline: 2px solid var(--wn-primary);
  outline-offset: 2px;
}

.inv-kpi-card .wn-metric-label {
  font-size: var(--wn-font-size-base);
  margin-bottom: 10px;
}

.inv-kpi-card .inv-kpi-value {
  color: var(--wn-text-primary);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.inv-kpi-card .inv-kpi-value.is-danger  { color: var(--wn-danger-vivid); }
.inv-kpi-card .inv-kpi-value.is-warning { color: #e08000; }

.inv-kpi-card .wn-metric-delta {
  font-size: var(--wn-font-size-sm);
  margin-top: 8px;
  gap: 4px; /* keeps the space after the arrow when the mobile rules switch this to flex */
}

/* ---------- Panels ---------- */

.inv-dashboard .charts-eq {
  gap: var(--wn-space-md);
  margin-bottom: var(--wn-space-md);
}

.inv-panel-sub {
  font-size: var(--wn-font-size-sm);
  font-weight: 400;
  color: var(--wn-text-muted);
  margin-left: 2px;
}

.inv-empty {
  padding: 36px 12px;
  text-align: center;
  font-size: var(--wn-font-size-base);
  color: var(--wn-text-muted);
}

/* ---------- Stock value by category ---------- */

.inv-donut-layout {
  display: flex;
  align-items: center;
  gap: var(--wn-space-xl);
}

.inv-donut-wrap {
  position: relative;
  width: 190px;
  height: 190px;
  flex-shrink: 0;
}

.inv-donut-centre {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.inv-donut-currency {
  font-size: var(--wn-font-size-sm);
  font-weight: 600;
  color: var(--wn-text-secondary);
}

.inv-donut-total {
  font-size: 20px;
  font-weight: 700;
  color: var(--wn-text-primary);
  line-height: 1.2;
}

.inv-legend {
  list-style: none;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.inv-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: var(--wn-font-size-base);
  color: var(--wn-text-secondary);
}

.inv-legend-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-legend-pct {
  font-weight: 600;
  color: var(--wn-text-primary);
  font-variant-numeric: tabular-nums;
}

.inv-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- Stock movement ---------- */

.inv-chart-wrap {
  position: relative;
  height: 230px;
}

/* ---------- Top consumed items ---------- */

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--wn-font-size-base);
}

.inv-table th {
  background: var(--wn-bg);
  color: var(--wn-text-secondary);
  font-weight: 600;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.inv-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--wn-border);
  color: var(--wn-text-primary);
}

.inv-table tbody tr:last-child td {
  border-bottom: none;
}

.inv-table tbody tr:hover td {
  background: #f7f8fa;
}

.inv-table .inv-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.inv-table .inv-rank {
  width: 32px;
  color: var(--wn-text-muted);
}

.inv-uom {
  margin-left: 4px;
  font-size: var(--wn-font-size-sm);
  color: var(--wn-text-muted);
}

/* ---------- Department consumption ---------- */

.inv-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.inv-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 44px;
  align-items: center;
  gap: 10px;
  font-size: var(--wn-font-size-base);
}

.inv-bar-name {
  color: var(--wn-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-bar-track {
  height: 14px;
  background: var(--wn-bg);
  border-radius: 3px;
  overflow: hidden;
}

.inv-bar-fill {
  height: 100%;
  border-radius: 3px;
}

.inv-bar-pct {
  text-align: right;
  font-weight: 600;
  color: var(--wn-text-primary);
  font-variant-numeric: tabular-nums;
}

/* ---------- Shared palette (matches the chart palette order) ---------- */

.inv-c0 { background: #1D9E75; }
.inv-c1 { background: #378ADD; }
.inv-c2 { background: #EF9F27; }
.inv-c3 { background: #B4B2A9; }
.inv-c4 { background: #E4572E; }
.inv-c5 { background: #9C27B0; }
.inv-c6 { background: #4CAF50; }
.inv-c7 { background: #FF5722; }
.inv-c8 { background: #00BCD4; }
.inv-c9 { background: #FFC107; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .inv-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .inv-donut-layout {
    flex-direction: column;
    align-items: stretch;
  }

  .inv-donut-wrap {
    margin: 0 auto;
  }

  .inv-dashboard .inv-header .wn-page-actions {
    width: 100%;
  }

  .inv-bar-row {
    grid-template-columns: 90px 1fr 40px;
  }
}

@media (max-width: 420px) {
  .inv-kpi-grid {
    grid-template-columns: 1fr;
  }
}


/* ---------- Sales / CRM ---------- */
/* =====================================================================
   CRM (calendar/sales)
   Extends wemasoft-design-responsive.css. Append to the end of it, or load after it.
   Prefix: crm-
   ===================================================================== */

/* ---------- Header and tabs ---------- */

.crm-page .tab-strip a.tab-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.crm-page .tab-strip a.tab-btn:hover { text-decoration: none; }

.crm-page .page-title { margin-bottom: 6px; }

/* ---------- Queue pills and filters (Inbox) ---------- */

.crm-queuebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.crm-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.crm-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: var(--wn-radius-pill);
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text2);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.crm-pill:hover { color: var(--text); text-decoration: none; border-color: var(--teal); }
.crm-pill.active { background: var(--teal-light); border-color: var(--teal); color: var(--teal-dark); font-weight: 600; }

.crm-pill-count {
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--gray-light);
  color: var(--gray-dark);
}

.crm-pill.active .crm-pill-count { background: var(--teal); color: #fff; }
.crm-pill-count.is-alert { background: var(--red-light); color: var(--red-dark); }

.crm-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.crm-filters .form-control { width: auto; min-width: 130px; }

/* ---------- Inbox columns ---------- */

.crm-inbox { margin-left: -6px; margin-right: -6px; }
.crm-inbox > [class*="col-"] { padding-left: 6px; padding-right: 6px; }

.crm-list-caption { font-size: 12px; color: var(--text3); margin: 0 2px 6px; }

.crm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 230px);
  min-height: 420px;
  overflow-y: auto;
  padding: 2px;
}

.crm-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
}

.crm-card:hover { border-color: var(--border2); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.crm-card.active { border: 2px solid var(--text); padding: 9px 11px; }
.crm-card.is-unread .crm-card-name { font-weight: 700; }

.crm-avatar {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gray-light);
  color: var(--gray-dark);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crm-card-body { flex: 1; min-width: 0; }
.crm-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.crm-card-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-card-count { font-size: 12px; color: var(--text3); font-weight: 400; margin-left: 4px; }
.crm-card-date { font-size: 12px; color: var(--text3); white-space: nowrap; }
.crm-card-sub { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-card-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 5px; }
.crm-card-owner { font-size: 11px; color: var(--text3); margin-left: auto; }

.crm-empty {
  background: var(--surface);
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  padding: 30px 16px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}

/* ---------- Tags ---------- */

.crm-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.crm-tag-hot   { background: #fdecdf; color: #a8470a; }
.crm-tag-warm  { background: var(--amber-light); color: var(--amber-dark); }
.crm-tag-cold  { background: var(--blue-light); color: var(--blue-dark); }
.crm-tag-late  { background: var(--red-light); color: var(--red-dark); }
.crm-tag-ok    { background: var(--teal-light); color: var(--teal-dark); }
.crm-tag-muted { background: var(--gray-light); color: var(--gray-dark); }
.crm-tag-v1    { background: var(--teal); color: #fff; }
.crm-tag-v2    { background: var(--teal-light); color: var(--teal-dark); }
.crm-tag-v3    { background: var(--amber-light); color: var(--amber-dark); }
.crm-tag-v4    { background: var(--gray-light); color: var(--gray-dark); }

/* ---------- Conversation ---------- */

.crm-thread {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.crm-thread-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.crm-thread-name { font-size: 16px; font-weight: 700; }
.crm-thread-sub { font-size: 12px; color: var(--text2); }

.crm-messages {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 330px);
  min-height: 200px;
  overflow-y: auto;
}

.crm-msg {
  border-radius: var(--radius);
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.crm-msg-in   { margin-right: 36px; }
.crm-msg-out  { margin-left: 36px; background: #f1f7f4; border-color: #d6e9e0; }
.crm-msg-note { background: #fffaf0; border: 1px dashed #e0c27e; }

.crm-msg-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
}

.crm-msg-who { font-weight: 700; color: var(--text); }
.crm-msg-when { color: var(--text3); }
.crm-msg-subject { font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.crm-msg-note-body { font-size: 13px; line-height: 1.5; }

.crm-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--gray-light);
  color: var(--gray-dark);
  margin-right: 6px;
}

.crm-mail-frame { width: 100%; border: 0; min-height: 30px; display: block; }

.crm-quoted-toggle {
  margin-top: 6px;
  border: 1px solid var(--border2);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 2px 9px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
}

.crm-quoted { display: none; margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; }
.crm-quoted.is-open { display: block; }

/* ---------- Composer and next step ---------- */

.crm-composer { border-top: 1px solid var(--border); padding: 12px 16px; }
.crm-composer-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--text2); }
.crm-composer-row .form-control { flex: 1; min-width: 160px; }
.crm-composer-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.crm-attach-note { font-size: 12px; color: var(--red-dark); display: none; }
.crm-attach-note.is-visible { display: inline; }

.crm-nextstep {
  display: none;
  margin: 12px 16px;
  background: var(--teal-light);
  border: 1px solid #bfe0d2;
  border-radius: var(--radius);
  padding: 12px 14px;
}

.crm-nextstep.is-open { display: block; }
.crm-nextstep-title { font-weight: 700; color: var(--teal-dark); margin-bottom: 8px; }
.crm-nextstep-section { display: none; margin-top: 8px; }
.crm-nextstep-section.is-open { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crm-nextstep-section .form-control { width: auto; }

.crm-choice {
  border: 1px solid #bfe0d2;
  background: var(--surface);
  color: var(--teal-dark);
  border-radius: var(--wn-radius-pill);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.crm-choice.active { background: var(--teal); border-color: var(--teal); color: #fff; }

.crm-flag {
  margin: 12px 16px 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--red-light);
  border: 1px solid #f7c1c1;
  color: var(--red-dark);
  font-size: 12px;
}

/* ---------- Lead panel (narrow column) ---------- */

.crm-lead {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  font-size: 12px;
}

.crm-lead-section { padding: 8px 0; border-bottom: 1px solid var(--border); }
.crm-lead-section:last-child { border-bottom: none; }
.crm-lead-company { font-size: 14px; font-weight: 700; line-height: 1.3; }
.crm-lead-label { font-size: 11px; font-weight: 600; color: var(--text2); margin-bottom: 3px; display: block; }
.crm-lead .form-control { font-size: 12px; height: auto; padding: 4px 6px; }
.crm-lead-why { background: #fff7f0; border-radius: var(--radius-sm); padding: 6px 8px; color: var(--text2); }
.crm-lead-why summary { cursor: pointer; font-weight: 600; color: #a8470a; }

.crm-temp { display: flex; gap: 4px; }
.crm-temp button { flex: 1; border: 1px solid var(--border2); background: var(--surface); border-radius: var(--radius-sm); padding: 3px 0; font-size: 11px; font-weight: 600; color: var(--text2); cursor: pointer; }
.crm-temp button.active.t1 { background: #fdecdf; color: #a8470a; border-color: #a8470a; }
.crm-temp button.active.t2 { background: var(--amber-light); color: var(--amber-dark); border-color: var(--amber-dark); }
.crm-temp button.active.t3 { background: var(--blue-light); color: var(--blue-dark); border-color: var(--blue-dark); }

.crm-verdict { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.crm-verdict button { border: 1px solid var(--border2); background: var(--surface); border-radius: var(--radius-sm); padding: 4px 2px; font-size: 11px; font-weight: 600; color: var(--text2); cursor: pointer; }
.crm-verdict button.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.crm-next-late { color: var(--red-dark); font-weight: 600; }

.crm-note { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.crm-note:last-child { border-bottom: none; }
.crm-note-meta { font-size: 11px; color: var(--text3); }

/* ---------- Overview ---------- */

.crm-docs { font-size: 11px; white-space: nowrap; }
.crm-docs span { display: inline-block; padding: 0 5px; border-radius: 3px; margin-right: 2px; background: var(--gray-light); color: var(--text3); }
.crm-docs span.is-sent { background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }

.crm-overview .pq-item a { color: var(--text); text-decoration: none; }

/* ---------- Responsive ---------- */

@media (max-width: 767px) {
  .crm-list { max-height: 360px; min-height: 0; }
  .crm-messages { max-height: none; }
  .crm-msg-in { margin-right: 0; }
  .crm-msg-out { margin-left: 0; }
  .crm-inbox > [class*="col-"] { margin-bottom: 10px; }
}
