/* ============================================================
   FBMS — City of Tshwane Food Bank Management System
   Custom Stylesheet — Enterprise Light Theme
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
  --fb-primary:        #1a5276;
  --fb-primary-dark:   #154360;
  --fb-primary-light:  #2e86c1;
  --fb-accent:         #f39c12;
  --fb-accent-dark:    #d68910;
  --fb-success:        #1e8449;
  --fb-danger:         #c0392b;
  --fb-warning:        #d97706;
  --fb-info:           #117a8b;
  --fb-sidebar-bg:     #1a2a3a;
  --fb-sidebar-hover:  #243b53;
  --fb-sidebar-active: #1a5276;
  --fb-sidebar-text:   #c8d6e5;
  --fb-sidebar-icon:   #7f9db7;
  --fb-topbar-bg:      #ffffff;
  --fb-topbar-border:  #e3e6f0;
  --fb-body-bg:        #f4f6f9;
  --fb-card-shadow:    0 2px 8px rgba(26,82,118,.08);
  --fb-card-radius:    10px;
  --fb-transition:     .2s ease;
  --fb-sidebar-width:  250px;
  --fb-sidebar-collapsed: 70px;
  --fb-topbar-height:  60px;
  --fb-font:           'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--fb-font);
  background: var(--fb-body-bg);
  color: #343a40;
  font-size: .925rem;
  min-height: 100vh;
}

/* ── Layout Wrapper ── */
.fb-wrapper { display: flex; min-height: 100vh; }

/* ═══════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════ */
.fb-sidebar {
  width: var(--fb-sidebar-width);
  min-height: 100vh;
  background: var(--fb-sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  transition: width var(--fb-transition);
  overflow-x: hidden;
}

.fb-sidebar.collapsed { width: var(--fb-sidebar-collapsed); }

/* Brand */
.fb-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: var(--fb-topbar-height);
  background: var(--fb-primary-dark);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.fb-sidebar-brand .brand-logo {
  width: 36px; height: 36px;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--fb-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 1rem;
}
.fb-sidebar-brand .brand-text { overflow: hidden; }
.fb-sidebar-brand .brand-name {
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.fb-sidebar-brand .brand-sub {
  color: var(--fb-sidebar-icon);
  font-size: .7rem;
  white-space: nowrap;
}

/* Nav */
.fb-nav {
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  max-height: calc(100vh - var(--fb-topbar-height));
}
.fb-nav::-webkit-scrollbar { width: 8px; }
.fb-nav::-webkit-scrollbar-track { background: transparent; }
.fb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.35); border-radius: 4px; transition: background 0.2s; }
.fb-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.5); }

.nav-section-label {
  padding: 8px 18px 4px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fb-sidebar-icon);
  white-space: nowrap;
  overflow: hidden;
}
.fb-sidebar.collapsed .nav-section-label { opacity: 0; }

/* Nav Items */
.fb-nav-item { position: relative; }

.fb-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--fb-sidebar-text);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all var(--fb-transition);
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}
.fb-nav-link:hover {
  background: var(--fb-sidebar-hover);
  color: #fff;
  text-decoration: none;
}
.fb-nav-link.active {
  background: var(--fb-sidebar-active);
  border-left-color: var(--fb-accent);
  color: #fff;
}
.fb-nav-link .nav-icon {
  width: 20px;
  text-align: center;
  font-size: .9rem;
  flex-shrink: 0;
  color: var(--fb-sidebar-icon);
  transition: color var(--fb-transition);
}
.fb-nav-link:hover .nav-icon,
.fb-nav-link.active .nav-icon { color: var(--fb-accent); }

.fb-nav-link .nav-label {
  flex: 1;
  font-size: .84rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-sidebar.collapsed .nav-label,
.fb-sidebar.collapsed .nav-arrow { opacity: 0; width: 0; overflow: hidden; }

.nav-arrow {
  font-size: .7rem;
  transition: transform var(--fb-transition);
  color: var(--fb-sidebar-icon);
}
.fb-nav-link[aria-expanded="true"] .nav-arrow { transform: rotate(90deg); }

/* ── Parent toggle active state ── */
.fb-nav-item.has-submenu > .fb-nav-link[aria-expanded="true"] {
  background: rgba(255,255,255,.06);
  color: #fff;
  border-left-color: var(--fb-accent);
}
.fb-nav-item.has-submenu > .fb-nav-link[aria-expanded="true"] .nav-icon {
  color: var(--fb-accent);
}

/* ── Submenu container ── */
.fb-submenu {
  overflow: hidden;
  margin: 0;
  padding: 4px 0 6px 0;
  background: rgba(0,0,0,.18);
  border-left: none;
  position: relative;
}

/* ── Vertical connecting line ── */
.fb-submenu::before {
  content: '';
  position: absolute;
  left: 30px;
  top: 0;
  bottom: 6px;
  width: 1px;
  background: rgba(255,255,255,.12);
}

/* ── Submenu item ── */
.fb-submenu .fb-nav-item { position: relative; }

.fb-submenu .fb-nav-link {
  padding: 6px 18px 6px 50px;
  font-size: .81rem;
  font-weight: 400;
  color: rgba(200,214,229,.8);
  border-left: none;
  position: relative;
}

/* ── Dot connector ── */
.fb-submenu .fb-nav-link::before {
  content: '';
  position: absolute;
  left: 27px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  transition: background var(--fb-transition), transform var(--fb-transition);
}

.fb-submenu .fb-nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}
.fb-submenu .fb-nav-link:hover::before {
  background: var(--fb-accent);
  transform: translateY(-50%) scale(1.3);
}

.fb-submenu .fb-nav-item.active .fb-nav-link {
  color: #fff;
  font-weight: 600;
  background: rgba(255,255,255,.07);
}
.fb-submenu .fb-nav-item.active .fb-nav-link::before {
  background: var(--fb-accent);
  transform: translateY(-50%) scale(1.2);
}

/* ── Top-level menu item active state ── */
.fb-nav-item.active > .fb-nav-link {
  background: rgba(255,255,255,.07);
  color: #fff;
  font-weight: 600;
}

/* ── Hide submenu icon in sub-items (use dot instead) ── */
.fb-submenu .nav-icon { display: none; }

.fb-sidebar.collapsed .fb-submenu { display: none !important; }

