/* =====================================================
   APPINSTAN E-PROCUREMENT — PREMIUM CSS
   Palette: Deep Navy + Gold Accent + Clean White
   Font: Plus Jakarta Sans + Sora
   ===================================================== */

:root {
  --navy-950: #050D1A;
  --navy-900: #0A1929;
  --navy-800: #0D2137;
  --navy-700: #112944;
  --navy-600: #163456;
  --navy-500: #1E4579;
  --navy-400: #2E5F9A;
  --navy-300: #4A7FBD;
  --navy-200: #88ABCE;
  --navy-100: #C4D8EC;
  --navy-50:  #EBF2FA;

  --gold-600: #B8922A;
  --gold-500: #D4A843;
  --gold-400: #E8BC55;
  --gold-300: #F5D07A;
  --gold-100: #FDF3D9;

  --gray-900: #111827;
  --gray-800: #1F2937;
  --gray-700: #374151;
  --gray-600: #4B5563;
  --gray-500: #6B7280;
  --gray-400: #9CA3AF;
  --gray-300: #D1D5DB;
  --gray-200: #E5E7EB;
  --gray-100: #F3F4F6;
  --gray-50:  #F9FAFB;
  --white:    #FFFFFF;

  --green-600: #059669;
  --green-100: #D1FAE5;
  --red-600:   #DC2626;
  --red-100:   #FEE2E2;
  --amber-600: #D97706;
  --amber-100: #FEF3C7;
  --blue-600:  #2563EB;
  --blue-100:  #DBEAFE;
  --purple-600: #7C3AED;
  --purple-100: #EDE9FE;

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-display: 'Sora', sans-serif;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-md: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 20px 25px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.04);
  --transition: 150ms ease;
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; max-width: 100%; overflow-x: hidden; }
body { max-width: 100%; overflow-x: hidden; font-family: var(--font-body); background: var(--gray-50); color: var(--gray-800); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }
img { max-width: 100%; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: 600; line-height: 1.3; color: var(--gray-900); }

/* ---- LAYOUT ---- */
.app-body { display: flex; min-height: 100vh; max-width: 100%; overflow-x: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--navy-900);
  background-image: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform var(--transition);
  border-right: 1px solid rgba(255,255,255,.06);
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--gold-400) 0%, var(--gold-600) 100%);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--navy-900);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(212,168,67,.4);
}

.logo-text { display: flex; flex-direction: column; }
.logo-name { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--white); letter-spacing: .3px; line-height: 1.2; }
.logo-sub  { font-size: 10px; color: var(--navy-200); letter-spacing: 1.5px; text-transform: uppercase; font-weight: 500; }

.sidebar-close-btn {
  display: none; background: none; border: none;
  color: var(--navy-300); font-size: 18px; padding: 4px;
}

/* Sidebar User */
.sidebar-user {
  margin: 16px 12px;
  padding: 12px;
  background: rgba(255,255,255,.05);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-400), var(--navy-300));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--white);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.status-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 8px; height: 8px;
  background: var(--green-600);
  border-radius: 50%;
  border: 2px solid var(--navy-800);
}

.user-info { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--navy-300); }

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.nav-section { margin-bottom: 8px; }
.nav-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--navy-400);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  color: var(--navy-200);
  transition: all var(--transition);
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: var(--white);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(212,168,67,.18), rgba(212,168,67,.08));
  color: var(--gold-300);
  border: 1px solid rgba(212,168,67,.2);
}

.nav-item.active .nav-icon { color: var(--gold-400); }

