@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Roboto:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ========== BASE ========== */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #f5f7fa;
  min-height: 100vh;
  font-family: 'Roboto', 'Inter', sans-serif;
  color: #2c3e50;
}

/* ========== SIDEBAR ========== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 240px;
  height: 100vh;
  background: #222933;
  color: #ecf0f1;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width 0.3s ease;
  overflow-x: hidden;
  box-shadow: 2px 0 8px rgba(0,0,0,0.3);
}

.sidebar.collapsed {
  width: 60px;
}

.sidebar-logo {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  height: 70px;
}

.sidebar-logo-icon {
  min-width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(231,76,60,0.3);
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: opacity 0.3s ease;
  align-items: center;
}

.sidebar-logo-text .logo-image {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.sidebar-logo-text .logo-sub {
  font-size: 11px;
  font-weight: 600;
  color: #95a5a6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
  text-align: center;
}

.sidebar.collapsed .sidebar-logo-text {
  opacity: 0;
  width: 0;
}

/* ========== WAREHOUSE FILTER ========== */
.warehouse-filter {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 8px;
}

.warehouse-filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #95a5a6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.warehouse-select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #ecf0f1;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.warehouse-select:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
}

.warehouse-select:focus {
  background: rgba(255,255,255,0.15);
  border-color: #e74c3c;
}

.warehouse-select option {
  background: #222933;
  color: #ecf0f1;
}

.sidebar.collapsed .warehouse-filter {
  padding: 16px 10px;
}

.sidebar.collapsed .warehouse-filter-label {
  justify-content: center;
}

.sidebar.collapsed .warehouse-filter-label span {
  display: none;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  margin: 0;
  list-style: none;
}

/* Prevent flash of menu items during role loading */
.sidebar-menu:not(.loaded) .sidebar-menu-item {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sidebar-menu.loaded .sidebar-menu-item {
  opacity: 1;
}

.sidebar-menu-item {
  position: relative;
}

.sidebar-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: #bdc3c7;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.sidebar-menu-link:hover {
  background: rgba(255,255,255,0.05);
  color: #ecf0f1;
}

.sidebar-menu-link.active {
  background: linear-gradient(90deg, rgba(231,76,60,0.25) 0%, rgba(231,76,60,0.08) 100%);
  color: #fff;
  border-left-color: #e74c3c;
  border-left-width: 4px;
  font-weight: 600;
  box-shadow: inset 0 0 20px rgba(231,76,60,0.1);
}

