/* ============================================================
   WikiMarafon — UI theme (clean SaaS, per design reference)
   Indigo-blue accent · light-gray canvas · white rounded cards
   · soft shadows · pastel pill badges · Inter.
   Built on Bootstrap; reimplements the app shell + components.
   Markup, roles, flows and logic are unchanged.
   ============================================================ */

:root {
  --bg:            #f5f6f8;
  --surface:       #ffffff;
  --surface-2:     #fbfbfc;
  --sidebar-bg:    #ffffff;

  --primary:       #00175b;   /* brand deep navy */
  --primary-600:   #163a8f;   /* hover — lifts lighter on the dark base */
  --primary-700:   #0c2a72;   /* link / strong accent text on light surfaces */
  --primary-soft:  rgba(0, 23, 91, 0.10);
  --primary-soft2: rgba(0, 23, 91, 0.06);
  --accent-2:      #4f6ef7;   /* lighter second stop of the brand gradient */

  --ink:           #1f2330;
  --ink-2:         #4a4f60;
  --muted:         #8b8fa3;
  --muted-2:       #a7abba;

  --border:        #ececf1;
  --border-2:      #e3e4ea;
  --hairline:      #eef0f4;

  --radius-xl: 16px;
  --radius-lg: 13px;
  --radius:    10px;
  --radius-sm: 8px;

  --shadow-xs: 0 1px 2px rgba(24, 27, 42, 0.05);
  --shadow-sm: 0 1px 2px rgba(24, 27, 42, 0.04), 0 2px 8px rgba(24, 27, 42, 0.04);
  --shadow-md: 0 2px 6px rgba(24, 27, 42, 0.06), 0 12px 28px rgba(24, 27, 42, 0.07);
  --shadow-lg: 0 18px 48px rgba(24, 27, 42, 0.14);

  --header-h: 64px;
  --sidebar-w: 250px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --bs-primary: var(--primary);
  --bs-link-color: var(--primary-700);
  --bs-link-hover-color: var(--primary-600);
  --bs-border-radius: var(--radius);
  --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body, body.modern-body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1,h2,h3,h4,h5,h6 { font-weight: 700; color: var(--ink); letter-spacing: -0.01em; line-height: 1.25; }
a { color: var(--primary-700); text-decoration: none; }
a:hover { color: var(--primary-600); }
hr { border-color: var(--border); opacity: 1; }
.text-muted { color: var(--muted) !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d7d9e2; border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c3c6d3; }

/* ============================================================
   APP SHELL — header (fixed top), sidebar (fixed left), content
   ============================================================ */
.modern-layout { min-height: 100vh; }

.modern-header.fixed-top,
.modern-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1030;
  display: flex;
  align-items: center;
  padding: 0 18px;
}
.modern-header .container-fluid { padding: 0; }
.modern-header .row { width: 100%; }

.modern-sidebar, .sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 14px 12px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1020;
  transition: transform 0.28s var(--ease);
}

.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  transition: margin-left 0.28s var(--ease);
}
.content-wrapper { flex: 1; padding: 22px 24px; }

/* Desktop collapse (button toggles body.toggle-sidebar) */
@media (min-width: 1200px) {
  body.toggle-sidebar .modern-sidebar,
  body.toggle-sidebar .sidebar { transform: translateX(-100%); }
  body.toggle-sidebar .main-content { margin-left: 0; }
}

/* Mobile: sidebar is off-canvas; ".open" reveals it */
@media (max-width: 1199.98px) {
  .modern-sidebar, .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .modern-sidebar.open, .sidebar.open { transform: translateX(0) !important; }
  .main-content { margin-left: 0; }
  .content-wrapper { padding: 16px; }
}

/* ============================================================
   SIDEBAR NAV — modern
   ============================================================ */
.sidebar-nav, .modern-sidebar-nav { list-style: none; margin: 0; padding: 0; }
.sidebar-nav .nav-item { margin: 2px 0; }