.nav-icon {
  font-size: 17px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  background: var(--navy-500);
  color: var(--white);
  font-size: 10px; font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.urgent { background: var(--red-600); }

.nav-item-danger { color: #fc8181 !important; }
.nav-item-danger:hover { background: rgba(220,38,38,.15) !important; color: #fc8181 !important; }

.sidebar-footer { padding: 8px 12px 16px; flex-shrink: 0; border-top: 1px solid rgba(255,255,255,.06); }

/* ===== TOPBAR ===== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-width));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }

.menu-toggle {
  background: none; border: none;
  font-size: 20px; color: var(--gray-600);
  padding: 6px; border-radius: var(--radius-sm);
  display: none;
}

.menu-toggle:hover { background: var(--gray-100); color: var(--gray-900); }

/* Breadcrumb */
.breadcrumb-nav {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; flex-wrap: wrap;
}

.breadcrumb-home { color: var(--navy-400); font-size: 15px; }
.breadcrumb-sep  { color: var(--gray-400); font-size: 12px; }
.breadcrumb-link { color: var(--navy-400); font-weight: 500; }
.breadcrumb-link:hover { color: var(--navy-600); }
.breadcrumb-current { color: var(--gray-700); font-weight: 600; }

/* Topbar Search */
.topbar-search {
  position: relative; display: flex; align-items: center;
  max-width: 320px; flex: 1;
}

.search-icon {
  position: absolute; left: 10px;
  color: var(--gray-400); font-size: 15px;
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--gray-100);
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--gray-800);
  transition: all var(--transition);
  outline: none;
}

.topbar-search input:focus {
  background: var(--white);
  border-color: var(--navy-300);
  box-shadow: 0 0 0 3px rgba(46,95,154,.1);
}

.search-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0;
  width: 100%; background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: none; z-index: 200;
  max-height: 300px; overflow-y: auto;
}

.search-dropdown.open { display: block; }

/* Icon Button */
.icon-btn {
  position: relative; background: none; border: none;
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--gray-500);
  transition: all var(--transition);
}

.icon-btn:hover { background: var(--gray-100); color: var(--gray-800); }

.notif-dot {
  position: absolute; top: 5px; right: 5px;
  min-width: 16px; height: 16px;
  background: var(--red-600); color: var(--white);
  font-size: 9px; font-weight: 700;
  border-radius: 10px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--white);
}

/* Notification Dropdown */
.topbar-notif { position: relative; }

.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 360px; background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: none; z-index: 200;
}

.notif-dropdown.open { display: block; }

.notif-header {
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
}

.notif-header span { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.mark-all-read { font-size: 12px; color: var(--navy-400); }
.mark-all-read:hover { color: var(--navy-600); }

.notif-list { max-height: 320px; overflow-y: auto; }

.notif-item {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer; transition: background var(--transition);
}

.notif-item:hover { background: var(--navy-50); }
.notif-item.unread { background: var(--blue-100); }

.notif-icon-wrap {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--gray-800); line-height: 1.4; }
.notif-msg   { font-size: 12px; color: var(--gray-500); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time  { font-size: 11px; color: var(--gray-400); margin-top: 3px; }

.notif-footer {
  padding: 10px 16px; text-align: center;
  border-top: 1px solid var(--gray-200);
}
.notif-footer a { font-size: 13px; color: var(--navy-500); font-weight: 500; }

/* User menu */
.topbar-user { position: relative; }

.user-menu-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 13px; font-weight: 500; color: var(--gray-700);
  transition: all var(--transition);
}

.user-menu-btn:hover { background: var(--gray-100); border-color: var(--gray-300); }

.user-avatar-sm {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-400), var(--navy-300));
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--white);
  overflow: hidden; flex-shrink: 0;
}

.user-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
.user-name-sm { font-weight: 600; }

.user-menu-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 220px; background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: none; z-index: 200;
}

.user-menu-dropdown.open { display: block; }

.user-menu-info {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-200);
}

.user-menu-info p    { font-size: 13px; font-weight: 600; color: var(--gray-900); }
.user-menu-info small { font-size: 12px; color: var(--gray-500); }

.user-menu-items { padding: 8px; }

.user-menu-items a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--gray-700);
  transition: all var(--transition);
}