.sidebar-menu-icon {
  min-width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-menu-text {
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-menu-text {
  opacity: 0;
  width: 0;
}

/* ========== ROLE-BASED MENU VISIBILITY ========== */
/* Hide role-specific menu items by default */
.sidebar-menu-item.admin-only,
.sidebar-menu-item.supervisor-only {
  display: none;
}

/* Show menu items based on user role */
body.role-admin .sidebar-menu-item.admin-only,
body.role-admin .sidebar-menu-item.supervisor-only {
  display: block;
}

body.role-supervisor .sidebar-menu-item.supervisor-only {
  display: block;
}

/* ========== MAIN WRAPPER ========== */
.main-wrapper {
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-wrapper {
  margin-left: 60px;
}

/* ========== TOP BAR ========== */
.top-bar {
  height: 70px;
  background: #fff;
  border-bottom: 1px solid #e1e8ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #7f8c8d;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-separator {
  color: #bdc3c7;
}

.breadcrumb-active {
  color: #2c3e50;
  font-weight: 500;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-bar-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f7fa;
  border-radius: 6px;
  color: #7f8c8d;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  border: none;
}

.top-bar-icon:hover {
  background: #e8ecef;
  color: #2c3e50;
}

.top-bar-icon.has-notification::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: #e74c3c;
  border-radius: 50%;
  border: 2px solid #fff;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: #f5f7fa;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.user-menu:hover {
  background: #e8ecef;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3498db, #2980b9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: #2c3e50;
}

.user-dropdown-icon {
  color: #7f8c8d;
  font-size: 12px;
  transition: transform 0.2s;
}

.user-menu.active .user-dropdown-icon {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  min-width: 220px;
  padding: 8px;
  display: none;
  z-index: 1000;
  border: 1px solid #e1e8ed;
}

.user-dropdown.show {
  display: block;
  animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-dropdown-header {
  padding: 12px 12px 8px;
  border-bottom: 1px solid #e1e8ed;
  margin-bottom: 4px;
}

.user-dropdown-name {
  font-weight: 600;
  color: #2c3e50;
  font-size: 15px;
  margin-bottom: 4px;
}

.user-dropdown-username {
  font-size: 13px;
  color: #7f8c8d;
}

.user-dropdown-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.user-dropdown-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #2c3e50;
}

.user-dropdown-item:hover {
  background: #f5f7fa;
}

.user-dropdown-item i {
  width: 18px;
  text-align: center;
  color: #7f8c8d;
}

.user-dropdown-item.logout {
  color: #e74c3c;
  border-top: 1px solid #e1e8ed;
  margin-top: 4px;
  padding-top: 14px;
}

.user-dropdown-item.logout:hover {
  background: #fff5f5;
}

.user-dropdown-item.logout i {
  color: #e74c3c;
}

/* ========== CONTENT WRAPPER ========== */
.content-wrapper {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: #f5f7fa;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: #7f8c8d;
}

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: 32px;
  border-bottom: 2px solid #e1e8ed;
  margin-bottom: 24px;
  background: #fff;
  padding: 0 24px;
}

.tab-item {
  padding: 16px 0;
  font-size: 14px;
  font-weight: 500;
  color: #7f8c8d;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.tab-item:hover {
  color: #2c3e50;
}

.tab-item.active {
  color: #e74c3c;
  border-bottom-color: #e74c3c;
}

/* ========== CARDS ========== */
.card {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e1e8ed;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
  overflow: hidden;
}

.card-padding {
  padding: 24px;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e1e8ed;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i {
  color: #e74c3c;
  font-size: 18px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-body {
  padding: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 12px;
  color: #7f8c8d;
  font-size: 14px;
}

.search-box input {
  height: 38px;
  padding: 0 12px 0 36px;
  border: 1px solid #e1e8ed;
  border-radius: 6px;
  font-size: 14px;
  color: #2c3e50;
  background: #f5f7fa;
  transition: all 0.2s ease;
  width: 250px;
}

.search-box input:focus {
  outline: none;
  border-color: #e74c3c;
  background: #fff;
}

.search-box input::placeholder {
  color: #95a5a6;
}

.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead th {
  background: #f5f7fa;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #7f8c8d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e1e8ed;
  white-space: nowrap;
}

.table tbody td {
  padding: 16px;
  font-size: 14px;
  color: #2c3e50;
  border-bottom: 1px solid #f5f7fa;
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background: #f8fafb;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ========== FORM ELEMENTS ========== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: #2c3e50;
  margin-bottom: 8px;
}

.form-label-required::before {
  content: '* ';
  color: #e74c3c;
}

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d1d8dd;
  border-radius: 6px;
  font-size: 14px;
  color: #2c3e50;
  background: #fff;
  transition: all 0.2s ease;
  outline: none;
}

.form-input:hover {
  border-color: #b8c2cc;
}

.form-input:focus {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231,76,60,0.1);
}

.form-input::placeholder {
  color: #95a5a6;
}

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237f8c8d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-input {
  height: auto;
  padding: 12px;
  resize: vertical;
  min-height: 80px;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  outline: none;
}

.btn-primary {
  background: #e74c3c;
  color: white;
  box-shadow: 0 2px 4px rgba(231,76,60,0.2);
}

.btn-primary:hover {
  background: #d62c1a;
  box-shadow: 0 4px 8px rgba(231,76,60,0.3);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #f5f7fa;
  color: #2c3e50;
  border: 1px solid #d1d8dd;
}

.btn-secondary:hover {
  background: #e8ecef;
}

.btn-success {
  background: #27ae60;
  color: white;
  box-shadow: 0 2px 4px rgba(39,174,96,0.2);
}

.btn-success:hover {
  background: #229954;
  box-shadow: 0 4px 8px rgba(39,174,96,0.3);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
  height: 48px;
}

/* ========== TABLE ========== */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  background: #f5f7fa;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #7f8c8d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e1e8ed;
  white-space: nowrap;
}

