/* ══════════════════════════════════════════════════════════════
   WFS CI OS — MAIN STYLESHEET
   Production-ready enterprise UI
   Primary: #E8192C (WFS Red) | Dark: #1A0A0B | White: #FFFFFF
══════════════════════════════════════════════════════════════ */

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #F5F5F6;
  color: #1A0A0B;
  line-height: 1.5;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; cursor: pointer; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; }
ul, ol { list-style: none; }
hr { border: none; border-top: 1px solid #E2E8F0; margin: 12px 0; }

/* ── CSS VARIABLES ─────────────────────────────────────────── */
:root {
  /* ── WFS BRAND REDS ── */
  --wfs-900: #6B0010;
  --wfs-800: #A0001A;
  --wfs-700: #C8001F;
  --wfs-600: #E8192C;
  --wfs-500: #E8192C;
  --wfs-100: #FFE4E7;
  --wfs-50:  #FFF5F6;

  /* Keep --blue-* as aliases so all existing JS-generated inline styles work */
  --blue-900: #6B0010;
  --blue-800: #A0001A;
  --blue-700: #E8192C;
  --blue-600: #E8192C;
  --blue-500: #FF3347;
  --blue-400: #FF6677;
  --blue-200: #FFBBC2;
  --blue-100: #FFE4E7;
  --blue-50:  #FFF5F6;

  --gold-500: #FFD700;
  --gold-600: #F5C800;
  --gold-400: #FFE033;
  --gold-100: #FFF9D9;

  --green-600: #1B6B2E;
  --green-500: #2E7D32;
  --green-400: #43A047;
  --green-100: #E8F5E9;

  --red-600: #B71C1C;
  --red-500: #C62828;
  --red-400: #D32F2F;
  --red-100: #FFEBEE;

  --amber-600: #E65100;
  --amber-500: #F57C00;
  --amber-400: #FB8C00;
  --amber-100: #FFF3E0;

  --grey-900: #1A0A0B;
  --grey-800: #2B1417;
  --grey-700: #3D1D21;
  --grey-600: #5C3038;
  --grey-500: #7A5860;
  --grey-400: #9E8388;
  --grey-300: #C4AEB2;
  --grey-200: #DDD0D2;
  --grey-150: #EADFE0;
  --grey-100: #F2ECED;
  --grey-50:  #F8F4F5;

  --nav-h: 56px;
  --sidebar-w: 230px;
  --sidebar-collapsed: 60px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(232,25,44,.08);
  --shadow:    0 2px 8px rgba(232,25,44,.12);
  --shadow-md: 0 4px 16px rgba(232,25,44,.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.16);
  --transition: all .18s cubic-bezier(.4,0,.2,1);
}

/* ── UTILITY ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--grey-400); }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .74rem; }
.text-lg { font-size: 1.1rem; }
.text-xl { font-size: 1.25rem; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* ── AUTH SCREEN ───────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #8B0010 0%, #C8001F 35%, #E8192C 65%, #B0001C 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.auth-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255,255,255,.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(0,0,0,.15) 0%, transparent 60%);
  pointer-events: none;
}
.auth-screen::after {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  pointer-events: none;
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 40px 44px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35), 0 4px 20px rgba(0,0,0,.2);
  position: relative;
  z-index: 1;
  border-top: 4px solid var(--wfs-600);
}
.setup-card { max-width: 560px; }
.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--grey-150);
}
.logo-img { height: 44px; width: auto; }
.auth-logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.logo-wordmark { font-size: 1.6rem; font-weight: 900; color: var(--wfs-600); letter-spacing: 1px; text-transform: uppercase; }
.logo-tagline { font-size: .68rem; font-weight: 700; color: var(--grey-400); letter-spacing: 2px; text-transform: uppercase; }
.logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--wfs-600);
  letter-spacing: .5px;
}
.auth-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--grey-900);
  margin-bottom: 6px;
}
.auth-subtitle { color: var(--grey-500); font-size: .9rem; margin-bottom: 24px; line-height: 1.5; }
.setup-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--wfs-100);
  color: var(--wfs-700);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: .3px;
}

/* ── APP SHELL LAYOUT ─────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── TOP NAV ───────────────────────────────────────────────── */
.top-nav {
  height: var(--nav-h);
  background: linear-gradient(90deg, #C8001F 0%, #E8192C 60%, #D41025 100%);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(200,0,31,.4), 0 1px 4px rgba(0,0,0,.2);
}
.nav-left { display: flex; align-items: center; gap: 12px; min-width: var(--sidebar-w); }
.sidebar-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.75);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.sidebar-toggle:hover { background: rgba(255,255,255,.1); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 34px; width: auto; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 1rem; font-weight: 900; color: #fff; line-height: 1; letter-spacing: 1px; text-transform: uppercase; }
.brand-sub { font-size: .62rem; color: rgba(255,255,255,.75); letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; }

.nav-center { flex: 1; display: flex; justify-content: center; }
.global-search-wrap { position: relative; width: 100%; max-width: 480px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.5); font-size: .85rem; pointer-events: none; }
.global-search {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  color: #fff;
  font-size: .88rem;
  transition: var(--transition);
}
.global-search::placeholder { color: rgba(255,255,255,.45); }
.global-search:focus {
  outline: none;
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.4);
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 360px;
  overflow-y: auto;
  z-index: 2000;
}

