/* MN Stock Manager - Main Styles */
:root {
  --primary: #0f4c75;
  --primary-light: #3282b8;
  --primary-dark: #0b2545;
  --accent: #1b9aaa;
  --accent-light: #26c6da;
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-sidebar: #0b2545;
  --text: #1a1a2e;
  --text-light: #6b7280;
  --text-white: #f8f9fa;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(11, 37, 69, 0.08), 0 4px 12px rgba(11, 37, 69, 0.04);
  --shadow-lg: 0 4px 12px rgba(11, 37, 69, 0.1), 0 8px 24px rgba(11, 37, 69, 0.06);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--accent) 100%);
}

.login-container {
  background: var(--bg-card);
  padding: 48px 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 420px;
}

.login-container h1 {
  font-family: 'Inter', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}

.login-container .subtitle {
  color: var(--text-light);
  margin-bottom: 32px;
  font-size: 14px;
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-header .role-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 8px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 8px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.05em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
  border-left: 3px solid transparent;
}

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

.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border-left-color: var(--accent);
}

.nav-item .icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition);
}

.btn-logout:hover { background: rgba(239, 68, 68, 0.3); }

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 24px 32px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--primary-dark);
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon.blue { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.stat-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.orange { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.red { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.stat-icon.teal { background: rgba(27, 154, 170, 0.1); color: var(--accent); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }

.stat-info h3 { font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.stat-info p { font-size: 13px; color: var(--text-light); }

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(50, 130, 184, 0.15);
}

.form-control:disabled {
  background: var(--bg);
  cursor: not-allowed;
}

select.form-control {
  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='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-inline {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(50, 130, 184, 0.3);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-light); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: #059669; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-warning {
  background: var(--warning);
  color: white;
}
.btn-warning:hover { background: #d97706; }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

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

.btn-icon {
  padding: 8px;
  min-width: 36px;
  justify-content: center;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

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

thead {
  background: var(--bg);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

td code {
  white-space: nowrap;
  font-size: 0.9em;
}

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(15, 76, 117, 0.03); }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-available { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-sold { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.badge-warranty { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-replaced { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.badge-received { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-sent_to_lab { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.badge-repaired { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-returned_to_customer { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-rejected { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-returned_to_supplier { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-returned { background: rgba(245, 158, 11, 0.1); color: var(--warning); }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 20px;
}

.filter-bar .form-group { margin-bottom: 0; min-width: 160px; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

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

.modal {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition);
}

.modal-overlay.active .modal { transform: translateY(0); }

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

.modal-header h2 { font-size: 18px; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 380px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
.toast-warning { background: var(--warning); }

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

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: white;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
}

.pagination button:hover:not(:disabled) { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination span { font-size: 13px; color: var(--text-light); }

/* Temp batch table for incoming */
.batch-table {
  background: #f8fafc;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.batch-group {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.batch-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
}

.identifier-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.identifier-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-light);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* Detail panels */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.detail-item label {
  font-size: 12px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-item .value {
  font-size: 15px;
  font-weight: 600;
  margin-top: 2px;
}

/* Status timeline */
.timeline {
  padding: 16px 0;
}

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

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
}

.timeline-content h4 { font-size: 14px; font-weight: 600; }
.timeline-content p { font-size: 13px; color: var(--text-light); }
.timeline-content .time { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Hamburger button */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background var(--transition);
}
.hamburger-btn:hover { background: var(--primary-light); }

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* Responsive */
@media (max-width: 768px) {
  .hamburger-btn { display: flex; align-items: center; justify-content: center; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; padding-top: 60px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .page-header { flex-wrap: wrap; gap: 8px; }
  .page-header h1 { font-size: 20px; width: 100%; }
  .page-header > div { flex-wrap: wrap; }
  .card { padding: 16px; }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-group { min-width: 100%; }
  .form-inline { flex-direction: column; align-items: stretch; }
  .modal { max-width: 95vw; margin: 8px; max-height: 90vh; }
  .modal-header { padding: 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  .tabs { flex-wrap: wrap; }
  .tab { padding: 8px 12px; font-size: 13px; }
  .toast-container { top: 10px; right: 10px; left: 10px; }
  .toast { max-width: 100%; }
  .batch-group-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 14px; gap: 12px; }
  .stat-info h3 { font-size: 22px; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; }
  .login-container { padding: 32px 24px; margin: 16px; }
  .login-container h1 { font-size: 22px; }
  .btn { padding: 10px 16px; font-size: 13px; }
  table { font-size: 12px; }
  th { padding: 8px 10px; font-size: 11px; white-space: nowrap; }
  td { padding: 8px 10px; }
  .timeline-item { gap: 10px; }
  .timeline-dot { width: 28px; height: 28px; font-size: 12px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  table { font-size: 11px; }
  th { padding: 6px 8px; white-space: nowrap; }
  td { padding: 6px 8px; }
  .pagination { flex-wrap: wrap; }
  .form-control[style*="max-width"] { max-width: 100% !important; }
  .batch-group-header { font-size: 13px; }
  .batch-group-header span { word-break: break-word; }
  .modal-header h2 { font-size: 16px; }
  .card { padding: 12px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Clickable rows */
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: rgba(15, 76, 117, 0.06); }

/* Selection highlight */
tr.selected { background: rgba(27, 154, 170, 0.08); }

/* Checkbox in table */
td input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* IMEI entry table (exact row count) */
.imei-entry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.imei-entry-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}

.imei-entry-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}

.imei-entry-table .imei-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Courier New', monospace;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.imei-entry-table .imei-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(50, 130, 184, 0.15);
}

.imei-entry-table .imei-input.error {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.04);
}

.imei-entry-table .imei-input.valid {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.04);
}

.imei-entry-table .row-num {
  width: 40px;
  text-align: center;
  font-weight: 600;
  color: var(--text-light);
  font-size: 13px;
}

/* Modal wider variant for IMEI entry */
.modal.modal-wide {
  max-width: 560px;
}

/* Worker name tag in history */
.worker-tag {
  display: inline-block;
  background: rgba(27, 154, 170, 0.1);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

/* ===== SEARCHABLE DROPDOWN ===== */
.search-select {
  position: relative;
  width: 100%;
}

.search-select-input-wrapper {
  position: relative;
}

.search-select-input {
  cursor: text;
  padding-right: 32px !important;
}

.search-select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  font-size: 12px;
}

.search-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  max-height: 220px;
  overflow-y: auto;
  display: none;
  margin-top: 4px;
}

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

.search-select-option {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-select-option:hover,
.search-select-option:focus {
  background: rgba(15, 76, 117, 0.06);
}

.search-select-option.selected {
  background: rgba(27, 154, 170, 0.1);
  font-weight: 600;
}

.search-select-empty {
  padding: 12px 14px;
  color: var(--text-light);
  font-size: 13px;
  text-align: center;
}

/* ===== LANGUAGE SWITCHER ===== */
.btn-lang {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-light);
  border: 1px solid var(--border);
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-lang:hover {
  background: var(--primary-light);
  color: white;
  border-color: var(--primary-light);
}

.btn-lang-sidebar {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.03em;
}

.btn-lang-sidebar:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* ===== RTL SUPPORT ===== */
[dir="rtl"] body {
  text-align: right;
}

[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
}

[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: 260px;
}

[dir="rtl"] .nav-item {
  border-left: none;
  border-right: 3px solid transparent;
}

[dir="rtl"] .nav-item.active {
  border-left-color: transparent;
  border-right-color: var(--accent);
}

[dir="rtl"] th {
  text-align: right;
}

[dir="rtl"] .page-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .form-row {
  direction: rtl;
}

[dir="rtl"] .filter-bar {
  direction: rtl;
}

[dir="rtl"] .modal-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .modal-footer {
  flex-direction: row-reverse;
}

[dir="rtl"] .toast-container {
  right: auto;
  left: 20px;
}

@keyframes slideInRTL {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

[dir="rtl"] .toast {
  animation: slideInRTL 0.3s ease;
}

[dir="rtl"] select.form-control {
  background-position: left 12px center;
  padding-left: 32px;
  padding-right: 14px;
}

[dir="rtl"] .search-select-arrow {
  right: auto;
  left: 12px;
}

[dir="rtl"] .search-select-input {
  padding-right: 14px !important;
  padding-left: 32px !important;
}

[dir="rtl"] .stat-card {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-item {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .btn {
  flex-direction: row-reverse;
}

[dir="rtl"] .btn-logout {
  flex-direction: row-reverse;
}

[dir="rtl"] .batch-group-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .detail-item {
  text-align: right;
}

[dir="rtl"] .timeline-item {
  flex-direction: row-reverse;
}

[dir="rtl"] .timeline-item:not(:last-child)::before {
  left: auto;
  right: 15px;
}

[dir="rtl"] .form-inline {
  flex-direction: row-reverse;
}

[dir="rtl"] .pagination {
  flex-direction: row-reverse;
}

[dir="rtl"] .sidebar-header {
  text-align: right;
}

[dir="rtl"] .identifier-list {
  direction: ltr;
}

[dir="rtl"] code {
  direction: ltr;
  unicode-bidi: embed;
}

[dir="rtl"] .imei-entry-table .imei-input {
  direction: ltr;
  text-align: left;
}

[dir="rtl"] .tabs {
  flex-direction: row-reverse;
}

/* RTL responsive */
@media (max-width: 768px) {
  [dir="rtl"] .hamburger-btn { left: auto; right: 12px; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  [dir="rtl"] .sidebar.open { transform: translateX(0); }
  [dir="rtl"] .main-content { margin-right: 0; }
  [dir="rtl"] .batch-group-header { align-items: flex-end; }
}

/* Print button style */
.btn-print {
  background: #6b7280;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition);
}
.btn-print:hover { background: #4b5563; }
.btn-print:active { background: #374151; }