.user-menu-items a:hover { background: var(--gray-100); color: var(--gray-900); }
.user-menu-items a i    { font-size: 16px; color: var(--gray-500); }
.user-menu-items hr     { margin: 6px 0; border: none; border-top: 1px solid var(--gray-200); }
.danger-link { color: var(--red-600) !important; }
.danger-link:hover { background: var(--red-100) !important; }

/* ===== PAGE CONTENT ===== */
.page-content {
  flex: 1; padding: 24px;
  display: flex; flex-direction: column; gap: 24px;
  min-width: 0;
  max-width: 100%;
}

.page-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--gray-400);
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}

.page-header-info { min-width: 0; }

.page-header-info h1 {
  font-size: 22px; font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.page-header-info p {
  font-size: 14px; color: var(--gray-500); margin-top: 4px;
}

.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}

.card-title { font-size: 15px; font-weight: 600; color: var(--gray-900); }
.card-subtitle { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Stat Cards */
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 12px;
  position: relative; overflow: hidden;
  transition: all var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.stat-card-icon.blue   { background: var(--blue-100);   color: var(--blue-600); }
.stat-card-icon.green  { background: var(--green-100);  color: var(--green-600); }
.stat-card-icon.amber  { background: var(--amber-100);  color: var(--amber-600); }
.stat-card-icon.red    { background: var(--red-100);    color: var(--red-600); }
.stat-card-icon.navy   { background: var(--navy-50);    color: var(--navy-600); }
.stat-card-icon.purple { background: var(--purple-100); color: var(--purple-600); }

.stat-card-value {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700;
  color: var(--gray-900); line-height: 1;
}

.stat-card-label { font-size: 13px; color: var(--gray-500); font-weight: 500; }

.stat-card-trend {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
}

.stat-card-trend.up   { color: var(--green-600); }
.stat-card-trend.down { color: var(--red-600); }

.stat-card-accent {
  position: absolute; bottom: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .05;
  transform: translate(25%, 25%);
}

/* ===== GRID ===== */
.grid { display: grid; gap: 16px; min-width: 0; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer; transition: all var(--transition);
  line-height: 1; white-space: nowrap;
  font-family: var(--font-body);
}

.btn:disabled { opacity: .55; pointer-events: none; }
.btn i { font-size: 16px; }

.btn-primary {
  background: var(--navy-600);
  color: var(--white);
  border-color: var(--navy-600);
}
.btn-primary:hover { background: var(--navy-700); border-color: var(--navy-700); box-shadow: 0 4px 12px rgba(22,52,86,.3); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: var(--navy-900);
  border-color: var(--gold-500);
  font-weight: 700;
}
.btn-gold:hover { box-shadow: 0 4px 12px rgba(212,168,67,.4); }

.btn-outline {
  background: transparent;
  color: var(--navy-600);
  border-color: var(--navy-300);
}
.btn-outline:hover { background: var(--navy-50); }

.btn-danger  { background: var(--red-600); color: var(--white); border-color: var(--red-600); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--green-600); color: var(--white); border-color: var(--green-600); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-icon { padding: 8px; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .3px; white-space: nowrap;
}

.badge i { font-size: 10px; }

.badge-draft       { background: var(--gray-100);   color: var(--gray-600); }
.badge-pending     { background: var(--amber-100);  color: var(--amber-600); }
.badge-approved    { background: var(--green-100);  color: var(--green-600); }
.badge-rejected    { background: var(--red-100);    color: var(--red-600); }
.badge-revision    { background: var(--purple-100); color: var(--purple-600); }
.badge-active      { background: var(--blue-100);   color: var(--blue-600); }
.badge-cancelled   { background: var(--gray-200);   color: var(--gray-600); }
.badge-blacklisted { background: var(--navy-900);   color: #fc8181; }
.badge-converted   { background: var(--navy-50);    color: var(--navy-600); }
.badge-received    { background: var(--green-100);  color: var(--green-600); }
.badge-paid        { background: var(--green-100);  color: var(--green-600); }
.badge-overdue     { background: var(--red-100);    color: var(--red-600); }

/* ===== TABLES ===== */
.table-wrap { max-width: 100%; overflow-x: auto; border-radius: var(--radius-lg); -webkit-overflow-scrolling: touch; }
.table-responsive { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}

.table thead tr { background: var(--gray-50); }
.table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--gray-500);
  letter-spacing: .8px; text-transform: uppercase;
  border-bottom: 1.5px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
  vertical-align: middle;
}