.nav-right { display: flex; align-items: center; gap: 6px; }
.nav-icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.75);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
}
.nav-icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-icon-btn .badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  background: var(--gold-500);
  color: #000;
  border-radius: 8px;
  font-size: .65rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px;
  border-radius: 20px;
  color: rgba(255,255,255,.85);
  transition: var(--transition);
}
.user-chip:hover { background: rgba(255,255,255,.1); color: #fff; }
.user-chip .fa-chevron-down { font-size: .7rem; opacity: .7; }
.user-avatar {
  width: 30px; height: 30px;
  background: rgba(255,255,255,.2);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  border: 1.5px solid rgba(255,255,255,.35);
}
.user-avatar.lg { width: 40px; height: 40px; font-size: 1rem; background: var(--wfs-100); color: var(--wfs-600); border: none; }
.user-name { font-size: .88rem; font-weight: 500; }
.user-menu-wrap { position: relative; }
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 240px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  padding: 8px 0;
}
.user-dropdown-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.dd-name { font-weight: 600; font-size: .9rem; color: var(--grey-900); }
.dd-role { font-size: .75rem; color: var(--wfs-600); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.dd-email { font-size: .75rem; color: var(--grey-400); }
.dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: .88rem;
  color: var(--grey-800);
  transition: var(--transition);
}
.dd-item:hover { background: var(--grey-50); color: var(--wfs-600); }
.dd-item.danger:hover { color: var(--red-500); background: var(--red-100); }
.dd-item i { width: 16px; text-align: center; color: var(--grey-400); }
.dd-item:hover i { color: inherit; }

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--nav-h));
  background: #fff;
  border-right: 1px solid var(--grey-150);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .22s cubic-bezier(.4,0,.2,1);
  z-index: 900;
  box-shadow: 2px 0 12px rgba(0,0,0,.06);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 0; }
.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--grey-300);
  padding: 8px 16px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .15s;
}
.sidebar.collapsed .nav-section-label { opacity: 0; pointer-events: none; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--grey-600);
  font-size: .88rem;
  font-weight: 500;
  border-radius: 0;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
}
.nav-item:hover { background: var(--wfs-50); color: var(--wfs-600); }
.nav-item.active {
  background: var(--wfs-50);
  color: var(--wfs-600);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--wfs-600);
  border-radius: 0 2px 2px 0;
}
.nav-item i { width: 18px; text-align: center; font-size: .9rem; flex-shrink: 0; }
.nav-item span { transition: opacity .15s; }
.sidebar.collapsed .nav-item span { opacity: 0; pointer-events: none; width: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--gold-500);
  color: #000;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: .65rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.sidebar.collapsed .nav-badge { display: none; }
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--grey-150);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.system-health { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--grey-500); }
.health-dot { width: 8px; height: 8px; border-radius: 50%; }
.health-dot.online { background: var(--green-400); box-shadow: 0 0 6px rgba(67,160,71,.6); }
.sidebar-version { font-size: .7rem; color: var(--grey-300); }
.sidebar.collapsed .sidebar-footer { justify-content: center; }
.sidebar.collapsed .system-health span,
.sidebar.collapsed .sidebar-version { display: none; }

