/* ==========================================================================
   CONVEYOR UNI EXPRESS - COMPACT ENTERPRISE ADMIN DESIGN SYSTEM (ADMIN.CSS)
   Calibrated for optimal 100% browser screen fit & ultra-smooth hover animation
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --admin-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --admin-mono: 'JetBrains Mono', monospace;

  /* Layout Dimensions - Calibrated for Compact, Natural 100% Zoom Fit */
  --sidebar-mini-width: 64px;
  --sidebar-width: 248px;
  --topbar-height: 56px;

  /* Modern Professional Color Palette */
  --bg-main: #f8fafc; /* Crisp Slate-50 background */
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-sidebar-hover: #f0f9ff;
  --bg-sidebar-active: #0284c7;

  /* Conveyor Brand Primary (Sky/Ocean Blue) */
  --color-primary: #0284c7;
  --color-primary-hover: #0369a1;
  --color-primary-light: #e0f2fe;
  --color-primary-soft: #f0f9ff;

  /* Status Accents */
  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-danger: #ef4444;
  --color-danger-light: #fee2e2;
  --color-purple: #7c3aed;
  --color-purple-light: #ede9fe;
  --color-indigo: #6366f1;
  --color-indigo-light: #e0e7ff;

  /* Borders & Surfaces */
  --border-color: #e2e8f0;
  --border-color-light: #f1f5f9;
  --border-blue: #bae6fd;

  /* High Contrast Typography */
  --text-main: #0f172a; /* Slate-900 */
  --text-body: #334155; /* Slate-700 */
  --text-muted: #64748b; /* Slate-500 */
  --text-light: #94a3b8; /* Slate-400 */

  /* Border Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 11px;
  --radius-xl: 14px;
  --radius-full: 9999px;

  /* Multi-Layered Elevation Shadows */
  --shadow-subtle: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --shadow-card-hover: 0 8px 20px -4px rgba(15, 23, 42, 0.07), 0 3px 6px -2px rgba(15, 23, 42, 0.03);
  --shadow-dropdown: 0 10px 20px -5px rgba(15, 23, 42, 0.1), 0 6px 8px -4px rgba(15, 23, 42, 0.05);
  --shadow-sidebar-hover: 10px 0 30px -4px rgba(15, 23, 42, 0.1), 3px 0 8px -2px rgba(15, 23, 42, 0.04);
}

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

/* Base Scaling: Calibrated to match comfortable 90% browser zoom at default 100% */
html {
  font-size: 14.5px;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--admin-font);
  background-color: var(--bg-main);
  color: var(--text-body);
  font-size: 0.875rem;
  line-height: 1.45;
  overflow-x: hidden;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   Admin Master Wrapper & Overflow Guard
   ========================================================================== */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-main);
  position: relative;
  overflow-x: hidden;
  max-width: 100%;
}

/* ==========================================================================
   1. Admin Sidebar – Smooth, Polished Icon-Only Hover Expansion Engine
   Duration: 360ms with cubic-bezier(0.22, 1, 0.36, 1) ease-out curve
   ========================================================================== */
.admin-sidebar {
  width: var(--sidebar-mini-width);
  background: var(--bg-sidebar);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  border-right: 1px solid var(--border-color);
  box-shadow: 1px 0 8px rgba(15, 23, 42, 0.03);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  will-change: width, box-shadow;
  transition: width 0.36s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.36s ease;
}

.admin-sidebar::-webkit-scrollbar {
  display: none;
}

/* Desktop Hover Expansion: Glides above content without shifting main layout */
@media (min-width: 993px) {
  .admin-sidebar:hover,
  .admin-sidebar.is-hovered {
    width: var(--sidebar-width);
    box-shadow: var(--shadow-sidebar-hover);
  }

  /* Desktop Pinned Mode */
  .admin-wrapper.sidebar-pinned .admin-sidebar,
  html.sidebar-is-pinned .admin-sidebar {
    width: var(--sidebar-width);
    box-shadow: 1px 0 10px rgba(15, 23, 42, 0.05);
  }
}

/* Sidebar Brand Header */
.sidebar-brand {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: 0 0.65rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid var(--border-color-light);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
  overflow: hidden;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  min-width: 0;
}