.table tbody tr:hover { background: var(--navy-50); }
.table tbody tr:last-child td { border-bottom: none; }

.table-number { font-size: 12px; font-weight: 700; font-family: var(--font-display); color: var(--navy-600); }
.table-muted  { color: var(--gray-500); font-size: 12px; }

/* ===== FORMS ===== */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.form-label.required::after { content: ' *'; color: var(--red-600); }

.form-control {
  padding: 9px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px; color: var(--gray-800);
  background: var(--white);
  transition: all var(--transition);
  outline: none; width: 100%;
  font-family: var(--font-body);
}

.form-control:focus {
  border-color: var(--navy-400);
  box-shadow: 0 0 0 3px rgba(46,95,154,.1);
}

.form-control.is-invalid { border-color: var(--red-600); }
.form-error { font-size: 12px; color: var(--red-600); margin-top: 3px; }
.form-hint  { font-size: 12px; color: var(--gray-500); margin-top: 3px; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-row { display: grid; gap: 16px; }
.form-row.col-2 { grid-template-columns: 1fr 1fr; }
.form-row.col-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ===== ALERTS ===== */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid transparent;
  position: relative;
}

.alert i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-dismissible .close-btn {
  position: absolute; right: 12px; top: 12px;
  background: none; border: none; font-size: 16px;
  opacity: .5; cursor: pointer;
}
.alert-dismissible .close-btn:hover { opacity: 1; }

.alert-success { background: var(--green-100); border-color: #86efac; color: #14532d; }
.alert-danger   { background: var(--red-100);   border-color: #fca5a5; color: #7f1d1d; }
.alert-warning  { background: var(--amber-100); border-color: #fcd34d; color: #78350f; }
.alert-info     { background: var(--blue-100);  border-color: #93c5fd; color: #1e3a5f; }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.filter-bar input, .filter-bar select {
  padding: 8px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px; background: var(--white);
  color: var(--gray-800); outline: none;
  transition: border-color var(--transition);
}

.filter-bar input:focus, .filter-bar select:focus { border-color: var(--navy-400); }

/* ===== TIMELINE ===== */
.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  display: flex; gap: 14px;
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-indicator {
  display: flex; flex-direction: column; align-items: center;
  flex-shrink: 0; width: 34px;
}

.timeline-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0; z-index: 1;
  border: 2px solid var(--white);
  box-shadow: var(--shadow-sm);
}

.timeline-dot.approved { background: var(--green-100); color: var(--green-600); }
.timeline-dot.rejected { background: var(--red-100); color: var(--red-600); }
.timeline-dot.pending  { background: var(--amber-100); color: var(--amber-600); }
.timeline-dot.default  { background: var(--gray-100); color: var(--gray-500); }

.timeline-line {
  flex: 1; width: 2px;
  background: var(--gray-200);
  margin-top: 2px;
}

.timeline-content { flex: 1; padding-bottom: 2px; }
.timeline-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.timeline-actor  { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.timeline-time   { font-size: 11px; color: var(--gray-400); white-space: nowrap; }
.timeline-step   { font-size: 12px; color: var(--gray-500); }
.timeline-notes  { margin-top: 6px; padding: 8px 12px; background: var(--gray-50); border-radius: var(--radius-sm); font-size: 12px; color: var(--gray-600); border-left: 3px solid var(--gray-200); }

/* ===== STEPPER ===== */
.stepper {
  display: flex; align-items: center; gap: 0;
  overflow-x: auto; padding: 4px 0;
}

.step-item {
  display: flex; align-items: center; flex: 1; min-width: 100px;
}

.step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-400);
  transition: all var(--transition);
}

.step-circle.done    { background: var(--green-600); border-color: var(--green-600); color: var(--white); }
.step-circle.active  { background: var(--navy-600);  border-color: var(--navy-600);  color: var(--white); }
.step-circle.pending { background: var(--amber-100); border-color: var(--amber-600); color: var(--amber-600); }

.step-info { display: flex; flex-direction: column; margin-left: 10px; }
.step-name { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.step-status-text { font-size: 11px; color: var(--gray-500); }

.step-line {
  flex: 1; height: 2px; background: var(--gray-200);
  margin: 0 8px;
}
.step-line.done { background: var(--green-600); }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1050;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}

.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  transform: scale(.95) translateY(10px);
  transition: transform var(--transition);
}