.data-table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: #2c3e50;
  border-bottom: 1px solid #f5f7fa;
}

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

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

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ========== BADGES ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 12px;
  white-space: nowrap;
}

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-in {
  background: #d5f4e6;
  color: #27ae60;
}

.badge-in::before {
  background: #27ae60;
}

.badge-out {
  background: #fadbd8;
  color: #e74c3c;
}

.badge-out::before {
  background: #e74c3c;
}

.badge-inactive {
  background: #ecf0f1;
  color: #7f8c8d;
}

.badge-blue {
  background: #e3f2fd;
  color: #2196f3;
  font-weight: 600;
}

.badge-green {
  background: #d5f4e6;
  color: #27ae60;
  font-weight: 600;
}

.badge-red {
  background: #fadbd8;
  color: #e74c3c;
  font-weight: 600;
}

.badge-gray {
  background: #ecf0f1;
  color: #7f8c8d;
  font-weight: 600;
}

/* ========== USER CELL ========== */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ========== ACTION BUTTONS ========== */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid #e1e8ed;
  background: #fff;
  color: #7f8c8d;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.btn-icon:hover {
  background: #f5f7fa;
  transform: translateY(-1px);
}

.btn-icon-edit {
  color: #3498db;
  border-color: #d6eaf8;
}

.btn-icon-edit:hover {
  background: #ebf5fb;
  border-color: #3498db;
  color: #2980b9;
}

.btn-icon-delete {
  color: #e74c3c;
  border-color: #fadbd8;
}

.btn-icon-delete:hover {
  background: #fff5f5;
  border-color: #e74c3c;
  color: #c0392b;
}

/* ========== STATS CARDS ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
}

.stat-card.stat-blue::before {
  background: #3498db;
}

.stat-card.stat-green::before {
  background: #27ae60;
}

.stat-card.stat-red::before {
  background: #e74c3c;
}

.stat-card.stat-orange::before {
  background: #f39c12;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-card.stat-blue .stat-icon {
  background: #e3f2fd;
  color: #3498db;
}

.stat-card.stat-green .stat-icon {
  background: #e8f8f5;
  color: #27ae60;
}

.stat-card.stat-red .stat-icon {
  background: #fadbd8;
  color: #e74c3c;
}

.stat-card.stat-orange .stat-icon {
  background: #fef5e7;
  color: #f39c12;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #2c3e50;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: #7f8c8d;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== SCAN SCORECARDS ========== */
.scan-scorecards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.scorecard {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  padding: 14px 16px;
  border-left: 4px solid;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s, transform 0.2s;
}

.scorecard-in {
  background: #ecfdf5;
  border-color: #059669;
}

.scorecard-out {
  background: #fef2f2;
  border-color: #dc2626;
}

.scorecard:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.scorecard-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.scorecard-in .scorecard-icon {
  background: rgba(5, 150, 105, 0.15);
  color: #059669;
}

.scorecard-out .scorecard-icon {
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
}

.scorecard-content {
  display: flex;
  flex-direction: column;
}

.scorecard-in .scorecard-value {
  color: #059669;
}

.scorecard-out .scorecard-value {
  color: #dc2626;
}

.scorecard-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

.scorecard-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  margin-top: 1px;
}

/* ========== SCAN AREA ========== */
.scan-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}

.scan-left {
  min-width: 0;
}

.scan-right {
  position: sticky;
  top: 24px;
}

.scan-input {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border: 2px solid #d1d8dd;
  border-radius: 8px;
  font-size: 20px;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  letter-spacing: 2px;
  transition: all 0.2s ease;
}

.scan-input:focus {
  border-color: #e74c3c;
  box-shadow: 0 0 0 4px rgba(231,76,60,0.1);
  outline: none;
}

/* ========== RECENT SCANS ========== */
.recent-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e1e8ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.recent-title {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.recent-badge {
  padding: 4px 10px;
  background: #e8f8f5;
  color: #27ae60;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.recent-list {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.recent-item {
  padding: 16px 24px;
  border-bottom: 1px solid #f5f7fa;
  transition: all 0.2s ease;
  cursor: pointer;
}

.recent-item:hover {
  background: #f8fafb;
}

.recent-item:last-child {
  border-bottom: none;
}

.recent-item-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 8px;
}