/* thin, quiet scrollbar inside the sidebar */
.modern-sidebar::-webkit-scrollbar, .sidebar::-webkit-scrollbar { width: 6px; }
.modern-sidebar::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb { background: #e2e4ec; border: none; border-radius: 999px; }
.modern-sidebar:hover::-webkit-scrollbar-thumb, .sidebar:hover::-webkit-scrollbar-thumb { background: #d3d6e0; }

/* Section labels */
.nav-heading, .modern-nav-heading {
  color: var(--muted-2);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 12px;
  margin: 20px 0 7px;
  user-select: none;
}
.sidebar-nav > .nav-item:first-child .modern-nav-link,
.sidebar-nav .nav-heading:first-child { margin-top: 4px; }

/* Top-level link */
.sidebar-nav .nav-link,
.modern-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 11px;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.2;
  text-decoration: none;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.sidebar-nav .nav-link:hover,
.modern-nav-link:hover { background: #f1f2f7; color: var(--ink); }

/* Active = solid blue pill */
.sidebar-nav .nav-link.active,
.modern-nav-link.active {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-600) 100%);
  color: #fff;
  box-shadow: 0 8px 18px -6px rgba(0, 23, 91, 0.55);
  font-weight: 600;
}
.modern-nav-link.active .nav-text { color: #fff; }

/* Icon — clean glyph, no box */
.nav-icon-wrapper {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.12rem;
  color: var(--muted);
  flex-shrink: 0;
  background: transparent;
  transition: color 0.16s var(--ease), transform 0.16s var(--ease);
}
.modern-nav-link:hover .nav-icon-wrapper { color: var(--primary-700); }
.modern-nav-link.active .nav-icon-wrapper { color: #fff; }
.nav-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modern-nav-link .bi-chevron-down { font-size: 0.7rem; color: inherit; opacity: 0.6; transition: transform 0.2s var(--ease); }
.modern-nav-link[aria-expanded="true"] .bi-chevron-down,
.modern-nav-link:not(.collapsed) .bi-chevron-down { transform: rotate(180deg); }

/* Submenu — guided indent */
.nav-content {
  list-style: none;
  margin: 3px 0 4px;
  padding: 2px 0 2px 22px;
  position: relative;
}
.nav-content::before {
  content: ""; position: absolute;
  left: 17px; top: 4px; bottom: 4px;
  width: 1.5px; background: var(--border-2); border-radius: 2px;
}
.nav-content li { position: relative; }
.nav-content a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 0.84rem;
  font-weight: 500;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.nav-content a i {
  font-size: 0.5rem; color: var(--muted-2);
  transition: color 0.16s var(--ease), transform 0.16s var(--ease);
}
.nav-content a:hover { background: #f1f2f7; color: var(--ink); }
.nav-content a:hover i { color: var(--primary); }
.nav-content a.active { color: var(--primary-700); font-weight: 600; background: var(--primary-soft); }
.nav-content a.active i { color: var(--primary); }

/* ============================================================
   HEADER / NAVBAR — modern
   ============================================================ */
.modern-header { box-shadow: 0 1px 0 var(--border), 0 4px 16px -12px rgba(24,27,42,0.18) !important; }

/* Icon buttons (hamburger, bell, mobile search) */
.toggle-sidebar-btn, .nav-btn, .search-toggle-btn, .notification-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  border-radius: 11px;
  color: var(--ink-2);
  font-size: 1.18rem;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.toggle-sidebar-btn:hover, .nav-btn:hover, .search-toggle-btn:hover,
.notification-btn:hover { background: var(--primary-soft); color: var(--primary-700); }

.brand-logo { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo .logo-img { max-height: 34px; transition: transform 0.16s var(--ease); }
.brand-logo:hover .logo-img { transform: scale(1.04); }
.brand-text { font-weight: 800; font-size: 1.15rem; color: var(--ink); letter-spacing: -0.02em; margin-left: 8px; }

/* Search — soft pill, indigo focus */
.header-search { max-width: 560px; }
.search-form { width: 100%; }
.search-input-group {
  display: flex; align-items: center;
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 0 6px 0 14px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease);
}
.search-input-group:hover { background: #eef0f5; }
.search-input-group:focus-within {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.search-input {
  flex: 1; border: none; outline: none; background: transparent;
  height: 42px; font-size: 0.88rem; color: var(--ink);
}
.search-input::placeholder { color: var(--muted-2); }
.search-btn {
  border: none; background: transparent; color: var(--muted);
  width: 34px; height: 34px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.search-btn:hover { color: #fff; background: var(--primary); }

/* Notifications */
.notification-btn { position: relative; }
.notification-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: #ef4d6a; color: #fff;
  font-size: 0.64rem; font-weight: 800;
  border-radius: 999px; border: 2px solid var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(239,77,106,0.5);
}

/* Avatar / profile trigger */
.nav-profile {
  text-decoration: none; padding: 4px 6px 4px 4px; border-radius: 999px;
  display: inline-flex; align-items: center;
  border: 1px solid transparent;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.nav-profile:hover { background: var(--bg); border-color: var(--border); }
.modern-avatar, .modern-avatar-placeholder {
  width: 36px; height: 36px; border-radius: 999px; object-fit: cover;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--primary-soft);
}
.modern-avatar-placeholder {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-2) 100%);
  color: #fff;
}
.modern-username { color: var(--ink); font-weight: 600; font-size: 0.88rem; }
.nav-profile .dropdown-toggle::after { color: var(--muted-2); }

/* ============================================================
   DROPDOWNS
   ============================================================ */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  background: var(--surface);
  min-width: 240px;
}
.dropdown-item, .modern-menu-item {
  display: flex; align-items: center;
  border-radius: 9px; padding: 9px 10px;
  color: var(--ink-2); font-size: 0.88rem; font-weight: 500;
}
.dropdown-item:hover, .modern-menu-item:hover { background: var(--primary-soft2); color: var(--ink); }
.dropdown-item.logout-item:hover, .modern-menu-item.logout-item:hover { background: #fdeaed; color: #c0314a; }
.menu-icon-wrapper {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--ink-2);
}
.dropdown-divider, .modern-divider { border-color: var(--border); margin: 6px 0; }

/* Notification / profile dropdown headers (colored, white text) */
.modern-dropdown-header, .modern-profile-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-2) 100%);
  color: #fff;
  border-radius: 11px;
  padding: 14px;
  margin: -8px -8px 8px;
}
.modern-profile-header { text-align: center; }
/* Force readable text inside the colored headers (children carry their own
   ink/muted colors which otherwise blend into the indigo background). */
.modern-profile-header h6, .modern-profile-header span, .modern-profile-header p,
.modern-profile-header small, .modern-profile-header .text-muted,
.modern-dropdown-header h6, .modern-dropdown-header span,
.modern-dropdown-header .text-muted { color: #fff !important; }
.modern-profile-header .text-muted, .modern-profile-header small,
.modern-profile-header .small { color: rgba(255,255,255,0.82) !important; }
/* Avatar sitting on the colored header — give it contrast, not the same indigo. */
.modern-profile-header .modern-avatar,
.modern-profile-header .modern-avatar-placeholder {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.45) !important;
}
.modern-profile-header .modern-avatar-placeholder {
  background: rgba(255,255,255,0.22) !important;
}
.header-icon-wrapper, .modal-icon-wrapper {
  width: 36px; height: 36px; border-radius: 9px;
  background: rgba(255,255,255,0.2); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.modern-notification-item { display: flex; gap: 4px; padding: 10px; border-radius: 10px; }
.modern-notification-item:hover { background: var(--surface-2); }
.notification-icon-bg {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary-700);
  display: inline-flex; align-items: center; justify-content: center;
}
.notification-title { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.notification-time, .notification-body { font-size: 0.78rem; color: var(--muted); }
.modern-role-badge {
  background: var(--primary-soft); color: var(--primary-700);
  font-size: 0.62rem; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  text-transform: uppercase; margin-left: 6px;
}
.modern-empty-notifications { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty-icon-wrapper { font-size: 1.8rem; color: var(--muted-2); margin-bottom: 6px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  --bs-btn-border-radius: 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 8px 15px;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.06s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 5px 11px; font-size: 0.8rem; border-radius: 8px; }
.btn-lg { padding: 11px 20px; font-size: 0.95rem; border-radius: 12px; }
.btn i { font-size: 0.95em; }

.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 4px 12px rgba(0,23,91,0.22);
}
.btn-primary:hover, .btn-primary:focus { background: var(--primary-600); border-color: var(--primary-600); color: #fff; box-shadow: 0 6px 16px rgba(0,23,91,0.30); }
.btn-primary:active { background: var(--primary-700); border-color: var(--primary-700); }

.btn-outline-primary { color: var(--primary-700); border-color: var(--primary); background: #fff; }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

.btn-outline-secondary { color: var(--ink-2); border-color: var(--border-2); background: #fff; }
.btn-outline-secondary:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

.btn-secondary, .btn-light { background: #fff; border-color: var(--border-2); color: var(--ink); }
.btn-secondary:hover, .btn-light:hover { background: var(--bg); border-color: var(--border-2); color: var(--ink); }

.btn-success { background: #22a565; border-color: #22a565; color: #fff; }
.btn-success:hover { background: #1c8e57; border-color: #1c8e57; }
.btn-danger  { background: #ef4d6a; border-color: #ef4d6a; color: #fff; }
.btn-danger:hover { background: #e03457; border-color: #e03457; }
.btn-warning { background: #f5a524; border-color: #f5a524; color: #fff; }
.btn-info    { background: #4aa3df; border-color: #4aa3df; color: #fff; }
.btn-outline-info { color: #2f80b8; border-color: #9fcdeb; background:#fff; }
.btn-outline-info:hover { background:#4aa3df; border-color:#4aa3df; color:#fff; }

.btn-group .btn { box-shadow: none; }

/* ============================================================
   CARDS
   ============================================================ */
.card, .info-card, .modern-stats-card, .modern-form-card, .dashboard-card,
.article-filter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card { margin-bottom: 18px; }
.card-body { padding: 18px; }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--hairline);
  padding: 14px 18px;
  font-weight: 700; color: var(--ink);
}
.card-title { font-weight: 700; color: var(--ink); }
.card-footer { background: transparent; border-top: 1px solid var(--hairline); }

.info-card { padding: 4px; transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease); }
.info-card:hover { box-shadow: var(--shadow-md); }

.card-icon-lg {
  width: 48px; height: 48px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-700);
  font-size: 1.4rem;
}

/* Stat cards */
.modern-stats-card { padding: 16px 18px; position: relative; overflow: hidden; }
.modern-stats-icon {
  width: 44px; height: 44px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-700); font-size: 1.2rem;
}
.modern-stats-value { font-size: 1.7rem; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }
.modern-stats-title { color: var(--muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* Page title */
.modern-page-title, .page-title h1, .page-title { font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select, .modern-input {
  background: #fff;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  color: var(--ink);
  font-size: 0.88rem;
  min-height: 42px;
  padding: 8px 12px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.form-control::placeholder { color: var(--muted-2); }
.form-control:focus, .form-select:focus, .modern-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: #fff;
}
.form-label { font-weight: 600; color: var(--ink); font-size: 0.84rem; margin-bottom: 5px; }
.input-group-text { background: var(--bg); border: 1px solid var(--border-2); color: var(--muted); border-radius: 10px; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ============================================================
   TABLES
   One system for every variant used across the app:
   .table, .modern-table and the legacy .table-modern alias all
   share the same header, cell, hover, striped and dark-mode styling.
   ============================================================ */
.card > .table, .table, .modern-table {
  color: var(--ink);
  margin-bottom: 0;
  --bs-table-bg: transparent;
  --bs-table-color: var(--ink);
  border-color: var(--hairline);
  width: 100%;
}

/* Header row */
.table thead th, .table-light th,
.modern-table thead th, .table-modern thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-2);
  border-top: none;
  padding: 11px 14px;
  white-space: nowrap;
  vertical-align: middle;
}

/* Body cells */
.table tbody td,
.modern-table tbody td, .table-modern tbody td {
  padding: 12px 14px;
  border-top: 1px solid var(--hairline);
  vertical-align: middle;
  color: var(--ink-2);
}
.table tbody tr:first-child td,
.modern-table tbody tr:first-child td { border-top: none; }
.table-sm td, .table-sm th { padding: 8px 10px; }

/* Comfortable edge padding so content clears the rounded wrapper */
.table > :not(caption) > * > *:first-child,
.modern-table > :not(caption) > * > *:first-child { padding-left: 16px; }
.table > :not(caption) > * > *:last-child,
.modern-table > :not(caption) > * > *:last-child { padding-right: 16px; }

/* Hover — all table variants, not just .table-hover */
.table-hover tbody tr,
.modern-table tbody tr, .table-modern tbody tr { transition: background 0.12s var(--ease); }
.table-hover tbody tr:hover,
.modern-table tbody tr:hover, .table-modern tbody tr:hover { background: var(--primary-soft2); }

/* Striped — replace Bootstrap's grey stripes with a quiet surface tint */
.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: var(--surface-2);
  background: var(--surface-2);
  color: var(--ink-2);
}
.table-striped.table-hover > tbody > tr:hover > * { background: var(--primary-soft2); }

/* Borderless */
.table-borderless tbody td,
.table-borderless thead th,
.table-borderless tbody tr:first-child td { border: 0; }

/* Responsive wrapper — rounded card-like frame that also clips the corners */
.table-responsive {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
/* When the table already sits inside a .card, drop the duplicate frame */
.card .table-responsive, .card-body .table-responsive,
.base-card .table-responsive, .modern-card .table-responsive {
  border: none;
  border-radius: 0;
  background: transparent;
}

/* Common in-cell helpers used by list pages */
.worker-info { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 0.86rem; }
.worker-info .bi { color: var(--muted); }
.date-time { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.text-break { word-break: break-word; }

/* ============================================================
   BADGES & STATUS PILLS (pastel, per reference)
   ============================================================ */
.badge {
  font-weight: 600; font-size: 0.72rem;
  padding: 0.36em 0.7em;
  border-radius: 999px;
}
.badge.bg-primary   { background: var(--primary) !important; color: #fff !important; }
.badge.bg-secondary { background: #eceef3 !important; color: #5b6072 !important; }
.badge.bg-success   { background: #def2e6 !important; color: #1c8e57 !important; }
.badge.bg-danger    { background: #fde4e8 !important; color: #d23153 !important; }
.badge.bg-warning   { background: #fdefd5 !important; color: #a06a08 !important; }
.badge.bg-info      { background: #e0f0fb !important; color: #2f80b8 !important; }
.badge.bg-light     { background: #f1f2f6 !important; color: #5b6072 !important; }
.badge.bg-dark      { background: #e7e8ee !important; color: var(--ink) !important; }

.modern-badge, .article-step-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
  background: #f1f2f6; color: #5b6072;
}
/* Status palette */
.status-draft    { background: #eef0f4; color: #5b6072; }
.status-pending  { background: #fdefd5; color: #a06a08; }
.status-process  { background: #ede9fe; color: #6d34d6; }
.status-confirm  { background: var(--primary-soft); color: var(--primary-700); }
.status-approved { background: #def2e6; color: #1c8e57; }
.status-publish  { background: #def2e6; color: #1c8e57; }
.status-reject   { background: #fde4e8; color: #d23153; }
.status-cancel   { background: #eef0f4; color: #8b8fa3; }

/* ============================================================
   TABS / PILLS
   ============================================================ */
.nav-tabs { border-bottom: 1px solid var(--border); gap: 4px; }
.nav-tabs .nav-link {
  border: none; color: var(--muted); font-weight: 600; font-size: 0.86rem;
  padding: 10px 12px; border-bottom: 2px solid transparent; background: transparent;
}
.nav-tabs .nav-link:hover { color: var(--ink); border-bottom-color: var(--border-2); }
.nav-tabs .nav-link.active { color: var(--primary-700); background: transparent; border-bottom-color: var(--primary); }

.nav-pills, .article-status-tabs, .modern-status-tabs { gap: 6px; flex-wrap: wrap; }
.nav-pills .nav-link, .modern-pill-link, .article-status-tabs .nav-link {
  color: var(--ink-2); font-weight: 600; font-size: 0.82rem;
  border-radius: 999px; padding: 7px 14px;
  background: var(--surface); border: 1px solid var(--border);
}
.nav-pills .nav-link:hover, .modern-pill-link:hover, .article-status-tabs .nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-pills .nav-link.active, .modern-pill-link.active, .article-status-tabs .nav-link.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,23,91,0.25);
}

/* Filter bars */
.article-filter-card { padding: 14px 16px; margin-bottom: 16px; }
.article-filter-title, .modern-page-title small { color: var(--muted); }
.article-filter-bar, .article-filter-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   SEARCH / FILTER / SELECT SECTIONS
   These classes were referenced by markup (search/field components,
   finance & report filter bars) but had no styling, so the sections
   rendered as raw stacked controls. One consistent, dark/navy-aware
   treatment for all of them.
   ============================================================ */

/* Inline filter toolbar (GET forms above lists) */
.filters-section { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Search component — components/forms/search_form.html */
.modern-search-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modern-search-group {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 0 5px 0 12px;
  min-width: 240px; flex: 1 1 240px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.modern-search-group:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.modern-search-input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  height: 38px; font-size: .88rem; color: var(--ink);
}
.modern-search-input::placeholder { color: var(--muted-2); }
.modern-search-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: var(--primary); color: #fff;
  height: 30px; padding: 0 12px; border-radius: 8px;
  font-size: .82rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .16s var(--ease);
}
.modern-search-btn:hover { background: var(--primary-600); }
.modern-search-icon { font-size: .9rem; }
.modern-clear-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  border: 1px solid var(--border-2); background: var(--surface);
  color: var(--muted); text-decoration: none;
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.modern-clear-btn:hover { background: var(--primary-soft); color: var(--primary-700); border-color: var(--primary); }

/* Field component — components/forms/form_field.html */
.modern-field-group { margin-bottom: 16px; }
.modern-field-label { display: block; font-weight: 600; color: var(--ink); font-size: .84rem; margin-bottom: 5px; }
.modern-form-control, .modern-form-select, .modern-form-textarea {
  width: 100%;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 10px; color: var(--ink); font-size: .88rem;
  min-height: 42px; padding: 8px 12px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.modern-form-textarea { min-height: 92px; resize: vertical; }
.modern-form-control:focus, .modern-form-select:focus, .modern-form-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); outline: none;
}
.modern-form-control::placeholder, .modern-form-textarea::placeholder { color: var(--muted-2); }
.modern-form-check { display: flex; align-items: center; gap: 8px; }
.modern-form-check-input { width: 18px; height: 18px; }
.modern-form-check-label { color: var(--ink-2); font-size: .88rem; }
.modern-field-help { color: var(--muted); font-size: .78rem; margin-top: 5px; }
.modern-field-error { color: var(--primary-700); font-size: .78rem; margin-top: 5px; }
.modern-field-error i { color: #ef4d6a; }
.modern-field-group.has-error .modern-form-control,
.modern-field-group.has-error .modern-form-select,
.modern-field-group.has-error .modern-form-textarea { border-color: #ef4d6a; }
.modern-form-file { border: 1.5px dashed var(--border-2); border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); }

/* Status filter chip rows (finance / report) — align with the article tabs */
.status-tabs-container, .modern-status-tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status-tabs { margin-bottom: 14px; }

/* Native date / time inputs — consistent height + dark-mode picker glyph */
input[type="date"], input[type="datetime-local"], input[type="time"], input[type="month"] { min-height: 42px; }
.form-control-sm, .form-select-sm { min-height: 34px; font-size: .82rem; border-radius: 8px; padding: 5px 10px; }
input[type="date"].form-control-sm, input[type="time"].form-control-sm { min-height: 34px; }
[data-bs-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-bs-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-bs-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-bs-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator { filter: invert(0.85); }

/* Stacked date / created cells in list tables */
.date-info, .created-info { display: inline-flex; flex-direction: column; line-height: 1.25; }
.date-primary, .created-date { color: var(--ink-2); font-weight: 600; font-size: .85rem; }
.date-secondary, .created-time { color: var(--muted); font-size: .76rem; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { gap: 4px; }
.page-link {
  color: var(--ink-2); border: 1px solid var(--border);
  border-radius: 9px !important; padding: 7px 12px; font-size: 0.84rem;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.page-link:hover { background: var(--surface-2); color: var(--ink); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-item.disabled .page-link { color: var(--muted-2); background: #fff; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-content, .modern-modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header, .modern-modal-header {
  border-bottom: 1px solid var(--hairline);
  padding: 16px 20px;
}
.modern-modal-header { background: var(--primary); color: #fff; }
.modern-modal-header .modal-title, .modern-modal-header .modal-subtitle { color: #fff; }
.modal-body { padding: 20px; }
.modal-footer, .modern-modal-footer { border-top: 1px solid var(--hairline); padding: 14px 20px; }
.btn-close { border-radius: 8px; }
.modern-btn-close { filter: invert(1) grayscale(1) brightness(2); opacity: 0.9; }

/* ============================================================
   ALERTS / MESSAGES
   ============================================================ */
.alert {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 15px;
  font-size: 0.88rem;
  box-shadow: var(--shadow-xs);
}
.alert-success { background: #ecf8f1; border-color: #c9ebd8; color: #167a4a; }
.alert-danger, .alert-error { background: #fdecef; border-color: #f7ccd5; color: #c0314a; }
.alert-warning { background: #fdf4e1; border-color: #f6e3bd; color: #95650a; }
.alert-info { background: #eaf3fc; border-color: #cfe5f8; color: #2c6f9e; }

/* ============================================================
   FOOTER — modern
   ============================================================ */
.modern-footer, footer.modern-footer {
  background: linear-gradient(180deg, var(--surface) 0%, #fbfbfd 100%);
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 16px 24px;
  font-size: 0.82rem;
  margin-top: 8px;
}
.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}
.modern-copyright { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); }
.modern-copyright .bi-c-circle { color: var(--muted-2); }
.modern-footer .brand-text {
  font-weight: 700; letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.modern-credits { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.footer-divider { color: var(--border-2); }
.modern-footer a, .modern-footer .brand-link {
  display: inline-flex; align-items: center; gap: 1px;
  color: var(--primary-700); font-weight: 600; text-decoration: none;
  padding: 2px 8px; border-radius: 999px;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.modern-footer a:hover, .modern-footer .brand-link:hover { background: var(--primary-soft); color: var(--primary-600); }
.modern-footer .brand-link .bi-heart-fill { color: #ef4d6a; }

@media (max-width: 575.98px) {
  .footer-divider { display: none; }
  .footer-content { flex-direction: column; gap: 4px; }
}

/* ============================================================
   PAGE COMPONENTS — styles for bespoke classes used across
   finance / report / users / articles / AI / error pages.
   ============================================================ */

/* ---- Cards ---- */
.base-card, .modern-card, .chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.base-card { padding: 18px; margin-bottom: 18px; }
.glass-effect {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ---- Colored stat cards (finance/report) ---- */
.stats-card {
  position: relative;
  border-radius: var(--radius-lg);
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-2) 100%);
}
.stats-card.gradient-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--accent-2) 100%); }
.stats-card.gradient-success { background: linear-gradient(135deg, #1f9d63 0%, #44c98a 100%); }
.stats-card.gradient-info    { background: linear-gradient(135deg, #2f8fd6 0%, #5bc0f0 100%); }
.stats-card.gradient-warning { background: linear-gradient(135deg, #e89412 0%, #f6b73c 100%); }
.stats-card.gradient-danger  { background: linear-gradient(135deg, #e0445f 0%, #f47a8d 100%); }
.stats-card.gradient-secondary { background: linear-gradient(135deg, #5a6072 0%, #868ca0 100%); }
.stats-card-body { padding: 18px 20px; }
.stats-content { display: flex; align-items: center; gap: 16px; }
.stats-icon {
  width: 52px; height: 52px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 14px; font-size: 1.5rem;
  background: rgba(255,255,255,0.22); color: #fff;
}
.stats-info { min-width: 0; }
.stats-number {
  font-size: 1.7rem; font-weight: 800; line-height: 1.1;
  letter-spacing: -0.02em; color: #fff; margin: 0;
}
.stats-label { font-size: 0.82rem; font-weight: 500; color: rgba(255,255,255,0.88); margin: 2px 0 6px; }
.stats-badge .badge, .stats-card .badge.bg-white {
  background: rgba(255,255,255,0.22) !important; color: #fff !important;
  font-weight: 600; border-radius: 999px;
}
.stats-card .bg-opacity-20 { background: rgba(255,255,255,0.22) !important; }

/* ---- Chart cards ---- */
.chart-card { margin-bottom: 18px; }
.chart-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--hairline);
}
.chart-header-content { display: flex; align-items: center; gap: 12px; }
.chart-icon {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-700); font-size: 1.15rem;
}
.chart-title { font-size: 1rem; font-weight: 700; color: var(--ink); margin: 0; }
.chart-actions { display: flex; gap: 8px; align-items: center; }
.chart-body, .chart-container { padding: 18px; }
.chart-body canvas, .chart-container canvas, .echart { max-width: 100%; }

/* ---- Forms ---- */
.modern-form-card { margin-bottom: 18px; }
.modern-form-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-2) 100%) !important;
  color: #fff !important;
  border-bottom: none !important;
  padding: 18px 20px !important;
}
.modern-form-header h1, .modern-form-header h2, .modern-form-header h3,
.modern-form-header h4, .modern-form-header h5, .modern-form-header h6,
.modern-form-header p, .modern-form-header .text-muted, .modern-form-header span { color: #fff !important; }
.modern-form-header .text-muted, .modern-form-header small { color: rgba(255,255,255,0.85) !important; }
.modern-form-body { padding: 22px !important; }
.user-form-section, .modern-form-section { margin-bottom: 22px; }
.user-form-section:last-child { margin-bottom: 0; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.92rem; font-weight: 700; color: var(--ink);
  padding-bottom: 10px; margin-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
}
.section-title i, .section-title .bi { color: var(--primary); }
.modern-form-control { /* alias of form-control */ }
label.label, .form-label, .label { font-weight: 600; color: var(--ink); font-size: 0.84rem; }
.password-toggle {
  border: none; background: transparent; color: var(--muted);
  z-index: 5; border-radius: 8px;
}
.password-toggle:hover { color: var(--primary-700); background: var(--bg); }
.password-section { border-top: 1px solid var(--hairline); padding-top: 16px; margin-top: 6px; }

/* Profile photo (profile modal) */
.profile-photo-section .current-photo-wrapper { display: inline-block; }
.profile-photo-preview, .profile-photo-placeholder {
  border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
}
.photo-change-btn { bottom: 4px; right: 4px; width: 34px; height: 34px; border-radius: 999px; padding: 0; }

/* ---- Modern table + column/cell helpers ---- */
.modern-table { width: 100%; color: var(--ink); }
.modern-table thead th { background: var(--surface-2); color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.checkbox-col { width: 38px; }
.index-col { width: 48px; color: var(--muted); }
.actions-col { width: 1%; white-space: nowrap; text-align: right; }
.status-col, .date-col, .created-col, .amount-col { white-space: nowrap; }
.amount-display { display: inline-flex; align-items: baseline; gap: 4px; }
.amount-value { font-weight: 700; color: var(--ink); font-size: 0.95rem; }
.amount-currency { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.action-buttons, .modern-action-buttons { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.meta-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 8px; font-size: 0.72rem; font-weight: 600;
}
.status-badge, .badge-modern {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2);
}

/* ---- Modern pagination (article lists) ---- */
.modern-pagination { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.modern-pagination-item { list-style: none; }
.modern-pagination-link, .modern-pagination-prev, .modern-pagination-next {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 11px;
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--ink-2); font-size: 0.84rem; font-weight: 600; text-decoration: none;
  background: var(--surface);
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.modern-pagination-link:hover, .modern-pagination-prev:hover, .modern-pagination-next:hover {
  background: var(--surface-2); color: var(--ink); border-color: var(--border-2);
}
.modern-pagination-item.active .modern-pagination-link,
.modern-pagination-link.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.modern-pagination-disabled, .modern-pagination-disabled .modern-pagination-link {
  opacity: 0.5; pointer-events: none;
}
.modern-pagination-info { color: var(--muted); font-size: 0.82rem; padding: 0 6px; }

/* ---- Buttons / pills extras ---- */
.modern-btn { border-radius: 10px; font-weight: 600; }
.status-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-2); font-size: 0.82rem; font-weight: 600; text-decoration: none;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.status-tab:hover { background: var(--surface-2); color: var(--ink); }
.status-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- Empty states ---- */
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state i, .empty-state .bi { font-size: 2.4rem; color: var(--muted-2); display: block; margin-bottom: 10px; }
.empty-state h3, .empty-state h5, .empty-state .title { color: var(--ink-2); font-size: 1rem; font-weight: 700; margin: 0 0 4px; }
.empty-state .subtitle { color: var(--muted); font-size: 0.86rem; }

/* ---- Article / prose content ---- */
.content-section { margin-bottom: 22px; }
.content-text, .content-preview { color: var(--ink-2); line-height: 1.7; }
.content-preview {
  max-height: 220px; overflow: hidden; position: relative;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
  background: var(--surface-2);
}
.article-title { font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 0.84rem; }
.prose { color: #2b2f3a; line-height: 1.75; font-size: 0.95rem; max-width: 76ch; }
.prose.prose-lg { font-size: 1.02rem; }
.prose h1, .prose h2, .prose h3 { margin: 1.4em 0 0.5em; line-height: 1.3; }
.prose h2 { font-size: 1.4rem; } .prose h3 { font-size: 1.15rem; }
.prose p { margin: 0 0 1em; }
.prose a { color: var(--primary-700); text-decoration: underline; text-underline-offset: 2px; }
.prose ul, .prose ol { margin: 0 0 1em 1.25em; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; }
.prose blockquote { border-left: 3px solid var(--primary); padding-left: 14px; color: var(--muted); margin: 1em 0; }

/* ---- AI pages ---- */
.ai-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-2) 100%);
  color: #fff; border-radius: var(--radius-lg); padding: 22px;
  margin-bottom: 18px;
}
.ai-header h1, .ai-header h2, .ai-header h3, .ai-header p, .ai-header .text-muted { color: #fff !important; }
.quality-bar { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.quality-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent-2)); border-radius: 999px; }
.success-rate, .score { font-weight: 800; color: var(--primary-700); }

/* ---- Timeline ---- */
.timeline-item { position: relative; padding: 0 0 16px 24px; }
.timeline-item::before { content: ""; position: absolute; left: 6px; top: 5px; width: 9px; height: 9px; border-radius: 999px; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.timeline-item::after { content: ""; position: absolute; left: 10px; top: 16px; bottom: 0; width: 1.5px; background: var(--border-2); }
.timeline-item:last-child::after { display: none; }
.timeline-item .time { font-size: 0.76rem; color: var(--muted); }
.timeline-item .description { color: var(--ink-2); }

/* ---- Back to top ---- */
.back-to-top, .modern-back-to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 996;
  width: 42px; height: 42px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; border: none;
  box-shadow: var(--shadow-md); opacity: 0; visibility: hidden;
  transition: opacity 0.2s var(--ease), visibility 0.2s var(--ease);
}
.back-to-top.active, .modern-back-to-top.active { opacity: 1; visibility: visible; }

/* ---- Error pages ---- */
.error-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.error-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  padding: 40px 34px; max-width: 460px; width: 100%; text-align: center;
}
.error-icon {
  width: 76px; height: 76px; margin: 8px auto 16px; border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-700); font-size: 2.2rem;
}
.error-title { font-size: 3.4rem; font-weight: 800; color: var(--primary); letter-spacing: -0.03em; margin: 0; line-height: 1; }
.error-subtitle { font-size: 1.25rem; font-weight: 700; color: var(--ink); margin: 8px 0 6px; }
.error-description { color: var(--muted); margin-bottom: 18px; }
.error-details { color: var(--muted-2); font-size: 0.8rem; }
.error-card .logo-section img { max-height: 48px; }

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(245, 246, 248, 0.7);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
}
.loading-overlay.show, .loading-overlay.active { display: flex; }
.loading-spinner {
  width: 42px; height: 42px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   AUTH PAGES (base_min.html)
   ============================================================ */
.modern-minimal-body { background: var(--bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.minimal-main { width: 100%; }
.center-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.center-content { width: 100%; max-width: 430px; }
.modern-minimal-body .card { box-shadow: var(--shadow-md); border-radius: var(--radius-xl); }
.modern-minimal-body .card-body { padding: 28px; }
.modern-minimal-body .btn-primary { width: 100%; }
.logo-section { text-align: center; margin-bottom: 22px; }
.logo-section img { max-height: 64px; }
.logo-section h1 { font-weight: 800; letter-spacing: -0.02em; margin-top: 12px; }
.logo-section p, .logo-section small { color: var(--muted); }
.modern-link { color: var(--primary-700); font-weight: 600; }
.modern-link:hover { color: var(--primary-600); }
.minimal-footer { position: fixed; bottom: 0; left: 0; right: 0; text-align: center; padding: 14px; color: var(--muted-2); font-size: 0.82rem; }
.minimal-footer a { color: var(--primary-700); }

/* ============================================================
   SMALL UTILITIES / MISC
   ============================================================ */
.rounded-pill { border-radius: 999px !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.border { border-color: var(--border) !important; }
.bg-light { background: var(--surface-2) !important; }
.required { color: #ef4d6a; }

/* ============================================================
   DASHBOARD HELPERS & POLISH (home + shared pages)
   ============================================================ */
/* Page title block */
.pagetitle { margin-bottom: 22px; }
.pagetitle h1, .pagetitle .display-6 {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); margin: 0 0 4px;
}
.pagetitle h1 .bi { color: var(--primary); }
.breadcrumb { margin: 0; font-size: 0.8rem; }
.breadcrumb-item, .breadcrumb-item a { color: var(--muted); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--primary-700); }
.breadcrumb-item.active { color: var(--ink-2); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--muted-2); }

/* Section rhythm — kill the nested <main> double padding */
.content-wrapper > .main.py-4,
.content-wrapper main.main { padding-top: 0 !important; padding-bottom: 0 !important; }
.section.dashboard { margin-top: 0; }

/* Avatars (avatar-sm/-md/-lg were used but undefined → fix) */
.avatar-sm, .avatar-md, .avatar-lg {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; border-radius: 999px; font-weight: 700; line-height: 1;
}
.avatar-sm { width: 40px; height: 40px; font-size: 0.95rem; }
.avatar-md { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar-lg { width: 60px; height: 60px; font-size: 1.3rem; }

/* Info card (dashboard tiles) */
.info-card .card-title { font-size: 0.82rem; font-weight: 600; text-transform: none; }
.info-card .display-6 { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.card-icon-lg { width: 54px; height: 54px; }

/* Role-stat tiles: the bordered inner boxes */
.border.rounded-3.bg-light, .hover-shadow {
  border-color: var(--border) !important;
  background: var(--surface-2) !important;
  transition: box-shadow 0.18s var(--ease), transform 0.18s var(--ease), border-color 0.18s var(--ease);
}
.hover-shadow:hover { box-shadow: var(--shadow-md); border-color: var(--border-2) !important; }

/* Roadmap (workflow) steps in the latest-processes table */
.roadmap { gap: 2px; }
.roadmap-step { display: flex; align-items: center; }
.roadmap-icon {
  width: 30px; height: 30px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
}
.roadmap-connector { color: var(--muted-2); font-size: 1.1rem; }
.workflow-row > td { background: var(--surface-2); border-radius: 0 0 12px 12px; }

/* Article step badge in tables */
.article-step-badge { background: var(--surface-2) !important; color: var(--ink-2) !important; border: 1px solid var(--border) !important; }

/* Subtle hover utilities used across templates */
.transition-all { transition: all 0.18s var(--ease); }
.hover-underline:hover { text-decoration: underline; }

/* Chart containers */
.echart, #trafficChart { width: 100%; }

/* Empty-state blocks */
.display-4 { font-size: 2.4rem; }

/* ============================================================
   THEME TOGGLE BUTTON (header)
   ============================================================ */
.theme-toggle-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  border-radius: 11px;
  color: var(--ink-2);
  font-size: 1.18rem;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.theme-toggle-btn:hover { background: var(--primary-soft); color: var(--primary-700); }
/* Show sun in dark mode (to switch to light), moon in light mode */
.theme-toggle-btn .icon-sun  { display: none; }
.theme-toggle-btn .icon-moon { display: inline-flex; }
[data-bs-theme="dark"] .theme-toggle-btn .icon-sun  { display: inline-flex; }
[data-bs-theme="dark"] .theme-toggle-btn .icon-moon { display: none; }

/* ============================================================
   DARK MODE  —  [data-bs-theme="dark"]
   The whole UI is variable-driven, so dark mode is mostly a
   re-mapping of design tokens. The blocks below also override the
   handful of light-only hard-coded hex values scattered above so
   every surface, hover, badge and alert adapts cleanly.
   Built on Bootstrap 5.3 color modes (data-bs-theme).
   ============================================================ */
[data-bs-theme="dark"] {
  --bg:            #0f1115;
  --surface:       #181b22;
  --surface-2:     #1f232b;
  --sidebar-bg:    #14161c;

  --primary:       #5d79ff;
  --primary-600:   #7e95ff;
  --primary-700:   #9db2ff;   /* links / accent text — lightened for contrast on dark */
  --primary-soft:  rgba(93, 121, 255, 0.18);
  --primary-soft2: rgba(93, 121, 255, 0.12);
  --accent-2:      #7e95ff;

  --ink:           #e8eaf0;
  --ink-2:         #b6bbc8;
  --muted:         #8b90a0;
  --muted-2:       #6b7080;

  --border:        #2a2e38;
  --border-2:      #353a47;
  --hairline:      #23262f;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30), 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.36), 0 12px 28px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.58);

  /* Hand Bootstrap's own components a matching dark palette so anything
     not explicitly themed above (close buttons, form check, etc.) adapts. */
  --bs-body-bg:            var(--bg);
  --bs-body-color:         var(--ink);
  --bs-emphasis-color:     var(--ink);
  --bs-secondary-bg:       var(--surface-2);
  --bs-tertiary-bg:        var(--surface-2);
  --bs-border-color:       var(--border);
  --bs-secondary-color:    var(--muted);
  --bs-link-color:         var(--primary-700);
  --bs-link-hover-color:   var(--primary-600);
  --bs-link-color-rgb:           157, 178, 255;
  --bs-link-hover-color-rgb:     126, 149, 255;
}

/* Scrollbars */
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: #2f343f; border-color: var(--bg); }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #3a3f4c; }
[data-bs-theme="dark"] .modern-sidebar::-webkit-scrollbar-thumb,
[data-bs-theme="dark"] .sidebar::-webkit-scrollbar-thumb { background: #2c313b; }
[data-bs-theme="dark"] .modern-sidebar:hover::-webkit-scrollbar-thumb,
[data-bs-theme="dark"] .sidebar:hover::-webkit-scrollbar-thumb { background: #3a3f4c; }

/* Nav hovers (were #f1f2f7) */
[data-bs-theme="dark"] .sidebar-nav .nav-link:hover,
[data-bs-theme="dark"] .modern-nav-link:hover,
[data-bs-theme="dark"] .nav-content a:hover { background: var(--surface-2); color: var(--ink); }

/* Search box (were #eef0f5 / #fff) */
[data-bs-theme="dark"] .search-input-group:hover { background: #20242d; }
[data-bs-theme="dark"] .search-input-group:focus-within { background: var(--surface); }

/* Dropdown logout hover (were #fdeaed / #c0314a) */
[data-bs-theme="dark"] .dropdown-item.logout-item:hover,
[data-bs-theme="dark"] .modern-menu-item.logout-item:hover { background: rgba(239, 77, 106, 0.16); color: #ff8298; }

/* Buttons that hard-coded a white face */
[data-bs-theme="dark"] .btn-outline-primary,
[data-bs-theme="dark"] .btn-outline-secondary,
[data-bs-theme="dark"] .btn-secondary,
[data-bs-theme="dark"] .btn-light,
[data-bs-theme="dark"] .btn-outline-info { background: var(--surface); }
[data-bs-theme="dark"] .btn-outline-primary { color: var(--primary-700); border-color: var(--primary); }
[data-bs-theme="dark"] .btn-outline-primary:hover { background: var(--primary); color: #fff; }
[data-bs-theme="dark"] .btn-secondary:hover,
[data-bs-theme="dark"] .btn-light:hover { background: var(--surface-2); color: var(--ink); }
[data-bs-theme="dark"] .btn-outline-secondary:hover { background: var(--surface-2); border-color: var(--border-2); color: var(--ink); }

/* Inputs (were #fff) */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .modern-input { background: var(--surface); color: var(--ink); }
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus,
[data-bs-theme="dark"] .modern-input:focus { background: var(--surface); }
[data-bs-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b90a0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Pagination disabled face (was #fff) */
[data-bs-theme="dark"] .page-item.disabled .page-link { background: var(--surface); }

/* Badges — translucent tints on dark */
[data-bs-theme="dark"] .badge.bg-secondary { background: #2a2e38 !important; color: #c2c7d4 !important; }
[data-bs-theme="dark"] .badge.bg-success   { background: rgba(34, 165, 101, 0.18) !important; color: #4ad295 !important; }
[data-bs-theme="dark"] .badge.bg-danger    { background: rgba(239, 77, 106, 0.18) !important; color: #ff8298 !important; }
[data-bs-theme="dark"] .badge.bg-warning   { background: rgba(245, 165, 36, 0.18) !important; color: #f0bd5c !important; }
[data-bs-theme="dark"] .badge.bg-info      { background: rgba(74, 163, 223, 0.18) !important; color: #6ec1f5 !important; }
[data-bs-theme="dark"] .badge.bg-light     { background: #2a2e38 !important; color: #c2c7d4 !important; }
[data-bs-theme="dark"] .badge.bg-dark      { background: #2a2e38 !important; color: var(--ink) !important; }

/* Status pills (were light pastels) */
[data-bs-theme="dark"] .modern-badge,
[data-bs-theme="dark"] .article-step-badge { background: #2a2e38; color: #c2c7d4; }
[data-bs-theme="dark"] .status-draft    { background: #2a2e38; color: #c2c7d4; }
[data-bs-theme="dark"] .status-pending  { background: rgba(245, 165, 36, 0.18); color: #f0bd5c; }
[data-bs-theme="dark"] .status-process  { background: rgba(124, 92, 246, 0.22); color: #b29bff; }
[data-bs-theme="dark"] .status-confirm  { background: var(--primary-soft); color: var(--primary-700); }
[data-bs-theme="dark"] .status-approved,
[data-bs-theme="dark"] .status-publish  { background: rgba(34, 165, 101, 0.18); color: #4ad295; }
[data-bs-theme="dark"] .status-reject   { background: rgba(239, 77, 106, 0.18); color: #ff8298; }
[data-bs-theme="dark"] .status-cancel   { background: #2a2e38; color: var(--muted); }

/* Alerts (were light pastels) */
[data-bs-theme="dark"] .alert-success { background: rgba(34, 165, 101, 0.14); border-color: rgba(34, 165, 101, 0.34); color: #5fd9a2; }
[data-bs-theme="dark"] .alert-danger,
[data-bs-theme="dark"] .alert-error   { background: rgba(239, 77, 106, 0.14); border-color: rgba(239, 77, 106, 0.34); color: #ff90a4; }
[data-bs-theme="dark"] .alert-warning { background: rgba(245, 165, 36, 0.14); border-color: rgba(245, 165, 36, 0.34); color: #f4c772; }
[data-bs-theme="dark"] .alert-info    { background: rgba(74, 163, 223, 0.14); border-color: rgba(74, 163, 223, 0.34); color: #7cc6f7; }

/* Footer (was a near-white gradient) */
[data-bs-theme="dark"] .modern-footer,
[data-bs-theme="dark"] footer.modern-footer { background: var(--surface); }

/* Prose body text (was #2b2f3a) */
[data-bs-theme="dark"] .prose { color: var(--ink-2); }

/* Loading overlay tint */
[data-bs-theme="dark"] .loading-overlay { background: rgba(15, 17, 21, 0.72); }

/* Close buttons sitting on light surfaces need inverting in dark mode */
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(1.8); }

/* Tables / hover already use vars; nudge the striped/hover tint for dark */
[data-bs-theme="dark"] .table-hover tbody tr:hover,
[data-bs-theme="dark"] .modern-table tbody tr:hover,
[data-bs-theme="dark"] .table-modern tbody tr:hover { background: var(--surface-2); }
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * { background: rgba(255,255,255,0.025); }
[data-bs-theme="dark"] .table-striped.table-hover > tbody > tr:hover > * { background: var(--surface-2); }

/* Generic safety net: Bootstrap utility backgrounds that assume a light page */
[data-bs-theme="dark"] .bg-white { background: var(--surface) !important; }
[data-bs-theme="dark"] .text-dark { color: var(--ink) !important; }
[data-bs-theme="dark"] .border { border-color: var(--border) !important; }