.modal-backdrop.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.modal-close { background: none; border: none; font-size: 20px; color: var(--gray-400); padding: 4px; border-radius: var(--radius-sm); }
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body   { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; gap: 8px; justify-content: flex-end; }

/* ===== MISC ===== */
.text-primary { color: var(--navy-600); }
.text-muted   { color: var(--gray-500); }
.text-danger  { color: var(--red-600); }
.text-success { color: var(--green-600); }
.text-warning { color: var(--amber-600); }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }
.font-bold    { font-weight: 700; }
.font-medium  { font-weight: 500; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-16  { margin-top: 16px; }
.mb-16  { margin-bottom: 16px; }

.empty-state {
  text-align: center; padding: 60px 24px;
}
.empty-state i { font-size: 48px; color: var(--gray-300); }
.empty-state h3 { font-size: 16px; color: var(--gray-700); margin-top: 12px; }
.empty-state p  { font-size: 13px; color: var(--gray-500); margin-top: 6px; }

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 999;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { width: min(var(--sidebar-width), 86vw); transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: none; }
  .sidebar-overlay.open { display: block; }
  .sidebar-close-btn { display: flex; }
  .main-wrapper { margin-left: 0; max-width: 100vw; width: 100%; }
  .topbar { padding: 0 12px; }
  .menu-toggle { display: flex; }
  .topbar-search { display: none; }
  .notif-dropdown {
    position: fixed;
    top: calc(var(--topbar-height) + 8px);
    left: 12px;
    right: 12px;
    width: auto;
  }
  .user-menu-dropdown {
    position: fixed;
    top: calc(var(--topbar-height) + 8px);
    right: 12px;
    width: min(260px, calc(100vw - 24px));
  }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .dashboard-chart-grid,
  .mobile-stack-grid,
  .mobile-definition-list,
  .vendor-profile-summary-grid,
  .vendor-profile-doc-grid {
    grid-template-columns: 1fr !important;
  }
  .form-row.col-2, .form-row.col-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1 1 160px; }
  .page-content { padding: 16px; }
  .card-header { flex-wrap: wrap; gap: 10px; align-items: flex-start; }
  .filter-bar,
  .filter-bar form {
    width: 100%;
  }
  .filter-bar input,
  .filter-bar select,
  .filter-bar .form-control {
    width: 100% !important;
  }
  .table-wrap .table,
  .table-responsive .table,
  .table-responsive .vendor-table {
    min-width: 640px;
  }
  .page-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .user-name-sm { display: none; }
  .breadcrumb-nav { display: none; }
}

@media (max-width: 480px) {
  .page-content { padding: 12px; gap: 16px; }
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }
  .stat-card { padding: 16px; }
  .stat-card-value { font-size: 22px; }
  .btn { white-space: normal; justify-content: center; }
  .empty-state { padding: 36px 16px; }
}