/* ── MAIN CONTENT ─────────────────────────────────────────── */
.main-content {
  margin-top: var(--nav-h);
  margin-left: var(--sidebar-w);
  min-height: calc(100vh - var(--nav-h));
  transition: margin-left .22s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }
.module-container { padding: 24px; min-height: calc(100vh - var(--nav-h)); }

/* ── PAGE HEADER ───────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title-wrap { display: flex; flex-direction: column; }
.page-title { font-size: 1.4rem; font-weight: 700; color: var(--grey-900); }
.page-subtitle { font-size: .85rem; color: var(--grey-500); margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 8px; }

/* ── LOADING STATES ─────────────────────────────────────────── */
.loading-full {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 300px;
  gap: 12px;
  color: var(--grey-400);
}
.spinner-lg {
  width: 44px; height: 44px;
  border: 4px solid var(--grey-150);
  border-top-color: var(--wfs-600);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--grey-400);
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 1.1rem; color: var(--grey-600); margin-bottom: 6px; }
.empty-state p { font-size: .88rem; max-width: 360px; margin: 0 auto 20px; }

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,20,50,.55);
  backdrop-filter: blur(3px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s ease;
}
.modal-box.modal-lg { max-width: 860px; }
.modal-box.modal-xl { max-width: 1100px; }
@keyframes modal-in { from { opacity:0; transform:translateY(-16px) scale(.98); } to { opacity:1; transform:none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--grey-150);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--grey-900); }
.modal-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--grey-400);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.modal-close:hover { background: var(--grey-100); color: var(--grey-900); }
.modal-body { flex: 1; overflow-y: auto; padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--grey-150);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── TOAST ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--grey-900);
  color: #fff;
  border-radius: var(--radius);
  font-size: .88rem;
  box-shadow: var(--shadow-md);
  animation: toast-in .22s ease;
  min-width: 280px;
  max-width: 380px;
}
.toast.success { background: var(--green-600); }
.toast.error { background: var(--red-600); }
.toast.warning { background: var(--amber-500); color: #000; }
.toast.info { background: var(--blue-600); }
@keyframes toast-in { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:none; } }

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--grey-150);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--grey-150);
}
.card-title { font-size: .95rem; font-weight: 700; color: var(--grey-900); }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--grey-150);
  background: var(--grey-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── KPI STAT CARDS ─────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--grey-150);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); border-color: var(--wfs-100); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--wfs-100); color: var(--wfs-700); }
.stat-icon.gold { background: var(--gold-100); color: var(--amber-600); }
.stat-icon.green { background: var(--green-100); color: var(--green-600); }
.stat-icon.red { background: var(--red-100); color: var(--red-600); }
.stat-icon.amber { background: var(--amber-100); color: var(--amber-600); }
.stat-body { flex: 1; }
.stat-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--grey-400); margin-bottom: 4px; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--grey-900); line-height: 1; }
.stat-delta { font-size: .78rem; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.delta-up { color: var(--green-500); }
.delta-down { color: var(--red-500); }

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--grey-150); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead { background: var(--grey-50); }
th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--grey-500);
  border-bottom: 1px solid var(--grey-150);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--grey-100);
  color: var(--grey-800);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--grey-50); }