/* Sidebar Footer */
.fb-sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--fb-primary-light);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .85rem;
  flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name {
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.sidebar-user-role {
  color: var(--fb-sidebar-icon);
  font-size: .7rem;
  white-space: nowrap;
}

/* Sidebar tooltip on collapsed */
.fb-sidebar.collapsed .fb-nav-link { justify-content: center; padding: 10px 0; }
.fb-sidebar.collapsed .fb-nav-link .nav-icon { font-size: 1.1rem; }

/* ═══════════════════════════════════════════
   MAIN CONTENT AREA
═══════════════════════════════════════════ */
.fb-main {
  flex: 1;
  margin-left: var(--fb-sidebar-width);
  transition: margin-left var(--fb-transition);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.fb-wrapper.sidebar-collapsed .fb-main { margin-left: var(--fb-sidebar-collapsed); }

/* ═══════════════════════════════════════════
   TOPBAR
═══════════════════════════════════════════ */
.fb-topbar {
  height: var(--fb-topbar-height);
  background: var(--fb-topbar-bg);
  border-bottom: 1px solid var(--fb-topbar-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.sidebar-toggle-btn {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: all var(--fb-transition);
  line-height: 1;
}
.sidebar-toggle-btn:hover { background: #f0f3f7; color: var(--fb-primary); }

/* Breadcrumb */
.fb-breadcrumb {
  flex: 1;
  font-size: .82rem;
}
.fb-breadcrumb .breadcrumb {
  margin: 0;
  padding: 0;
  background: none;
}
.fb-breadcrumb .breadcrumb-item a {
  color: var(--fb-primary);
  text-decoration: none;
}
.fb-breadcrumb .breadcrumb-item.active { color: #6c757d; }

/* Topbar Right */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.topbar-btn {
  background: none;
  border: none;
  color: #6c757d;
  font-size: .95rem;
  cursor: pointer;
  padding: 6px 9px;
  border-radius: 6px;
  position: relative;
  transition: all var(--fb-transition);
  line-height: 1;
}
.topbar-btn:hover { background: #f0f3f7; color: var(--fb-primary); }
.topbar-badge {
  position: absolute;
  top: 2px; right: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--fb-danger);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* User dropdown */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--fb-transition);
  text-decoration: none;
}
.topbar-user:hover { background: #f0f3f7; text-decoration: none; }
.topbar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--fb-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .78rem;
}
.topbar-user-name { font-size: .82rem; font-weight: 600; color: #343a40; line-height: 1.2; }
.topbar-user-role { font-size: .7rem; color: #6c757d; }

/* ═══════════════════════════════════════════
   PAGE CONTENT
═══════════════════════════════════════════ */
.fb-content {
  flex: 1;
  padding: 24px;
}

/* Page Header */
.fb-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.fb-page-title { font-size: 1.35rem; font-weight: 700; color: var(--fb-primary); margin: 0; }
.fb-page-subtitle { font-size: .82rem; color: #6c757d; margin: 2px 0 0; }

/* ═══════════════════════════════════════════
   CARDS
═══════════════════════════════════════════ */
.fb-card {
  background: #fff;
  border: 1px solid #e8ecf0;
  border-radius: var(--fb-card-radius);
  box-shadow: var(--fb-card-shadow);
  margin-bottom: 24px;
}
.fb-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f3f7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.fb-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--fb-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.fb-card-title i { color: var(--fb-accent); font-size: .9rem; }
.fb-card-body { padding: 20px; }
.fb-card-footer {
  padding: 12px 20px;
  border-top: 1px solid #f0f3f7;
  background: #fafbfc;
  border-radius: 0 0 var(--fb-card-radius) var(--fb-card-radius);
}

/* ═══════════════════════════════════════════
   KPI STAT CARDS
═══════════════════════════════════════════ */
.stat-card {
  background: #fff;
  border: 1px solid #e8ecf0;
  border-radius: var(--fb-card-radius);
  box-shadow: var(--fb-card-shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--fb-transition), box-shadow var(--fb-transition);
  margin-bottom: 24px;
  text-decoration: none;
  color: inherit;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26,82,118,.12);
  text-decoration: none;
  color: inherit;
}
.stat-card-icon {
  width: 56px; height: 56px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-card-icon.blue   { background: rgba(46,134,193,.12); color: var(--fb-primary-light); }
.stat-card-icon.green  { background: rgba(30,132,73,.12);  color: var(--fb-success); }
.stat-card-icon.orange { background: rgba(243,156,18,.12); color: var(--fb-accent); }
.stat-card-icon.red    { background: rgba(192,57,43,.12);  color: var(--fb-danger); }
.stat-card-icon.teal   { background: rgba(17,122,139,.12); color: var(--fb-info); }
.stat-card-icon.purple { background: rgba(125,60,152,.12); color: #7d3c98; }

.stat-card-body { flex: 1; min-width: 0; }
.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fb-primary);
  line-height: 1.1;
}
.stat-card-label {
  font-size: .8rem;
  color: #6c757d;
  font-weight: 500;
  margin-top: 2px;
}
.stat-card-change {
  font-size: .75rem;
  font-weight: 600;
  margin-top: 4px;
}
.stat-card-change.up   { color: var(--fb-success); }
.stat-card-change.down { color: var(--fb-danger); }

/* ═══════════════════════════════════════════
   SKELETON LOADER
═══════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, #f0f3f7 25%, #e8ecf0 50%, #f0f3f7 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-value { height: 32px; width: 80px; margin-bottom: 6px; }

/* ═══════════════════════════════════════════
   TABLES
═══════════════════════════════════════════ */
.fb-table-wrapper { overflow-x: auto; }
.fb-table {
  width: 100%;
  margin: 0;
}
.fb-table thead th {
  background: #f8f9fc;
  color: var(--fb-primary);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid var(--fb-topbar-border);
  padding: 10px 14px;
}
.fb-table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  border-bottom: 1px solid #f0f3f7;
  font-size: .85rem;
}
.fb-table tbody tr:hover { background: #f8fbff; }
.fb-table tbody tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════
   BADGES / STATUS PILLS
═══════════════════════════════════════════ */
.fb-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.fb-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .7;
}
.fb-badge-success { background: rgba(30,132,73,.1);  color: var(--fb-success); }
.fb-badge-danger  { background: rgba(192,57,43,.1);  color: var(--fb-danger); }
.fb-badge-warning { background: rgba(217,119,6,.1);  color: var(--fb-warning); }
.fb-badge-info    { background: rgba(17,122,139,.1); color: var(--fb-info); }
.fb-badge-primary { background: rgba(26,82,118,.1);  color: var(--fb-primary); }
.fb-badge-secondary { background: rgba(108,117,125,.1); color: #495057; }

/* ═══════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════ */
.btn-fb-primary {
  background: var(--fb-primary);
  border-color: var(--fb-primary);
  color: #fff;
  font-weight: 600;
  font-size: .85rem;
  border-radius: 7px;
  padding: 7px 18px;
  transition: all var(--fb-transition);
}
.btn-fb-primary:hover {
  background: var(--fb-primary-dark);
  border-color: var(--fb-primary-dark);
  color: #fff;
}
.btn-fb-accent {
  background: var(--fb-accent);
  border-color: var(--fb-accent);
  color: #fff;
  font-weight: 600;
  font-size: .85rem;
  border-radius: 7px;
  padding: 7px 18px;
  transition: all var(--fb-transition);
}
.btn-fb-accent:hover {
  background: var(--fb-accent-dark);
  border-color: var(--fb-accent-dark);
  color: #fff;
}
.btn-icon {
  padding: 5px 8px;
  border-radius: 6px;
  font-size: .8rem;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════
   FORMS
═══════════════════════════════════════════ */
.form-control:focus, .custom-select:focus {
  border-color: var(--fb-primary-light);
  box-shadow: 0 0 0 .2rem rgba(46,134,193,.2);
}
.form-label {
  font-size: .82rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 4px;
}
.form-label.required::after {
  content: " *";
  color: #dc3545;
  font-weight: 700;
}
.form-section-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--fb-primary);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--fb-topbar-border);
  margin-bottom: 16px;
  margin-top: 24px;
}
.required-star { color: var(--fb-danger); margin-left: 2px; }

/* ═══════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════ */
.fb-alert {
  border-radius: 8px;
  border-left: 4px solid;
  font-size: .85rem;
  padding: 12px 16px;
}

/* ═══════════════════════════════════════════
   LOGIN PAGE — split-screen layout
═══════════════════════════════════════════ */
.login-body { margin:0; padding:0; font-family:'Inter',sans-serif; background:#f0f4f8; }

.login-split {
  display: flex;
  min-height: 100vh;
}

/* ── Left panel ── */
.login-left {
  flex: 1 1 55%;
  background: linear-gradient(150deg, var(--fb-primary-dark) 0%, var(--fb-primary) 55%, #1a7a8a 100%);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 48px 52px;
}
.login-left::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M50 50v-6h-3v6h-6v3h6v6h3v-6h6v-3h-6zm0-44V0h-3v6h-6v3h6v6h3V9h6V6h-6zM6 50v-6H3v6H-3v3h6v6h3v-6h6v-3H6zM6 6V0H3v6H-3v3h6v6h3V9h6V6H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
/* decorative circles */
.login-left::after {
  content: '';
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  bottom: -120px; right: -80px;
  pointer-events: none;
}
.login-left-inner { flex: 1; position: relative; z-index: 1; }

/* Brand row */
.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 52px;
}
.login-brand-icon {
  width: 60px; height: 60px;
  background: rgba(255,255,255,.15);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: #fff;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}
.login-brand-name {
  font-size: 1.05rem; font-weight: 700; color: #fff; line-height: 1.2;
}
.login-brand-dept {
  font-size: .78rem; color: rgba(255,255,255,.65); margin-top: 2px;
}

/* Headline */
.login-headline {
  font-size: 2.2rem; font-weight: 800; color: #fff;
  line-height: 1.2; margin-bottom: 18px; letter-spacing: -.5px;
}
.login-tagline {
  font-size: .9rem; color: rgba(255,255,255,.7);
  line-height: 1.7; max-width: 440px; margin-bottom: 40px;
}

/* Feature list */
.login-features {
  list-style: none; padding: 0; margin: 0 0 40px;
  display: flex; flex-direction: column; gap: 18px;
}
.login-features li {
  display: flex; align-items: flex-start; gap: 14px;
}
.login-feat-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  background: rgba(255,255,255,.12);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.9); font-size: .9rem;
}
.login-features li div strong {
  display: block; color: #fff; font-size: .88rem; font-weight: 600;
}
.login-features li div span {
  font-size: .78rem; color: rgba(255,255,255,.6);
}

/* SOP badges */
.login-sop-row {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.login-sop-badge {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.8);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .72rem; font-weight: 600;
  backdrop-filter: blur(4px);
}

/* Left footer */
.login-left-footer {
  position: relative; z-index: 1;
  font-size: .72rem; color: rgba(255,255,255,.4);
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.1);
  margin-top: 32px;
}

/* ── Right panel ── */
.login-right {
  flex: 0 0 420px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  box-shadow: -8px 0 32px rgba(0,0,0,.08);
}
.login-form-wrap { width: 100%; max-width: 340px; }

.login-form-header { margin-bottom: 32px; }
.login-form-title {
  font-size: 1.5rem; font-weight: 800; color: var(--fb-dark);
  margin: 0 0 6px;
}
.login-form-subtitle { font-size: .85rem; color: #6b7280; margin: 0; }

/* Input fields */
.login-field-label {
  display: block; font-size: .8rem; font-weight: 600;
  color: #374151; margin-bottom: 6px;
}
.login-input-wrap {
  position: relative;
}
.login-input-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: #9ca3af; font-size: .82rem; pointer-events: none;
}
.login-input {
  width: 100%;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 11px 40px 11px 38px;
  font-size: .9rem; font-family: 'Inter', sans-serif;
  color: #111827;
  background: #f9fafb;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.login-input:focus {
  border-color: var(--fb-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,131,155,.12);
}
.login-input::placeholder { color: #c1c9d2; }
.login-toggle-pwd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 0;
  color: #9ca3af; font-size: .82rem; cursor: pointer;
  outline: none;
}
.login-toggle-pwd:hover { color: var(--fb-primary); }

.login-forgot-link {
  font-size: .78rem; color: var(--fb-primary); text-decoration: none; font-weight: 500;
}
.login-forgot-link:hover { text-decoration: underline; }

.login-submit-btn {
  width: 100%;
  background: var(--fb-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: .95rem; font-weight: 600;
  letter-spacing: .3px;
  transition: background .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 4px 14px rgba(0,131,155,.3);
}
.login-submit-btn:hover  { background: var(--fb-primary-dark); box-shadow: 0 6px 20px rgba(0,131,155,.35); }
.login-submit-btn:active { transform: translateY(1px); }
.login-submit-btn:disabled { opacity: .7; cursor: not-allowed; transform: none; }

.login-info-note {
  margin-top: 28px;
  padding: 12px 14px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  font-size: .75rem; color: #0369a1; line-height: 1.5;
}

/* ── Responsive: stack on small screens ── */
@media (max-width: 900px) {
  .login-split { flex-direction: column; }
  .login-left {
    flex: none;
    padding: 36px 28px 32px;
  }
  .login-headline { font-size: 1.55rem; }
  .login-features { display: none; }
  .login-tagline  { font-size: .82rem; margin-bottom: 24px; }
  .login-left-footer { display: none; }
  .login-right {
    flex: none;
    box-shadow: none;
    padding: 36px 24px 48px;
  }
  .login-form-wrap { max-width: 100%; }
}
@media (max-width: 480px) {
  .login-left { padding: 28px 20px 24px; }
  .login-brand-icon { width: 48px; height: 48px; font-size: 1.4rem; }
  .login-headline { font-size: 1.3rem; }
  .login-tagline  { display: none; }
  .login-sop-row  { display: none; }
  .login-right    { padding: 28px 20px 40px; }
}

/* ═══════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════ */
.text-primary-fb { color: var(--fb-primary) !important; }
.text-accent     { color: var(--fb-accent) !important; }
.bg-primary-fb   { background-color: var(--fb-primary) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-lg  { font-size: 1.25rem; }
.fs-sm  { font-size: .82rem; }
.fs-xs  { font-size: .72rem; }
.gap-2  { gap: .5rem; }
.gap-3  { gap: 1rem; }

.divider {
  border: none;
  border-top: 1px solid var(--fb-topbar-border);
  margin: 20px 0;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 991.98px) {
  .fb-sidebar {
    transform: translateX(-100%);
    transition: transform var(--fb-transition), width var(--fb-transition);
  }
  .fb-sidebar.mobile-open {
    transform: translateX(0);
    width: var(--fb-sidebar-width) !important;
  }
  .fb-main { margin-left: 0 !important; }
  .fb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
  }
  .fb-overlay.active { display: block; }
}
@media (max-width: 575.98px) {
  .fb-content { padding: 16px; }
  .stat-card-value { font-size: 1.4rem; }
}

/* ═══════════════════════════════════════════
   SIDEBAR — EXTENDED
═══════════════════════════════════════════ */
.fb-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.fb-nav-header {
  padding: 6px 18px 2px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fb-sidebar-icon);
  opacity: .7;
}
.fb-sidebar.collapsed .fb-nav-header { opacity: 0; height: 0; overflow: hidden; padding: 0; }

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  text-decoration: none;
  overflow: hidden;
}
.brand-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--fb-accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem;
  flex-shrink: 0;
}
.brand-text {
  color: #fff;
  font-size: .88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-sidebar.collapsed .brand-text { opacity: 0; width: 0; }

.fb-sidebar-collapse-btn {
  background: none;
  border: none;
  color: var(--fb-sidebar-icon);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 5px;
  transition: all var(--fb-transition);
  flex-shrink: 0;
  margin-left: auto;
}
.fb-sidebar-collapse-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.fb-sidebar.collapsed .fb-sidebar-collapse-btn #collapseIcon { transform: rotate(180deg); }

.sidebar-user { text-decoration: none; }
.sidebar-user:hover { text-decoration: none; }
.fb-sidebar.collapsed .sidebar-user-info { display: none; }

/* ═══════════════════════════════════════════
   TOPBAR — EXTENDED
═══════════════════════════════════════════ */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.topbar-toggle-btn {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 1.05rem;
  cursor: pointer;
  padding: 6px 9px;
  border-radius: 6px;
  transition: all var(--fb-transition);
  flex-shrink: 0;
  line-height: 1;
}
.topbar-toggle-btn:hover { background: #f0f3f7; color: var(--fb-primary); }

.breadcrumb { font-size: .8rem; margin: 0; padding: 0; background: none; }
.breadcrumb-item a { color: var(--fb-primary); text-decoration: none; }
.breadcrumb-item a:hover { text-decoration: underline; }
.breadcrumb-item.active { color: #6c757d; }
.breadcrumb-item + .breadcrumb-item::before { color: #adb5bd; }

.topbar-icon-btn {
  background: none;
  border: none;
  color: #6c757d;
  font-size: .95rem;
  cursor: pointer;
  padding: 7px 9px;
  border-radius: 6px;
  position: relative;
  transition: all var(--fb-transition);
  line-height: 1;
}
.topbar-icon-btn:hover { background: #f0f3f7; color: var(--fb-primary); }

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--fb-transition);
  text-decoration: none;
}
.topbar-user-btn:hover { background: #f0f3f7; }
.topbar-user-btn::after { display: none; } /* hide BS dropdown arrow */
.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--fb-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .78rem;
  flex-shrink: 0;
}
.topbar-user-name { font-size: .82rem; font-weight: 600; color: #343a40; line-height: 1.2; display: block; }
.topbar-user-role { font-size: .7rem; color: #6c757d; display: block; }
.topbar-chevron { font-size: .65rem; color: #adb5bd; margin-left: 2px; }

.fb-dropdown-menu {
  border: 1px solid #e8ecf0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 200px;
  padding: 6px 0;
  margin-top: 6px;
}
.fb-dropdown-menu .dropdown-item {
  font-size: .84rem;
  padding: 8px 16px;
  transition: background var(--fb-transition);
}
.fb-dropdown-menu .dropdown-item:hover { background: #f4f6f9; }
.fb-dropdown-menu .dropdown-header { font-size: .8rem; }

/* ═══════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════ */
.fb-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--fb-topbar-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .75rem;
  color: #9aa5b4;
  background: #fff;
}

/* ═══════════════════════════════════════════
   STAT CARD COLOUR VARIANTS
═══════════════════════════════════════════ */
.stat-card--blue   .stat-card-icon { background: rgba(46,134,193,.1);  color: var(--fb-primary-light); }
.stat-card--green  .stat-card-icon { background: rgba(30,132,73,.1);   color: var(--fb-success); }
.stat-card--orange .stat-card-icon { background: rgba(243,156,18,.1);  color: var(--fb-accent); }
.stat-card--teal   .stat-card-icon { background: rgba(17,122,139,.1);  color: var(--fb-info); }
.stat-card--purple .stat-card-icon { background: rgba(125,60,152,.1);  color: #7d3c98; }
.stat-card--red    .stat-card-icon { background: rgba(192,57,43,.1);   color: var(--fb-danger); }
.stat-card--grey   .stat-card-icon { background: rgba(108,117,125,.1); color: #6c757d; }

.stat-card-link {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--fb-primary);
  text-decoration: none;
  margin-top: 10px;
  opacity: .7;
  transition: opacity var(--fb-transition);
}
.stat-card-link:hover { opacity: 1; text-decoration: none; color: var(--fb-primary); }
.stat-card-link i { font-size: .65rem; }

/* ═══════════════════════════════════════════
   BADGE COLOUR VARIANTS (extended)
═══════════════════════════════════════════ */
.fb-badge-blue   { background: rgba(46,134,193,.1);  color: var(--fb-primary-light); }
.fb-badge-green  { background: rgba(30,132,73,.1);   color: var(--fb-success); }
.fb-badge-orange { background: rgba(243,156,18,.1);  color: var(--fb-accent); }
.fb-badge-teal   { background: rgba(17,122,139,.1);  color: var(--fb-info); }
.fb-badge-purple { background: rgba(125,60,152,.1);  color: #7d3c98; }
.fb-badge-red    { background: rgba(192,57,43,.1);   color: var(--fb-danger); }
.fb-badge-grey   { background: rgba(108,117,125,.1); color: #6c757d; }

/* ═══════════════════════════════════════════
   PROFILE PAGE
═══════════════════════════════════════════ */
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--fb-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1.75rem;
}
.profile-meta { text-align: left; }
.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: #495057;
  padding: 5px 0;
  border-bottom: 1px solid #f0f3f7;
}
.profile-meta-item:last-child { border-bottom: none; }
.profile-meta-item i { width: 16px; text-align: center; }

/* ═══════════════════════════════════════════
   PAGE HEADER ACTIONS
═══════════════════════════════════════════ */
.fb-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════
   MOBILE OVERLAY
═══════════════════════════════════════════ */
.fb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
  cursor: pointer;
}
.fb-overlay.active { display: block; }

/* ═══════════════════════════════════════════════════
   HORIZONTAL NAVIGATION LAYOUT
═══════════════════════════════════════════════════ */

.layout-horizontal .fb-sidebar    { display: none !important; }
.layout-horizontal .fb-main       { margin-left: 0 !important; }
.layout-horizontal .sidebar-toggle-btn,
.layout-horizontal #sidebarCollapseBtn,
.layout-horizontal #topbarToggle   { display: none !important; }

.fb-hnav {
  background: var(--fb-sidebar-bg);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 0 20px;
  position: sticky;
  top: var(--fb-topbar-height);
  z-index: 900;
  overflow: visible;
}

.fb-hnav-list {
  display: flex;
  align-items: stretch;
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  min-height: 46px;
}

.fb-hnav-item {
  position: relative;
  display: flex;
  align-items: stretch;
}

.fb-hnav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  color: var(--fb-sidebar-text);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: all var(--fb-transition);
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.fb-hnav-link:hover,
.fb-hnav-item:hover > .fb-hnav-link {
  color: #fff;
  background: var(--fb-sidebar-hover);
  text-decoration: none;
  border-bottom-color: var(--fb-accent);
}
.fb-hnav-item.active > .fb-hnav-link {
  color: #fff;
  border-bottom-color: var(--fb-accent);
  background: rgba(255,255,255,.07);
}
.hnav-icon  { font-size: .8rem; opacity: .8; }
.hnav-label { font-size: .82rem; }
.hnav-arrow { font-size: .65rem; opacity: .6; margin-left: 2px; transition: transform var(--fb-transition); }
.fb-hnav-item:hover .hnav-arrow { transform: rotate(180deg); }

.fb-hnav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  background: var(--fb-sidebar-bg);
  border: 1px solid rgba(255,255,255,.1);
  border-top: 2px solid var(--fb-accent);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  list-style: none;
  margin: 0;
  padding: 6px 0;
  z-index: 1001;
}
.fb-hnav-item.has-dropdown:hover .fb-hnav-dropdown { display: block; }

.fb-hnav-dropdown-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 18px;
  color: var(--fb-sidebar-text);
  font-size: .81rem;
  text-decoration: none;
  transition: all var(--fb-transition);
  white-space: nowrap;
}
.fb-hnav-dropdown-link:hover {
  background: var(--fb-sidebar-hover);
  color: #fff;
  text-decoration: none;
}
.fb-hnav-dropdown-link.active {
  background: var(--fb-sidebar-active);
  color: #fff;
  font-weight: 600;
}

/* ═══════════════════════════════════════════
   PRIORITY 1 — UI ENHANCEMENTS
═══════════════════════════════════════════ */

/* ── #3 Sticky table header (JS-based to preserve column alignment) ── */
.table-responsive {
  overflow-x: auto;
  overflow-y: visible;
}
.fb-table {
  width: 100%;
  border-collapse: collapse;
}
.fb-table thead th {
  background: #f8f9fa;
  box-shadow: inset 0 -1px 0 #dee2e6;
  vertical-align: middle;
}
/* Sticky header cloned by JavaScript */
.fb-table-sticky-header {
  border-collapse: collapse;
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
}

/* ── #1 Sortable column headers ── */
th[data-sort] {
  cursor: pointer;
  user-select: none;
}
th[data-sort]:hover { background: #e9ecef !important; }
th[data-sort] .sort-icon { margin-left: 4px; opacity: .35; font-size: .65rem; vertical-align: middle; }
th[data-sort].sort-asc  .sort-icon { opacity: 1; color: var(--fb-primary); }
th[data-sort].sort-desc .sort-icon { opacity: 1; color: var(--fb-primary); }

/* ── Floating Action Button (mobile) ── */
.fb-fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 800;
  display: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--fb-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  border: none;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
  text-decoration: none;
}
.fb-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(0,0,0,.3); color: #fff; }
.fb-fab i { font-size: 1.35rem; }
@media (max-width: 991.98px) {
  .fb-fab { display: flex; }
}

/* ── Pipeline Stepper Component ── */
.fb-pipeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow-x: auto;
  padding: 16px 0;
  width: 100%;
  white-space: nowrap;
}
.fb-pipeline-step {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  min-width: 70px;
  position: relative;
}
.fb-pipeline-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 19px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--fb-border);
  z-index: 0;
}
.fb-pipeline-step.done::after { background: #28a745; }
.fb-pipeline-step.active::after { background: var(--fb-border); }

.fb-pipeline-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 700;
  border: 2px solid var(--fb-border);
  background: var(--fb-surface);
  color: var(--fb-muted);
  position: relative;
  z-index: 1;
  transition: all .2s ease;
  flex-shrink: 0;
}
.fb-pipeline-step.done .fb-pipeline-circle {
  background: #28a745;
  border-color: #28a745;
  color: #fff;
}
.fb-pipeline-step.active .fb-pipeline-circle {
  background: var(--fb-primary);
  border-color: var(--fb-primary);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(26, 82, 118, .2);
}
.fb-pipeline-step.active .fb-pipeline-circle::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid var(--fb-primary);
  border-radius: 50%;
  opacity: .3;
  animation: fb-pipeline-pulse 1.5s ease-in-out infinite;
}
@keyframes fb-pipeline-pulse {
  0%, 100% { transform: scale(1); opacity: .3; }
  50% { transform: scale(1.2); opacity: .1; }
}

.fb-pipeline-label {
  margin-top: 8px;
  font-size: .7rem;
  text-align: center;
  color: var(--fb-muted);
  max-width: 70px;
  line-height: 1.3;
  font-weight: 500;
}
.fb-pipeline-step.done .fb-pipeline-label { color: #28a745; font-weight: 600; }
.fb-pipeline-step.active .fb-pipeline-label { color: var(--fb-primary); font-weight: 700; }

[data-theme="dark"] .fb-pipeline-step.done .fb-pipeline-circle { background: #1e7e34; border-color: #28a745; }
[data-theme="dark"] .fb-pipeline-step.active .fb-pipeline-circle { background: var(--fb-primary); box-shadow: 0 0 0 3px rgba(26, 82, 118, .4); }

/* ── #5 Empty state illustrations ── */
.fb-empty-state { padding: 3rem 1.5rem; text-align: center; }
.fb-empty-state-icon {
  font-size: 2.8rem;
  opacity: .2;
  margin-bottom: .85rem;
  display: block;
  color: #6c757d;
}
.fb-empty-state-title { font-weight: 600; font-size: .95rem; color: #495057; margin-bottom: .3rem; }
.fb-empty-state-sub   { font-size: .8rem; color: #adb5bd; }

/* ── #7 Skeleton loaders ── */
@keyframes fb-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton {
  display: block;
  background: linear-gradient(90deg, #e8ecf0 25%, #f0f3f6 50%, #e8ecf0 75%);
  background-size: 600px 100%;
  animation: fb-shimmer 1.4s infinite linear;
  border-radius: 4px;
  height: 12px;
  margin-bottom: 8px;
}
.skeleton-value  { height: 32px; border-radius: 6px; margin-bottom: 6px; }
.skeleton-label  { height: 10px; width: 60%; }
.skeleton-chart  { height: 200px; border-radius: 8px; margin-bottom: 0; }
.skeleton-row    { height: 14px; margin-bottom: 10px; }
.skeleton-row.w-75 { width: 75%; }
.skeleton-row.w-50 { width: 50%; }

/* ── #6 Collapsible filter panel ── */
.fb-filter-panel > .fb-card-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fb-filter-panel .fb-filter-toggle-icon {
  font-size: .8rem;
  color: #adb5bd;
  transition: transform .25s ease;
}
.fb-filter-panel.filter-collapsed .fb-filter-toggle-icon { transform: rotate(-180deg); }
.fb-filter-panel .fb-card-body {
  max-height: 500px;
  overflow: hidden;
  transition: max-height .3s ease, padding .25s ease;
}
.fb-filter-panel.filter-collapsed .fb-card-body {
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* ── #4 Column visibility dropdown ── */
.col-vis-toggle .dropdown-menu { min-width: 190px; max-height: 320px; overflow-y: auto; }
.col-vis-toggle .dropdown-item { font-size: .8rem; padding: .35rem 1rem; cursor: pointer; }
.col-vis-toggle .dropdown-item .cv-icon { width: 16px; text-align: center; margin-right: 6px; font-size: .7rem; }
.col-vis-toggle .dropdown-item.col-hidden { color: #adb5bd; }

/* ── #2 Per-page selector ── */
.per-page-form { display: inline-flex; align-items: center; gap: 6px; }
.per-page-form label { font-size: .8rem; color: #6c757d; margin: 0; white-space: nowrap; }
.per-page-form select { width: auto; font-size: .8rem; padding: .2rem .5rem; }

/* ── #10 Flash message progress bar (enhance existing) ── */
.fb-flash { position: relative; overflow: hidden; }
.fb-flash-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  background: rgba(0,0,0,.18);
  animation: fb-flash-shrink 4s linear forwards;
}
@keyframes fb-flash-shrink { from { width: 100%; } to { width: 0%; } }

/* ── #9 Back to list button ── */
.btn-back { font-size: .8rem; }

/* ── Active filter badge on collapsed panel ── */
.filter-active-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--fb-primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  margin-left: 6px;
}
.hnav-sub-icon { font-size: .75rem; width: 16px; text-align: center; opacity: .7; }

/* ══════════════════════════════════════════════════════════════
   PRIORITY 2 UI ENHANCEMENTS
══════════════════════════════════════════════════════════════ */

/* ── #20 Responsive table → card layout on mobile ── */
@media (max-width: 575.98px) {
  .fb-table thead { display: none; }
  .fb-table tbody tr {
    display: block;
    margin-bottom: .75rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: .25rem .5rem;
    background: #fff;
  }
  .fb-table tbody tr:hover { background: #f8f9fa; }
  .fb-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    padding: .4rem .25rem;
    font-size: .82rem;
  }
  .fb-table tbody td:last-child { border-bottom: none; }
  .fb-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6c757d;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    flex-shrink: 0;
    margin-right: .5rem;
    min-width: 80px;
  }
  .fb-table tbody td.no-label::before { display: none; }
  /* Stack the KPI tiles 2-per-row on mobile */
  .row .col-6.col-md-2 { flex: 0 0 50%; max-width: 50%; }
}

/* ── #12 Document drag-drop zones ── */
.fb-dropzone {
  border: 2px dashed #ced4da;
  border-radius: 8px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #fafbfc;
  position: relative;
}
.fb-dropzone.drag-over {
  border-color: var(--fb-primary);
  background: var(--fb-primary-light, #e8f4fd);
  background: color-mix(in srgb, var(--fb-primary) 8%, transparent);
}
.fb-dropzone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.fb-dropzone-icon { font-size: 2rem; color: #ced4da; margin-bottom: .5rem; }
.fb-dropzone-text { font-size: .85rem; color: #6c757d; }
.fb-dropzone-text strong { color: var(--fb-primary); }
.fb-file-preview { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.fb-file-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: #f0f4f8; border: 1px solid #dee2e6;
  border-radius: 20px; padding: .2rem .65rem;
  font-size: .75rem; color: #2d3748;
}
.fb-file-chip .remove-chip {
  cursor: pointer; color: #999; margin-left: .2rem;
  border: none; background: transparent; padding: 0; font-size: .8rem;
}
.fb-file-chip .remove-chip:hover { color: #e74c3c; }

/* ── #17 Quick-view slide-over ── */
.fb-slideover-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1040;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.fb-slideover-backdrop.open { opacity: 1; pointer-events: all; }
.fb-slideover {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 100vw;
  background: #fff;
  z-index: 1041;
  box-shadow: -4px 0 24px rgba(0,0,0,.18);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.fb-slideover.open { transform: translateX(0); }
.fb-slideover-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid #dee2e6;
  flex-shrink: 0;
}
.fb-slideover-title { font-weight: 700; font-size: .95rem; color: #2d3748; }
.fb-slideover-close {
  background: transparent; border: none;
  font-size: 1.25rem; color: #aaa; cursor: pointer; padding: 0 .25rem;
  line-height: 1;
}
.fb-slideover-close:hover { color: #333; }
.fb-slideover-body { flex: 1; overflow-y: auto; padding: 1.25rem; }
.fb-slideover-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 200px; color: #aaa;
}
.fb-qv-field { margin-bottom: .75rem; }
.fb-qv-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; margin-bottom: .15rem; }
.fb-qv-value { font-size: .85rem; color: #2d3748; }
.fb-slideover-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid #dee2e6;
  flex-shrink: 0;
  display: flex; gap: .5rem;
}

/* ── #15 Dashboard date-range picker ── */
.dash-date-range {
  display: inline-flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.18); border-radius: 8px;
  padding: .3rem .75rem; cursor: pointer;
  font-size: .8rem; color: #fff; border: 1px solid rgba(255,255,255,.35);
  transition: background .2s;
}
.dash-date-range:hover { background: rgba(255,255,255,.28); }
.dash-date-range i { opacity: .8; }
#dashDateLabel { font-weight: 600; }

/* ── #13 Inline status badge (clickable) ── */
.fb-badge-clickable {
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.fb-badge-clickable:hover { opacity: .82; transform: scale(1.04); }
.inline-status-menu {
  position: absolute; z-index: 200;
  background: #fff; border: 1px solid #dee2e6;
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12);
  min-width: 160px; padding: .3rem 0; overflow: hidden;
}
.inline-status-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .85rem; font-size: .8rem; cursor: pointer;
  transition: background .1s;
}
.inline-status-item:hover { background: #f8f9fa; }
.inline-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── #16 Print preview modal ── */
.fb-print-preview-thumb {
  background: #f8f9fa; border: 1px solid #dee2e6;
  border-radius: 6px; padding: 1.25rem;
  font-size: .8rem; line-height: 1.6;
}
.fb-print-preview-thumb h5 { font-size: .95rem; font-weight: 700; margin-bottom: .5rem; }

/* ── #18 Recently Viewed dropdown ── */
.rv-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem .85rem; text-decoration: none; color: #2d3748;
  font-size: .82rem; transition: background .1s;
}
.rv-item:hover { background: #f8f9fa; text-decoration: none; color: var(--fb-primary); }
.rv-icon-wrap {
  width: 28px; height: 28px; border-radius: 6px;
  background: #e8f4fd; display: flex; align-items: center;
  justify-content: center; font-size: .75rem; flex-shrink: 0;
  color: var(--fb-primary);
}
.rv-title { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.rv-time { font-size: .65rem; color: #aaa; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════
   PRIORITY 3 UI ENHANCEMENTS
══════════════════════════════════════════════════════════════ */

/* ── #21 Dark mode ── */
[data-theme="dark"] {
  --fb-bg:          #0f1117;
  --fb-surface:     #1a1d23;
  --fb-surface-alt: #222631;
  --fb-border:      #2d3345;
  --fb-text:        #e2e8f0;
  --fb-muted:       #8892a4;
}
[data-theme="dark"] body { background: var(--fb-bg); color: var(--fb-text); }
[data-theme="dark"] .fb-sidebar { background: var(--fb-surface) !important; border-right-color: var(--fb-border) !important; }
[data-theme="dark"] .fb-sidebar-brand { border-bottom-color: var(--fb-border) !important; }
[data-theme="dark"] .fb-sidebar-footer { border-top-color: var(--fb-border) !important; }
[data-theme="dark"] .fb-nav-link { color: var(--fb-muted) !important; }
[data-theme="dark"] .fb-nav-link:hover,
[data-theme="dark"] .fb-nav-link.active { background: var(--fb-surface-alt) !important; color: var(--fb-text) !important; }
[data-theme="dark"] .fb-topbar { background: var(--fb-surface) !important; border-bottom-color: var(--fb-border) !important; }
[data-theme="dark"] .topbar-icon-btn { color: var(--fb-muted) !important; }
[data-theme="dark"] .topbar-icon-btn:hover { background: var(--fb-surface-alt) !important; color: var(--fb-text) !important; }
[data-theme="dark"] .topbar-user-btn { background: var(--fb-surface-alt) !important; color: var(--fb-text) !important; }
[data-theme="dark"] .fb-content { background: var(--fb-bg); }
[data-theme="dark"] .fb-card { background: var(--fb-surface) !important; border-color: var(--fb-border) !important; }
[data-theme="dark"] .fb-card-header { background: var(--fb-surface-alt) !important; border-bottom-color: var(--fb-border) !important; color: var(--fb-text) !important; }
[data-theme="dark"] .fb-card-footer { background: var(--fb-surface-alt) !important; border-top-color: var(--fb-border) !important; }
[data-theme="dark"] .table { color: var(--fb-text); }
[data-theme="dark"] .table thead th { background: var(--fb-surface-alt) !important; border-color: var(--fb-border) !important; color: var(--fb-muted); box-shadow: none !important; }
[data-theme="dark"] .table tbody tr { border-color: var(--fb-border) !important; }
[data-theme="dark"] .table-bordered td, [data-theme="dark"] .table-bordered th { border-color: var(--fb-border) !important; }
[data-theme="dark"] .table-hover tbody tr:hover { background: var(--fb-surface-alt) !important; }
[data-theme="dark"] .form-control,
[data-theme="dark"] .custom-select { background: var(--fb-surface-alt) !important; border-color: var(--fb-border) !important; color: var(--fb-text) !important; }
[data-theme="dark"] .form-control:focus { background: var(--fb-surface) !important; box-shadow: 0 0 0 2px rgba(0,123,255,.25) !important; }
[data-theme="dark"] .input-group-text { background: var(--fb-surface) !important; border-color: var(--fb-border) !important; color: var(--fb-muted) !important; }
[data-theme="dark"] .modal-content { background: var(--fb-surface) !important; border-color: var(--fb-border) !important; }
[data-theme="dark"] .modal-header { border-bottom-color: var(--fb-border) !important; }
[data-theme="dark"] .modal-footer { border-top-color: var(--fb-border) !important; }
[data-theme="dark"] .dropdown-menu { background: var(--fb-surface) !important; border-color: var(--fb-border) !important; }
[data-theme="dark"] .dropdown-item { color: var(--fb-text) !important; }
[data-theme="dark"] .dropdown-item:hover { background: var(--fb-surface-alt) !important; }
[data-theme="dark"] .dropdown-divider { border-color: var(--fb-border) !important; }
[data-theme="dark"] .nav-tabs .nav-link { color: var(--fb-muted); border-color: transparent; }
[data-theme="dark"] .nav-tabs .nav-link.active { background: var(--fb-surface); border-color: var(--fb-border) var(--fb-border) var(--fb-surface); color: var(--fb-text); }
[data-theme="dark"] .nav-tabs { border-bottom-color: var(--fb-border); }
[data-theme="dark"] .breadcrumb { background: transparent; }
[data-theme="dark"] .breadcrumb-item a { color: var(--fb-muted); }
[data-theme="dark"] .breadcrumb-item.active { color: var(--fb-muted); }
[data-theme="dark"] .text-muted { color: var(--fb-muted) !important; }
[data-theme="dark"] .text-dark { color: var(--fb-text) !important; }
[data-theme="dark"] .border, [data-theme="dark"] .border-bottom, [data-theme="dark"] .border-top { border-color: var(--fb-border) !important; }
[data-theme="dark"] .alert-info { background: #1e3a5f; border-color: #2563a6; color: #90caf9; }
[data-theme="dark"] .alert-success { background: #1b3a2a; border-color: #2a6444; color: #81c784; }
[data-theme="dark"] .alert-warning { background: #3d2e0a; border-color: #7a5a0a; color: #ffcc02; }
[data-theme="dark"] .alert-danger { background: #3a1a1a; border-color: #7a2a2a; color: #ef9a9a; }
[data-theme="dark"] .alert-secondary { background: var(--fb-surface-alt); border-color: var(--fb-border); color: var(--fb-muted); }
[data-theme="dark"] .page-link { background: var(--fb-surface); border-color: var(--fb-border); color: var(--fb-text); }
[data-theme="dark"] .page-item.active .page-link { background: var(--fb-primary); border-color: var(--fb-primary); }
[data-theme="dark"] .page-item.disabled .page-link { background: var(--fb-surface-alt); color: var(--fb-muted); }
[data-theme="dark"] .close { color: var(--fb-muted); }
[data-theme="dark"] .fb-slideover { background: var(--fb-surface) !important; }
[data-theme="dark"] .fb-slideover-header { border-bottom-color: var(--fb-border) !important; }
[data-theme="dark"] .fb-slideover-footer { border-top-color: var(--fb-border) !important; }
[data-theme="dark"] hr { border-color: var(--fb-border); }
[data-theme="dark"] code { background: var(--fb-surface-alt); color: #f06292; }
/* Dark mode toggle button */
.dark-mode-btn { transition: color .2s, transform .2s; }
[data-theme="dark"] .dark-mode-btn i::before { content: '\f185'; } /* sun icon */

/* ── #22 Keyboard shortcut hints ── */
.fb-kb-modal .kb-row { display: flex; align-items: center; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid #f0f0f0; font-size: .82rem; }
.fb-kb-modal .kb-row:last-child { border-bottom: none; }
[data-theme="dark"] .fb-kb-modal .kb-row { border-bottom-color: var(--fb-border); }
.kb-key {
  display: inline-flex; align-items: center; gap: .2rem;
  background: #f8f9fa; border: 1px solid #dee2e6; border-bottom: 2px solid #dee2e6;
  border-radius: 4px; padding: .1rem .4rem; font-size: .72rem;
  font-family: monospace; color: #2d3748; flex-shrink: 0;
  min-width: 28px; justify-content: center;
}
[data-theme="dark"] .kb-key { background: var(--fb-surface-alt); border-color: var(--fb-border); color: var(--fb-text); }
.kb-desc { flex: 1; color: #6c757d; }
[data-theme="dark"] .kb-desc { color: var(--fb-muted); }

/* ── #23 Live search suggestions ── */
.search-suggest-box {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid #dee2e6;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 1050; max-height: 360px; overflow-y: auto;
}
[data-theme="dark"] .search-suggest-box { background: var(--fb-surface); border-color: var(--fb-border); }
.suggest-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem .85rem; cursor: pointer;
  text-decoration: none; color: #2d3748;
  border-bottom: 1px solid #f5f5f5;
  transition: background .1s;
}
[data-theme="dark"] .suggest-item { color: var(--fb-text); border-bottom-color: var(--fb-border); }
.suggest-item:hover { background: #f8f9fa; }
[data-theme="dark"] .suggest-item:hover { background: var(--fb-surface-alt); }
.suggest-icon { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: .7rem; flex-shrink: 0; }
.suggest-title { font-size: .82rem; font-weight: 600; }
.suggest-sub { font-size: .7rem; color: #6c757d; }
[data-theme="dark"] .suggest-sub { color: var(--fb-muted); }
.suggest-group-header { padding: .3rem .85rem; font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #aaa; background: #fafbfc; }
[data-theme="dark"] .suggest-group-header { background: var(--fb-surface-alt); color: var(--fb-muted); }
.suggest-empty { padding: 1rem; text-align: center; color: #aaa; font-size: .82rem; }

/* ── #24 Pinned favorites ── */
.fb-pinned-bar {
  padding: .4rem .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
  min-height: 36px;
}
.fb-pin-shortcut {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(255,255,255,.08); color: rgba(255,255,255,.65);
  font-size: .72rem; text-decoration: none; transition: background .15s, color .15s;
  border: none;
}
.fb-pin-shortcut:hover { background: rgba(255,255,255,.18); color: #fff; text-decoration: none; }
.pin-toggle-btn {
  background: transparent; border: none; cursor: pointer;
  color: rgba(255,255,255,.25); font-size: .65rem; padding: .1rem .25rem;
  transition: color .15s; line-height: 1;
}
.pin-toggle-btn:hover,
.fb-nav-link:hover .pin-toggle-btn { color: rgba(255,255,255,.65); }
.fb-nav-link { position: relative; }
.fb-nav-link .pin-toggle-btn { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); }

/* ── #26 Inline field editing ── */
.fb-editable {
  display: inline; cursor: pointer; border-radius: 3px;
  padding: 1px 6px; margin: -1px -6px;
  border: 1px solid transparent;
  transition: border-color .15s, background .15s;
}
.fb-editable:hover { border-color: var(--fb-primary); background: rgba(0,123,255,.05); }
.fb-editable::after { content: ' \f303'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: .65em; opacity: 0; transition: opacity .15s; color: var(--fb-primary); margin-left: 4px; }
.fb-editable:hover::after { opacity: 1; }
.fb-editable-wrap { display: flex; align-items: center; gap: .35rem; }
.fb-editable-input { font-size: inherit; padding: 2px 6px; border: 1px solid var(--fb-primary); border-radius: 4px; outline: none; min-width: 120px; }
.fb-editable-saving { opacity: .5; pointer-events: none; }

/* ── #27 Multi-step wizard ── */
.fb-wizard-steps {
  display: flex; align-items: center; margin-bottom: 2rem;
  position: relative;
}
.fb-wizard-steps::before {
  content: ''; position: absolute; top: 18px; left: 0; right: 0;
  height: 2px; background: #dee2e6; z-index: 0;
}
[data-theme="dark"] .fb-wizard-steps::before { background: var(--fb-border); }
.fb-wizard-step {
  flex: 1; text-align: center; position: relative; z-index: 1;
}
.fb-wizard-step-circle {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  border: 2px solid #dee2e6; background: #fff; color: #aaa;
  margin-bottom: .35rem; transition: all .25s;
}
[data-theme="dark"] .fb-wizard-step-circle { background: var(--fb-surface); border-color: var(--fb-border); }
.fb-wizard-step.active .fb-wizard-step-circle { background: var(--fb-primary); border-color: var(--fb-primary); color: #fff; }
.fb-wizard-step.done .fb-wizard-step-circle { background: #28a745; border-color: #28a745; color: #fff; }
.fb-wizard-step-label { font-size: .7rem; font-weight: 600; color: #aaa; }
.fb-wizard-step.active .fb-wizard-step-label { color: var(--fb-primary); }
.fb-wizard-step.done .fb-wizard-step-label { color: #28a745; }
.fb-wizard-pane { display: none; }
.fb-wizard-pane.active { display: block; }

/* ── #28 File upload progress ── */
.fb-upload-progress {
  display: none;
  margin-top: .65rem;
}
.fb-upload-bar {
  height: 6px; border-radius: 3px; background: #e9ecef; overflow: hidden;
}
.fb-upload-bar-inner {
  height: 100%; width: 0%;
  background: var(--fb-primary);
  border-radius: 3px;
  transition: width .2s;
}
.fb-upload-pct { font-size: .72rem; color: #6c757d; margin-top: .2rem; }

/* ── #29 Auto-save draft banner ── */
.fb-draft-banner {
  background: #e8f4fd; border: 1px solid #bee3f8;
  border-radius: 6px; padding: .6rem 1rem;
  display: flex; align-items: center; gap: .5rem;
  font-size: .82rem; color: #1a6496; margin-bottom: 1rem;
}
[data-theme="dark"] .fb-draft-banner { background: #1e3a5f; border-color: #2563a6; color: #90caf9; }
.fb-draft-banner .draft-restore { font-weight: 600; cursor: pointer; text-decoration: underline; margin-left: .25rem; }
.fb-draft-banner .draft-discard { margin-left: auto; cursor: pointer; opacity: .6; }
.fb-draft-banner .draft-discard:hover { opacity: 1; }

/* ── #30 Tooltip help icon ── */
.fb-help-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #dee2e6; color: #6c757d; font-size: .6rem;
  cursor: help; margin-left: 4px; vertical-align: middle;
  transition: background .15s;
}
.fb-help-icon:hover { background: var(--fb-primary); color: #fff; }
[data-theme="dark"] .fb-help-icon { background: var(--fb-surface-alt); color: var(--fb-muted); }

/* ── Pinned bar header / items (supplement) ── */
.fb-pinned-bar {
  flex-direction: column; align-items: stretch;
}
.fb-pinned-bar-header {
  font-size: .65rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: rgba(255,255,255,.35);
  padding: .2rem 0 .3rem; margin-bottom: .15rem;
}
.fb-pinned-items {
  display: flex; flex-wrap: wrap; gap: .3rem;
}

/* ── Inline editable placeholder ── */
.fb-editable-placeholder { color: #adb5bd; font-style: italic; }
.fb-editable:empty + .fb-editable-placeholder { display: inline; }

/* ── Dark mode topbar icon btn ── */
[data-theme="dark"] .topbar-icon-btn { color: var(--fb-muted); }
[data-theme="dark"] .topbar-icon-btn:hover { color: var(--fb-text); background: var(--fb-surface-alt); }

/* ════════════════════════════════════════════════
   PRIORITY 4 — Accessibility & Polish
   ════════════════════════════════════════════════ */

/* ── #33 Skip-to-content link ── */
.fb-skip-link {
  position: absolute; top: -100px; left: 1rem; z-index: 9999;
  background: var(--fb-primary); color: #fff;
  padding: .5rem 1rem; border-radius: 0 0 6px 6px;
  font-weight: 600; font-size: .875rem; text-decoration: none;
  transition: top .15s;
}
.fb-skip-link:focus { top: 0; color: #fff; }

/* ── #34 Required field legend ── */
.fb-required-legend {
  font-size: .78rem; color: #6c757d; margin-bottom: 1rem;
}
.fb-required-legend .req-star { color: #dc3545; font-weight: 700; }

/* ── #35 High-contrast mode ── */
[data-theme="high-contrast"] {
  --fb-primary:       #0050c8;
  --fb-primary-light: #0068ff;
  --fb-accent:        #f5a623;
  --fb-bg:            #ffffff;
  --fb-surface:       #ffffff;
  --fb-surface-alt:   #f0f0f0;
  --fb-border:        #000000;
  --fb-text:          #000000;
  --fb-muted:         #333333;
  --fb-sidebar-bg:    #000000;
  --fb-sidebar-text:  #ffffff;
  --fb-topbar-bg:     #000000;
  --fb-topbar-text:   #ffffff;
}
[data-theme="high-contrast"] body { color: #000; background: #fff; }
[data-theme="high-contrast"] .fb-card { border: 2px solid #000 !important; box-shadow: none !important; }
[data-theme="high-contrast"] .btn-primary { background: #0050c8 !important; border-color: #0050c8 !important; color: #fff !important; }
[data-theme="high-contrast"] .btn-outline-primary { border: 2px solid #0050c8 !important; color: #0050c8 !important; }
[data-theme="high-contrast"] a { color: #0050c8; text-decoration: underline; }
[data-theme="high-contrast"] .fb-sidebar { background: #000 !important; border-right: 2px solid #fff; }
[data-theme="high-contrast"] .fb-topbar { background: #000 !important; border-bottom: 2px solid #fff; }
[data-theme="high-contrast"] .fb-nav-link { color: #fff !important; }
[data-theme="high-contrast"] .fb-nav-item.active > .fb-nav-link { background: #0050c8 !important; }
[data-theme="high-contrast"] .form-control { border: 2px solid #000 !important; }
[data-theme="high-contrast"] .table td, [data-theme="high-contrast"] .table th { border-color: #000 !important; }
[data-theme="high-contrast"] .badge { border: 1px solid currentColor; }

/* ── #37 Auto-dismiss flash banners ── */
.fb-flash { position: relative; overflow: hidden; }
.fb-dismiss-bar {
  position: absolute; bottom: 0; left: 0; height: 3px;
  background: currentColor; opacity: .35;
  width: 100%; transform-origin: left;
}
@keyframes fb-dismiss-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ══════════════════════════════════════════
   MODERN DOCUMENT UPLOAD & PREVIEW
═════════════════════════════════════════ */

/* Upload Zone */
.fb-upload-zone {
  position: relative;
  border: 2px dashed var(--fb-border);
  border-radius: 8px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, rgba(26,82,118,.02) 0%, rgba(26,82,118,.04) 100%);
}
.fb-upload-zone:hover {
  border-color: var(--fb-primary);
  background: linear-gradient(135deg, rgba(26,82,118,.05) 0%, rgba(26,82,118,.08) 100%);
  box-shadow: 0 4px 12px rgba(26,82,118,.1);
}
.fb-upload-zone.drag-over {
  border-color: var(--fb-primary);
  border-width: 2px;
  background: linear-gradient(135deg, rgba(26,82,118,.08) 0%, rgba(26,82,118,.12) 100%);
  box-shadow: 0 8px 24px rgba(26,82,118,.15);
  transform: scale(1.01);
}
.fb-upload-zone input[type="file"] {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}
.fb-upload-zone-icon {
  font-size: 3rem;
  color: var(--fb-primary);
  margin-bottom: 12px;
  display: block;
  animation: fb-float 3s ease-in-out infinite;
}
@keyframes fb-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.fb-upload-zone-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}
.fb-upload-zone-subtitle {
  font-size: 0.9rem;
  color: var(--fb-muted);
  margin-bottom: 16px;
}
.fb-upload-zone-types {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.fb-file-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: #f0f3f7;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
}
.fb-file-type-badge i { font-size: 0.85rem; }

/* File Chips (Preview) */
.fb-upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.fb-file-chip {
  position: relative;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  text-align: center;
  animation: fb-chip-in 0.3s ease;
}
@keyframes fb-chip-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.fb-file-chip:hover {
  border-color: var(--fb-primary);
  box-shadow: 0 4px 12px rgba(26,82,118,.12);
  transform: translateY(-2px);
}
.fb-file-chip-thumbnail {
  width: 100%;
  height: 100px;
  background: #f8f9fa;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
  position: relative;
}
.fb-file-chip-thumbnail img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}
.fb-file-chip-thumbnail i {
  font-size: 2rem;
  color: var(--fb-primary);
  opacity: 0.5;
}
.fb-file-chip-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: #333;
  word-break: break-word;
  margin-bottom: 4px;
  line-height: 1.2;
  max-height: 2.4em;
  overflow: hidden;
}
.fb-file-chip-size {
  font-size: 0.7rem;
  color: #999;
  margin-bottom: 8px;
}
.fb-file-chip-actions {
  display: flex;
  gap: 4px;
  width: 100%;
  justify-content: center;
}
.fb-file-chip-btn {
  flex: 1;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fb-primary);
  font-size: 0.9rem;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fb-file-chip-btn:hover {
  background: #f0f3f7;
  transform: scale(1.1);
}
.fb-file-chip-btn.remove:hover {
  color: #dc3545;
}
.fb-file-chip-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(26,82,118,.1);
  width: 0%;
  transition: width 0.3s ease;
}
.fb-file-chip-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  padding: 2px 6px;
  background: var(--fb-primary);
  color: #fff;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}
.fb-file-chip-badge.success { background: #28a745; }
.fb-file-chip-badge.error { background: #dc3545; }

/* Upload Progress */
.fb-upload-progress-bar {
  height: 4px;
  background: #f0f3f7;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.fb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--fb-primary) 0%, #2e86c1 100%);
  transition: width 0.3s ease;
  border-radius: 2px;
}
.fb-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #999;
  margin-top: 2px;
}

/* File Preview Modal */
.fb-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,.85);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 16px;
}
.fb-preview-modal.show {
  opacity: 1;
  visibility: visible;
}
.fb-preview-modal-content {
  background: #fff;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  animation: fb-modal-in 0.3s ease;
}
@keyframes fb-modal-in {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.fb-preview-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f3f7;
  flex-shrink: 0;
}
.fb-preview-modal-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
}
.fb-preview-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}
.fb-preview-modal-close:hover {
  background: #f0f3f7;
  color: #333;
}
.fb-preview-modal-body {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fb-preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.fb-preview-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #f0f3f7;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.fb-preview-btn {
  padding: 6px 12px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.fb-preview-btn:hover {
  background: #f0f3f7;
  border-color: var(--fb-primary);
  color: var(--fb-primary);
}

/* Validation Feedback */
.fb-file-error {
  padding: 12px 16px;
  background: #fff5f5;
  border: 1px solid #ffd6d6;
  border-radius: 6px;
  color: #dc3545;
  font-size: 0.9rem;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fb-shake 0.3s ease;
}
@keyframes fb-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.fb-file-success {
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #d4f8dd;
  border-radius: 6px;
  color: #28a745;
  font-size: 0.9rem;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .fb-upload-zone { padding: 24px 16px; }
  .fb-upload-zone-icon { font-size: 2.5rem; }
  .fb-upload-zone-title { font-size: 1rem; }

  .fb-upload-preview {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }

  .fb-preview-modal-content {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* ── #38 Print stylesheet ── */
@media print {
  .fb-sidebar, .fb-topbar, .fb-overlay,
  .fb-page-actions, .fb-flash, .fb-pinned-bar,
  #fbPrintPreviewModal, #sessionWarningModal, #kbHelpModal,
  .fb-skip-link, nav.breadcrumb, .dropdown-menu,
  .fb-filter-panel, .btn-back,
  .no-print { display: none !important; }

  .fb-main  { margin-left: 0 !important; padding: 0 !important; }
  .fb-content { padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; font-size: 11pt; }

  .fb-card { border: 1px solid #ccc !important; box-shadow: none !important; page-break-inside: avoid; }
  .fb-page-header { margin-bottom: 1rem !important; }

  table { border-collapse: collapse !important; width: 100% !important; page-break-inside: auto; }
  thead { display: table-header-group; }
  tr    { page-break-inside: avoid; }
  th, td { border: 1px solid #ccc !important; padding: 4pt 6pt !important; font-size: 9pt; }
  th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .nav-tabs, .tab-pane:not(.active) { display: none !important; }
  .tab-pane.active { display: block !important; }
  a[href]::after { content: none !important; }
}

/* ── #39 AJAX button loading state ── */
.btn-loading { pointer-events: none; opacity: .75; }
.btn-loading .btn-text { display: none; }
.btn-loading .btn-spinner { display: inline-block !important; }