.brand-icon-box {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo-img {
  height: 30px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  will-change: opacity, max-width;
  transition: opacity 0.16s ease-out, max-width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.admin-sidebar:hover .brand-text-block,
.admin-wrapper.sidebar-pinned .brand-text-block,
.admin-sidebar.mobile-open .brand-text-block {
  opacity: 1;
  max-width: 175px;
  pointer-events: auto;
  transition: opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1) 0.08s, max-width 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.brand-name {
  font-size: 0.875rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.brand-name-accent {
  color: #ef4444;
}

.brand-badge {
  font-size: 0.625rem;
  color: #0284c7;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 1px;
}

.sidebar-close-btn {
  display: none;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fecaca;
}

/* Sidebar Navigation Items */
.sidebar-nav {
  padding: 0.65rem 0.35rem;
  flex-grow: 1;
}

/* Sidebar Headings (Divider line in collapsed, uppercase label in expanded) */
.sidebar-heading {
  height: 1px;
  background: var(--border-color);
  margin: 0.65rem 0.5rem;
  text-indent: -9999px;
  overflow: hidden;
  opacity: 0.5;
  transition: opacity 0.16s ease-out, margin 0.32s ease, height 0.32s ease;
}

.admin-sidebar:hover .sidebar-heading,
.admin-wrapper.sidebar-pinned .sidebar-heading,
.admin-sidebar.mobile-open .sidebar-heading {
  height: auto;
  background: transparent;
  text-indent: 0;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 800;
  padding: 0.65rem 0.75rem 0.25rem 0.75rem;
  margin: 0;
  opacity: 1;
  transition: opacity 0.24s ease 0.08s, height 0.36s ease;
}

/* Sidebar Links */
.sidebar-link {
  display: flex;
  align-items: center;
  position: relative;
  height: 38px;
  margin: 0.15rem 0.25rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  overflow: hidden;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-link:hover {
  background: var(--bg-sidebar-hover);
  color: var(--color-primary);
}

.sidebar-link.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.28);
}

.nav-icon {
  width: 48px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  font-size: 1.1rem;
}

.nav-icon i,
.nav-icon svg {
  width: 17px;
  height: 17px;
  transition: transform 0.15s ease;
}

.sidebar-link:hover .nav-icon i,
.sidebar-link:hover .nav-icon svg {
  transform: scale(1.08);
}

.sidebar-link.active .nav-icon i,
.sidebar-link.active .nav-icon svg {
  color: #ffffff !important;
}

.nav-label {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  font-weight: 600;
  will-change: opacity, max-width;
  transition: opacity 0.16s ease-out, max-width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.admin-sidebar:hover .nav-label,
.admin-wrapper.sidebar-pinned .nav-label,
.admin-sidebar.mobile-open .nav-label {
  opacity: 1;
  max-width: 150px;
  margin-left: 0.2rem;
  pointer-events: auto;
  transition: opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1) 0.08s, max-width 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Badges inside links */
.nav-badge {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
  margin-left: auto;
  margin-right: 0.65rem;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-full);
  transition: opacity 0.2s ease;
}

.admin-sidebar:hover .nav-badge,
.admin-wrapper.sidebar-pinned .nav-badge,
.admin-sidebar.mobile-open .nav-badge {
  opacity: 1;
  max-width: 80px;
  pointer-events: auto;
  transition: opacity 0.24s ease 0.08s;
}

/* Notification dot for collapsed icon rail */
.icon-dot-badge {
  position: absolute;
  top: 7px;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid #ffffff;
}

.icon-dot-badge.dot-danger {
  background: var(--color-danger);
}

.icon-dot-badge.dot-warning {
  background: var(--color-warning);
}

.admin-sidebar:hover .icon-dot-badge,
.admin-wrapper.sidebar-pinned .icon-dot-badge,
.admin-sidebar.mobile-open .icon-dot-badge {
  display: none;
}

/* Sidebar Footer User Area */
.sidebar-footer {
  padding: 0.65rem 0.5rem;
  border-top: 1px solid var(--border-color-light);
  background: #ffffff;
  margin-top: auto;
  overflow: hidden;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
  border: 2px solid #bae6fd;
}

.user-info {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.16s ease-out, max-width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.admin-sidebar:hover .user-info,
.admin-wrapper.sidebar-pinned .user-info,
.admin-sidebar.mobile-open .user-info {
  opacity: 1;
  max-width: 160px;
  pointer-events: auto;
  transition: opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1) 0.08s, max-width 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.user-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.15;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.675rem;
  color: #64748b;
  line-height: 1.15;
  margin-top: 1px;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Floating Tooltip Element for Collapsed Mode (Immune to Overflow Clipping) */
.admin-sidebar-tooltip {
  position: fixed;
  z-index: 2200;
  background: #0f172a;
  color: #ffffff;
  font-size: 0.725rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.admin-sidebar-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* ==========================================================================
   2. Main Content Layout & Screen Fit Architecture (No Outer Scroll)
   ========================================================================== */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-mini-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-mini-width));
  overflow-x: hidden;
  background: var(--bg-main);
  transition: margin-left 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 993px) {
  /* Pinned mode pushes main content */
  .admin-wrapper.sidebar-pinned .admin-main,
  html.sidebar-is-pinned .admin-main {
    margin-left: var(--sidebar-width);
    max-width: calc(100vw - var(--sidebar-width));
  }
}

/* Mobile Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

body.sidebar-locked {
  overflow: hidden;
}

/* ==========================================================================
   3. Refined Modern Topbar (56px Compact Height)
   ========================================================================== */
.admin-topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  gap: 1rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: #475569;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.sidebar-toggle-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--color-primary);
  border-color: #bae6fd;
}