.table-actions { display: flex; gap: 6px; }
.tbl-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 500;
  transition: var(--transition);
}
.tbl-btn.edit { background: var(--wfs-100); color: var(--wfs-700); }
.tbl-btn.edit:hover { background: var(--wfs-600); color: #fff; }
.tbl-btn.del { background: var(--red-100); color: var(--red-600); }
.tbl-btn.del:hover { background: var(--red-500); color: #fff; }
.tbl-btn.view { background: var(--grey-100); color: var(--grey-700); }
.tbl-btn.view:hover { background: var(--grey-700); color: #fff; }

/* ── STATUS PILLS ───────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--green-100); color: var(--green-600); }
.pill-red { background: var(--red-100); color: var(--red-600); }
.pill-amber { background: var(--amber-100); color: var(--amber-600); }
.pill-blue { background: var(--wfs-100); color: var(--wfs-700); }
.pill-grey { background: var(--grey-100); color: var(--grey-600); }

/* ── PRIORITY PILLS ─────────────────────────────────────────── */
.priority-critical { background: #B71C1C; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: .72rem; font-weight: 700; }
.priority-high { background: var(--red-100); color: var(--red-600); padding: 2px 8px; border-radius: 10px; font-size: .72rem; font-weight: 700; }
.priority-medium { background: var(--amber-100); color: var(--amber-600); padding: 2px 8px; border-radius: 10px; font-size: .72rem; font-weight: 700; }
.priority-low { background: var(--green-100); color: var(--green-600); padding: 2px 8px; border-radius: 10px; font-size: .72rem; font-weight: 700; }

/* ── PROGRESS BARS ──────────────────────────────────────────── */
.progress-track { background: var(--grey-150); border-radius: 8px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 8px; transition: width .4s ease; }
.progress-fill.green { background: var(--green-400); }
.progress-fill.amber { background: var(--amber-400); }
.progress-fill.red { background: var(--red-400); }
.progress-fill.blue { background: var(--blue-500); }

/* ── FORMS ─────────────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label { font-size: .82rem; font-weight: 600; color: var(--grey-700); }
.req { color: var(--red-500); }
.field-group input,
.field-group select,
.field-group textarea {
  padding: 9px 13px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  font-size: .88rem;
  color: var(--grey-900);
  transition: var(--transition);
  background: #fff;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--wfs-600);
  box-shadow: 0 0 0 3px rgba(232,25,44,.1);
}
.field-group textarea { resize: vertical; min-height: 80px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-right: 40px; width: 100%; }
.toggle-pw {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--grey-400);
  cursor: pointer;
  font-size: .9rem;
  transition: var(--transition);
}
.toggle-pw:hover { color: var(--grey-700); }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error {
  background: var(--red-100);
  color: var(--red-600);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .84rem;
  display: flex; align-items: center; gap: 8px;
}
.pw-strength {
  height: 4px;
  border-radius: 4px;
  margin-top: 4px;
  transition: all .3s;
}
.pw-strength.weak { background: var(--red-400); width: 30%; }
.pw-strength.fair { background: var(--amber-400); width: 60%; }
.pw-strength.strong { background: var(--green-400); width: 100%; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  background: var(--blue-700);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .88rem;
  transition: var(--transition);
}
.btn-primary:hover { background: var(--blue-800); box-shadow: var(--shadow); }
.btn-primary:active { background: var(--blue-900); }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px;
  background: #fff;
  color: var(--blue-700);
  border: 1.5px solid var(--blue-700);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .88rem;
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--blue-50); }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  background: transparent;
  color: var(--grey-700);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: .88rem;
  transition: var(--transition);
}
.btn-ghost:hover { background: var(--grey-100); }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px;
  background: var(--red-500);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .88rem;
  transition: var(--transition);
}
.btn-danger:hover { background: var(--red-600); }
.btn-gold {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px;
  background: var(--gold-500);
  color: #000;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: .88rem;
  transition: var(--transition);
}
.btn-gold:hover { background: var(--gold-600); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-xs { padding: 4px 9px; font-size: .75rem; }
.btn-icon {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  color: var(--grey-500);
}
.btn-icon:hover { background: var(--grey-100); color: var(--grey-900); }
button:disabled, .btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── CHART CONTAINERS ───────────────────────────────────────── */
.chart-wrap { position: relative; }
.chart-wrap canvas { display: block; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .nav-item span, .sidebar .nav-section-label, .sidebar .nav-badge,
  .sidebar .sidebar-footer span, .sidebar .sidebar-version { opacity:0; width:0; overflow:hidden; pointer-events:none; }
  .main-content { margin-left: var(--sidebar-collapsed); }
}
@media (max-width: 768px) {
  .module-container { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .form-row.two-col { grid-template-columns: 1fr; }
  .nav-center { display: none; }
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar .nav-item span, .sidebar .nav-section-label { opacity:1; width:auto; }
  .main-content { margin-left: 0; }
}

/* ── TABS ───────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--grey-150); margin-bottom: 20px; }
.tab-btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: .88rem;
  font-weight: 500;
  color: var(--grey-500);
  transition: var(--transition);
  position: relative;
}
.tab-btn:hover { color: var(--wfs-600); background: var(--wfs-50); }
.tab-btn.active {
  color: var(--wfs-600);
  font-weight: 700;
  background: var(--wfs-50);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--wfs-600);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── DROPDOWN SELECT CUSTOM ─────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar select, .filter-bar input {
  padding: 7px 12px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  font-size: .85rem;
  color: var(--grey-800);
  background: #fff;
}
.filter-bar select:focus, .filter-bar input:focus { outline: none; border-color: var(--wfs-600); }

/* ── TIMELINE / ACTIVITY ────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--grey-100);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--wfs-500);
  flex-shrink: 0;
  margin-top: 4px;
}
.activity-text { font-size: .85rem; color: var(--grey-700); flex: 1; }
.activity-time { font-size: .75rem; color: var(--grey-400); white-space: nowrap; }

/* ── AUTH FOOTER NOTE ───────────────────────────────────────── */
.auth-footer-note {
  text-align: center;
  font-size: .76rem;
  color: var(--grey-400);
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--grey-150);
}

/* ── ALERT ITEMS ────────────────────────────────────────────── */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border-left: 4px solid transparent;
  background: #fff;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.alert-item:hover { box-shadow: var(--shadow); }
.alert-item.critical { border-color: var(--red-600); background: #FFF5F5; }
.alert-item.high { border-color: var(--red-400); background: var(--red-100); }
.alert-item.medium { border-color: var(--amber-400); background: var(--amber-100); }
.alert-item.low { border-color: var(--wfs-100); background: var(--wfs-50); }
.alert-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.alert-body { flex: 1; }
.alert-title { font-weight: 600; font-size: .88rem; color: var(--grey-900); }
.alert-desc { font-size: .8rem; color: var(--grey-600); margin-top: 2px; }
.alert-meta { font-size: .73rem; color: var(--grey-400); margin-top: 4px; }

/* ── TASK CARDS ─────────────────────────────────────────────── */
.task-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--grey-300);
  transition: var(--transition);
}
.task-card:hover { box-shadow: var(--shadow); }
.task-card.high { border-color: var(--red-400); }
.task-card.critical { border-color: var(--red-700); }
.task-card.medium { border-color: var(--amber-400); }
.task-card.low { border-color: var(--green-400); }
.task-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.task-title { font-weight: 600; font-size: .9rem; color: var(--grey-900); }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.task-assignee { font-size: .78rem; color: var(--grey-500); }
.task-due { font-size: .75rem; color: var(--grey-400); }
.task-due.overdue { color: var(--red-500); font-weight: 600; }

/* ── CI TOOLKIT CARDS ───────────────────────────────────────── */
.toolkit-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--grey-150);
  transition: var(--transition);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
}
.toolkit-card:hover { border-color: var(--wfs-100); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.toolkit-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  background: var(--wfs-100);
  color: var(--wfs-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.toolkit-card h3 { font-size: .95rem; font-weight: 700; color: var(--grey-900); }
.toolkit-card p { font-size: .82rem; color: var(--grey-500); line-height: 1.4; }

/* ── SEARCH RESULTS ─────────────────────────────────────────── */
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  transition: var(--transition);
  cursor: pointer;
}
.search-result-item:hover { background: var(--grey-50); }
.search-result-icon { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--wfs-100); color: var(--wfs-600); display: flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; }
.search-result-text { flex: 1; }
.search-result-title { font-size: .88rem; font-weight: 500; color: var(--grey-900); }
.search-result-sub { font-size: .75rem; color: var(--grey-400); }
.search-result-type { font-size: .7rem; color: var(--wfs-600); font-weight: 600; text-transform: uppercase; }
.search-group-label { padding: 8px 14px; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--grey-400); letter-spacing: .5px; background: var(--grey-50); }