.recent-imei {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
}

.recent-time {
  font-size: 11px;
  color: #95a5a6;
}

.recent-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-name {
  font-size: 13px;
  color: #2c3e50;
  font-weight: 500;
}

.recent-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 10px;
  width: fit-content;
}

.recent-action.in {
  background: #d5f4e6;
  color: #27ae60;
}

.recent-action.out {
  background: #fadbd8;
  color: #e74c3c;
}

.recent-action i {
  font-size: 10px;
}

.scan-result {
  display: none;
  padding: 16px;
  border-radius: 8px;
  margin-top: 12px;
  align-items: center;
  gap: 12px;
}

.scan-result.success {
  display: flex;
  background: #d5f4e6;
  color: #27ae60;
  border: 1px solid #a8e6cf;
}

.scan-result.error {
  display: flex;
  background: #fadbd8;
  color: #e74c3c;
  border: 1px solid #f5b7b1;
}

.scan-result.not-found {
  display: flex;
  background: #fef5e7;
  color: #f39c12;
  border: 1px solid #fdeaa3;
}

/* ========== DEVICE INFO ========== */
#device-info {
  margin-top: 24px;
}

.device-info-card {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e1e8ed;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

#device-info-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
}

.status-header-in {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: white;
}

.status-header-out {
  background: linear-gradient(135deg, #e74c3c, #ec7063);
  color: white;
}

.device-info-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.device-info-table tr {
  border-bottom: 1px solid #f0f2f5;
}

.device-info-table tr:last-child {
  border-bottom: none;
}

.info-label-cell {
  width: 200px;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  background: #f8fafb;
  border-right: 1px solid #f0f2f5;
  vertical-align: middle;
}

.info-value-cell {
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  color: #2c3e50;
  vertical-align: middle;
}

/* ========== MODAL ========== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex !important;
}

.modal-content {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 24px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e1e8ed;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f7fa;
  border: none;
  border-radius: 6px;
  color: #7f8c8d;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #e8ecef;
  color: #2c3e50;
}

.modal-body {
  margin-bottom: 20px;
}

.modal-footer {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #e1e8ed;
}

/* ========== WAREHOUSE SELECTOR ========== */
.warehouse-selector {
  margin-top: 8px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.warehouse-checkboxes {
  margin-top: 12px;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
  background: #f8fafb;
}

.warehouse-checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.warehouse-checkbox-item:hover {
  background: #eef2f7;
}

.warehouse-checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #e74c3c;
}

.warehouse-checkbox-label {
  flex: 1;
  font-size: 14px;
  color: #2c3e50;
  cursor: pointer;
  user-select: none;
}

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: #f5f7fa;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #95a5a6;
}

.empty-title {
  font-size: 16px;
  font-weight: 500;
  color: #2c3e50;
  margin-bottom: 4px;
}

.empty-text {
  font-size: 14px;
  color: #7f8c8d;
}

/* ========== PAGINATION ========== */
#pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid #e1e8ed;
}

/* ========== FILTERS ========== */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.filters .form-input {
  width: auto;
  min-width: 200px;
  flex: 1;
}

.filters .btn {
  flex-shrink: 0;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f5f7fa;
}