.topbar-title-section {
  min-width: 0;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.675rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-bottom: 1px;
}

.topbar-sep {
  color: #cbd5e1;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.015em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

/* Status Pill */
.topbar-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  color: #166534;
}

.status-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
  animation: pulse-green 2s infinite ease-in-out;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* User Pill */
.topbar-user-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 0.22rem 0.65rem 0.22rem 0.3rem;
  border-radius: var(--radius-full);
}

.user-pill-avatar {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-pill-info {
  display: flex;
  flex-direction: column;
}

.user-pill-name {
  font-size: 0.775rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}

.user-pill-role {
  font-size: 0.625rem;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-logout-btn {
  color: #64748b;
  border-color: var(--border-color);
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
}

.topbar-logout-btn:hover {
  background: #fef2f2;
  color: #ef4444;
  border-color: #fecaca;
}

/* ==========================================================================
   4. Admin Content Container (Compact Padding)
   ========================================================================== */
.admin-content {
  padding: 1.25rem 1.5rem;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

/* ==========================================================================
   5. Stat Cards (Compact Enterprise KPIs)
   ========================================================================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.15rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.stat-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}

.stat-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-card-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-blue { background: #e0f2fe; color: #0284c7; border: 1px solid #bae6fd; }
.stat-icon-amber { background: #fef3c7; color: #d97706; border: 1px solid #fde68a; }
.stat-icon-green { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.stat-icon-purple { background: #ede9fe; color: #7c3aed; border: 1px solid #ddd6fe; }

/* ==========================================================================
   6. Modern Admin Cards & Panels (Reduced Padding & Elevation)
   ========================================================================== */
.admin-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.admin-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  background: #ffffff;
}

.card-header-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}

.card-body {
  padding: 1.15rem 1.25rem;
}

/* ==========================================================================
   7. Data Tables & Intelligent Column Layouts
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
  height: 5px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--radius-full);
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.8125rem;
}

.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color-light);
  color: var(--text-body);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

/* Intelligent column text helpers */
.nowrap {
  white-space: nowrap !important;
}

.col-truncate {
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status Badges (Compact) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-full);
  line-height: 1.2;
}

.badge-primary { background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; }
.badge-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-info { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; }
.badge-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

/* ==========================================================================
   8. Buttons System (Compact Proportions)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  min-height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.3);
  transform: translateY(-1px);
  color: #ffffff;
}

.btn-outline {
  background: #ffffff;
  border-color: var(--border-color);
  color: #334155;
}

.btn-outline:hover {
  background: var(--bg-sidebar-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-danger {
  background: #ef4444;
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
  color: #ffffff;
}

.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  min-height: 27px;
  border-radius: var(--radius-xs);
}

/* ==========================================================================
   9. Forms & Inputs (Compact Heights)
   ========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-grid-3 {
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-control {
  width: 100%;
  padding: 0.4rem 0.75rem;
  min-height: 33px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  outline: none;
  background: #ffffff;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.form-control:hover:not(:focus) {
  border-color: #94a3b8;
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* ==========================================================================
   10. Alerts & Grid Helpers
   ========================================================================== */