/* ── KANBAN BOARD ───────────────────────────────────────────── */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; }
.kanban-col { min-width: 260px; flex: 1; background: var(--grey-50); border-radius: var(--radius-lg); padding: 12px; }
.kanban-col-header { font-weight: 700; font-size: .88rem; color: var(--grey-700); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.kanban-count { background: var(--grey-200); color: var(--grey-600); border-radius: 10px; padding: 2px 8px; font-size: .75rem; }

/* ── PRINT STYLES ───────────────────────────────────────────── */
@media print {
  .top-nav, .sidebar, .page-actions, .filter-bar, .tabs,
  .table-toolbar, .pagination, .toast-container, .modal-overlay,
  #dash-refresh-btn, .tbl-btn, .btn-primary, .btn-secondary, .btn-ghost { display: none !important; }
  .main-content { margin: 0 !important; }
  .module-container { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  body { background: #fff !important; }
  .report-preview { padding: 0 !important; }
}

/* ── SCROLLBARS ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--grey-200); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--grey-300); }

/* ── RAG STATUS ─────────────────────────────────────────────── */
.rag-green { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--green-400); }
.rag-amber { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--amber-400); }
.rag-red { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--red-400); }

/* ── WFS BRAND ACCENTS ──────────────────────────────────────── */
/* Red bar at top of key cards */
.card-primary {
  border-top: 3px solid var(--wfs-600);
}
/* Gradient hero header for module pages */
.module-hero {
  background: linear-gradient(135deg, var(--wfs-900) 0%, var(--wfs-600) 100%);
  color: #fff;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
.module-hero .page-title { color: #fff; }
.module-hero .page-subtitle { color: rgba(255,255,255,.75); }

/* ── INLINE ICON COLOUR UTILITY ─────────────────────────────── */
.icon-wfs { color: var(--wfs-600); }
.icon-gold { color: var(--gold-500); }
.icon-green { color: var(--green-500); }
.icon-amber { color: var(--amber-500); }
.icon-red { color: var(--red-500); }

/* ── TEMP PASSWORD INFO BOX ─────────────────────────────────── */
.temp-pw-box {
  background: var(--gold-100);
  border: 1px solid var(--gold-400);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: .85rem;
  color: var(--grey-800);
}
.temp-pw-box strong { color: var(--amber-600); font-family: monospace; font-size: 1rem; letter-spacing: 1px; }

/* ── KPI HEAT CLASSES ────────────────────────────────────────── */
.kpi-on-target { color: var(--green-600); font-weight: 700; }
.kpi-at-risk   { color: var(--amber-600); font-weight: 700; }
.kpi-breached  { color: var(--red-600);   font-weight: 700; }

/* ── RESPONSIVE FINE-TUNING ─────────────────────────────────── */
@media (max-width: 640px) {
  .auth-card { padding: 28px 22px; }
  .auth-logo { gap: 10px; }
  .logo-img { height: 36px; }
  .logo-wordmark { font-size: 1.3rem; }
}

/* ── ANIMATION UTILITIES ────────────────────────────────────── */
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.fade-in { animation: fadeIn .25s ease forwards; }
@keyframes pulse-red { 0%,100% { box-shadow: 0 0 0 0 rgba(232,25,44,.3); } 50% { box-shadow: 0 0 0 6px rgba(232,25,44,0); } }
.pulse-wfs { animation: pulse-red 2s infinite; }