::-webkit-scrollbar-thumb {
  background: #d1d8dd;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b8c2cc;
}

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

  .scan-layout {
    grid-template-columns: 1fr;
  }
  
  .scan-right {
    position: static;
  }
  
  .recent-list {
    max-height: 500px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  
  .sidebar-logo-text,
  .sidebar-menu-text {
    opacity: 0;
    width: 0;
  }
  
  .main-wrapper {
    margin-left: 60px;
  }
  
  .top-bar {
    padding: 0 16px;
  }
  
  .content-wrapper {
    padding: 16px;
  }
  
  .user-name {
    display: none;
  }
  
  .tabs {
    gap: 20px;
    overflow-x: auto;
    padding: 0 16px;
  }
  
  .info-label-cell {
    width: 140px;
    padding: 10px 16px;
    font-size: 13px;
  }

  .info-value-cell {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .filters {
    flex-direction: column;
  }
  
  .filters .form-input {
    width: 100%;
    min-width: 100%;
  }
}

/* ========== UTILITIES ========== */
.text-center {
  text-align: center;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace !important;
}

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mt-4 {
  margin-top: 16px;
}

.w-full {
  width: 100%;
}

.grid {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== AUTH PAGES ========== */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  padding: 20px;
}

.auth-box {
  background: white;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 440px;
  padding: 48px 40px;
}

.auth-box-large {
  max-width: 520px;
}

.auth-header {
  text-align: center;
  margin-bottom: 36px;
}

.auth-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(231, 76, 60, 0.3);
}

.auth-logo i {
  font-size: 40px;
  color: white;
}

.auth-title {
  font-size: 28px;
  font-weight: 800;
  color: #2c3e50;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 15px;
  color: #7f8c8d;
  font-weight: 500;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 16px;
  color: #95a5a6;
  font-size: 16px;
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 48px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #5a6c7d;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #e74c3c;
}

.error-message {
  padding: 14px 16px;
  background: #fff5f5;
  border: 1px solid #feb2b2;
  border-radius: 8px;
  color: #c53030;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.error-message::before {
  content: "\f06a";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 16px;
}

.success-message {
  padding: 14px 16px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  color: #166534;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.success-message::before {
  content: "\f058";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 16px;
}

.btn-block {
  width: 100%;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 24px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e1e8ed;
}

.auth-footer p {
  font-size: 14px;
  color: #5a6c7d;
}

.auth-footer a {
  color: #e74c3c;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.auth-footer a:hover {
  color: #c0392b;
  text-decoration: underline;
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: #7f8c8d;
  font-style: italic;
}


/* ========== TOAST NOTIFICATION ========== */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
}

.toast {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.1);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 350px;
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 4px solid #e74c3c;
}

.toast.hide {
  animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Toast types */
.toast-success {
  border-left-color: #27ae60;
}

.toast-success .toast-icon {
  color: #27ae60;
}

.toast-error {
  border-left-color: #e74c3c;
}

.toast-error .toast-icon {
  color: #e74c3c;
}

.toast-warning {
  border-left-color: #f39c12;
}

.toast-warning .toast-icon {
  color: #f39c12;
}

.toast-info {
  border-left-color: #3498db;
}

.toast-info .toast-icon {
  color: #3498db;
}

.toast-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 700;
  font-size: 15px;
  color: #2c3e50;
  margin-bottom: 4px;
}

.toast-message {
  font-size: 14px;
  color: #5a6c7d;
  line-height: 1.5;
}

.toast-close {
  background: none;
  border: none;
  color: #95a5a6;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.toast-close:hover {
  background: #f5f7fa;
  color: #2c3e50;
}

@keyframes slideInRight {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

/* ===== Mass Upload Dropdown ===== */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  min-width: 200px;
  z-index: 1000;
  overflow: hidden;
  animation: dropdownFadeIn 0.15s ease;
}

.dropdown-menu.show {
  display: block;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 14px;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: #f1f5f9;
}

.dropdown-item i {
  width: 18px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

.dropdown-item:first-child {
  border-bottom: 1px solid #f1f5f9;
}

/* ===== Upload Error Modal ===== */
.modal-lg {
  max-width: 640px;
  width: 90%;
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header-row .modal-title {
  margin-bottom: 0;
}

.modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.modal-close-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.upload-error-summary {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.upload-error-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.error-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #475569;
}

.error-stat i {
  font-size: 14px;
}

.error-stat-bad {
  color: #dc2626;
}

.upload-error-table-wrapper {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 16px;
}

.upload-error-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.upload-error-table thead th {
  background: #f8fafc;
}

.upload-error-table td {
  vertical-align: top;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
}

.upload-error-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.upload-error-list li {
  padding: 2px 0;
  color: #dc2626;
  font-size: 13px;
}

.upload-error-list li::before {
  content: '• ';
  color: #dc2626;
}