.alert {
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; }

.details-grid-2 {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 1.25rem;
  align-items: start;
}

.grid-2-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

/* ==========================================================================
   11. Air Waybill Print Styles
   ========================================================================== */
.awb-container {
  max-width: 850px;
  margin: 1.5rem auto;
  background: #ffffff;
  border: 2px solid #0f172a;
  padding: 1.5rem;
  font-family: var(--admin-font);
  color: #000000;
}

.awb-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.awb-barcode-box {
  text-align: right;
  font-family: var(--admin-mono);
}

.barcode-stripes {
  height: 40px;
  background: repeating-linear-gradient(
    90deg,
    #000 0px,
    #000 3px,
    #fff 3px,
    #fff 6px,
    #000 6px,
    #000 10px,
    #fff 10px,
    #fff 12px
  );
  width: 200px;
  margin-left: auto;
  margin-bottom: 4px;
}

.awb-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #0f172a;
  margin-bottom: 0.75rem;
}

.awb-cell {
  padding: 0.6rem;
  border-right: 1px solid #0f172a;
  border-bottom: 1px solid #0f172a;
}

.awb-cell:last-child {
  border-right: none;
}

.awb-cell-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: bold;
  color: #475569;
  margin-bottom: 0.2rem;
}

.awb-cell-content {
  font-size: 0.85rem;
  font-weight: 600;
}

@media print {
  body {
    background: #ffffff !important;
  }
  .admin-sidebar, .admin-topbar, .btn-print-hide {
    display: none !important;
  }
  .admin-main {
    margin-left: 0 !important;
    background: #ffffff !important;
    max-width: 100% !important;
  }
  .awb-container {
    border: 2px solid #000000 !important;
    margin: 0 !important;
    max-width: 100% !important;
    box-shadow: none !important;
  }
}

/* ==========================================================================
   12. Pagination Styling
   ========================================================================== */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.85rem;
  width: 100%;
}

.pager-info {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pager-info strong {
  color: var(--text-main);
  font-weight: 600;
}

.pager-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pager-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.95rem;
  height: 1.95rem;
  padding: 0 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

a.pager-link:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.pager-link.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #ffffff;
}

.pager-link.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager-link.is-gap {
  border-color: transparent;
  background: transparent;
}

/* ==========================================================================
   13. Responsive Tablet & Mobile Media Queries
   ========================================================================== */
@media (max-width: 992px) {
  .admin-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    z-index: 1050;
    box-shadow: 8px 0 25px rgba(0, 0, 0, 0.15);
  }

  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: inline-flex;
  }

  .brand-text-block,
  .nav-label,
  .user-info {
    opacity: 1 !important;
    max-width: 180px !important;
    pointer-events: auto !important;
    margin-left: 0.2rem !important;
  }

  .sidebar-heading {
    height: auto !important;
    background: transparent !important;
    text-indent: 0 !important;
    opacity: 1 !important;
  }

  .admin-main {
    margin-left: 0 !important;
    width: 100%;
    max-width: 100vw;
  }

  .admin-topbar {
    padding: 0 0.85rem;
    height: auto;
    min-height: 52px;
  }

  .topbar-title {
    font-size: 1.05rem;
    max-width: 180px;
  }

  .admin-content {
    padding: 1rem 0.85rem;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
  }

  .dashboard-main-grid,
  .details-grid-2 {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  .card-header {
    padding: 0.75rem 1rem;
  }

  .card-body {
    padding: 1rem;
  }
}

@media (max-width: 640px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .topbar-status-pill,
  .btn-text-responsive,
  .topbar-user-pill .user-pill-info {
    display: none;
  }

  .topbar-title {
    font-size: 0.95rem;
    max-width: 130px;
  }

  .form-grid,
  .form-grid-3,
  .grid-2-col {
    grid-template-columns: 1fr;
  }

  .admin-content {
    padding: 0.85rem 0.65rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }
}
