/* ==========================================================================
   MNElec Project & Inventory Management System
   Modern Flat Theme - Brand Colors: #0D5AA9 & #D80075
   ========================================================================== */

:root {
  --primary: #0D5AA9;
  --primary-hover: #09427D;
  --primary-light: #EBF3FA;
  --primary-subtle: #D8E8F8;
  
  --accent: #D80075;
  --accent-hover: #B80063;
  --accent-light: #FDF2F7;
  
  --success: #10B981;
  --success-light: #ECFDF5;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --info: #06B6D4;
  --info-light: #ECFEFF;

  --dark: #0F172A;
  --dark-light: #1E293B;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  --bg-app: #F8FAFC;
  --bg-card: #FFFFFF;
  --border: #E2E8F0;
  --border-focus: #0D5AA9;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);

  --sidebar-width: 275px;
  --header-height: 68px;
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html, body, button, input, select, textarea, table, th, td, pre, code, kbd, samp, optgroup, datalist {
  font-family: var(--font-family);
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Đồng bộ toàn bộ chữ, mã định danh, số liệu sang font chuẩn website */
code, pre, kbd, samp, .mono, [style*="font-family: monospace"], [style*="font-family:monospace"], [style*="font-family: 'Consolas'"], [style*="font-family:'Consolas'"] {
  font-family: var(--font-family) !important;
  font-variant-numeric: tabular-nums;
}

/* ----------------- TYPOGRAPHY & LINKS ----------------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--dark);
  font-weight: 700;
  line-height: 1.3;
}
a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  color: var(--primary-hover);
}

/* ----------------- APP SHELL & LAYOUT ----------------- */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background-color: #FFFFFF;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.brand-logo img {
  height: 32px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.brand-title {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-top: 2px;
}

.btn-brand-edit {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.45;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-left: 4px;
  padding: 0;
}

.sidebar-header:hover .btn-brand-edit {
  opacity: 1;
  border-color: var(--border);
  background: var(--bg-app);
  color: var(--primary);
}

.btn-brand-edit:hover {
  background: var(--primary-light) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  transform: scale(1.06);
}

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

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 10px 12px 6px;
  letter-spacing: 0.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.nav-item svg {
  flex-shrink: 0;
}

.nav-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.nav-item.active {
  background-color: var(--primary);
  color: #FFFFFF;
}

.nav-item.active svg {
  stroke: #FFFFFF;
}

.nav-item .badge {
  margin-left: auto;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  background-color: #FAFAFA;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* MAIN CONTENT WRAPPER */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* TOP HEADER */
.top-header {
  height: var(--header-height);
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-muted);
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* MAIN BODY */
.page-content {
  padding: 28px;
  flex: 1;
}

/* ----------------- FLAT CARDS & PANELS ----------------- */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

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

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-body {
  padding: 20px;
}

/* METRIC STAT CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue { background-color: var(--primary-light); color: var(--primary); }
.stat-icon.pink { background-color: var(--accent-light); color: var(--accent); }
.stat-icon.green { background-color: var(--success-light); color: var(--success); }
.stat-icon.yellow { background-color: var(--warning-light); color: var(--warning); }

.stat-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
}

.stat-content {
  min-width: 0;
  flex: 1;
}

.stat-val-money {
  white-space: nowrap;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

/* MATERIALS STATS GRID (Project Materials Finance) */
.materials-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.materials-stats-grid .stat-card {
  min-width: 0;
}

.materials-stats-grid .stat-card-hero {
  border-left: 4px solid var(--primary);
  background: linear-gradient(135deg, rgba(13,90,169,0.03) 0%, rgba(13,90,169,0.08) 100%);
}

.materials-stats-grid .stat-card-hero .stat-val {
  color: var(--primary);
  font-weight: 800;
}

.materials-stats-grid .stat-card-hero .stat-label {
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
}

.materials-stats-grid .stat-qty-divider {
  display: none;
}

/* SESSION META PANEL (Workstation status info) */
.session-meta-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.session-meta-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  min-width: 0;
}

.session-meta-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.session-meta-icon.blue { background-color: var(--primary-light); color: var(--primary); }
.session-meta-icon.green { background-color: var(--success-light); color: var(--success); }
.session-meta-icon.purple { background-color: #F3E8FF; color: #9333EA; }
.session-meta-icon.orange { background-color: #FFEDD5; color: #EA580C; }

.session-meta-body {
  min-width: 0;
  flex: 1;
}

.session-meta-title {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.session-meta-desc {
  font-size: 13px;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-pill {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  background: #E2E8F0;
  padding: 2px 8px;
  border-radius: 4px;
  color: #334155;
  font-weight: 600;
}

/* ----------------- BUTTONS & BADGES ----------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: #FFFFFF;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-accent {
  background-color: var(--accent);
  color: #FFFFFF;
}
.btn-accent:hover {
  background-color: var(--accent-hover);
}

.btn-outline {
  background-color: #FFFFFF;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: var(--bg-app);
  border-color: #CBD5E1;
}

.btn-danger {
  background-color: var(--danger);
  color: #FFFFFF;
}
.btn-danger:hover {
  background-color: #DC2626;
}

.btn-outline-danger {
  background-color: #FFFFFF;
  border: 1px solid #FECACA;
  color: #DC2626;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.btn-outline-danger:hover {
  background-color: #FEF2F2;
  border-color: #DC2626;
  color: #B91C1C;
}

/* ----------------- PROJECT DETAIL HERO HEADER ----------------- */
.project-detail-hero {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.project-hero-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #F1F5F9;
}

.project-hero-meta-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-back-project {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 600;
  border: 1px solid var(--border);
  background: #FFFFFF;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-back-project:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: #EEF2FF;
}

.project-hero-sep {
  color: #CBD5E1;
  font-weight: 300;
  font-size: 14px;
}

.project-code-chip {
  display: inline-flex;
  align-items: center;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  color: #3730A3;
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.project-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-hero-title-wrap {
  display: flex;
  align-items: center;
}

.project-hero-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.35;
  margin: 0;
  letter-spacing: -0.2px;
}

@media (max-width: 640px) {
  .project-detail-hero {
    padding: 12px 14px;
    margin-bottom: 16px;
  }
  .project-hero-nav-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .project-hero-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  .project-hero-title {
    font-size: 17.5px;
  }
}

/* STOCK MODAL & TRANSACTION ENHANCEMENTS */
.stock-item-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.stock-out-purpose-group {
  display: flex;
  gap: 8px;
  background: #F1F5F9;
  padding: 4px;
  border-radius: 8px;
  margin-top: 4px;
}

.purpose-pill {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.purpose-pill:hover {
  color: var(--dark);
  background: rgba(255, 255, 255, 0.5);
}

.purpose-pill.active {
  background: #FFFFFF;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (max-width: 640px) {
  .stock-out-purpose-group {
    flex-direction: column;
    gap: 4px;
  }
  .purpose-pill {
    justify-content: flex-start;
    padding: 9px 12px;
    font-size: 13px;
  }
}

/* TRANSACTION MOBILE CARDS */
.tx-card-item {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.tx-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tx-card-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--dark);
}
.tx-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm, 6px);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: #E2E8F0; color: #475569; }

/* Project Technical Scope Badges */
.badge-type-hw-fw-sw { background: #EEF2FF; color: #4338CA; border: 1px solid #C7D2FE; }
.badge-type-hw-fw    { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.badge-type-hw-only  { background: #FFFBEB; color: #B45309; border: 1px solid #FDE68A; }
.badge-type-fw-only  { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; }
.badge-type-sw-only  { background: #FAF5FF; color: #7E22CE; border: 1px solid #E9D5FF; }

/* ----------------- TABLES ----------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.table th {
  background-color: #F8FAFC;
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.table tr:hover td {
  background-color: #F8FAFC;
}

/* ----------------- FORMS & INPUTS ----------------- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: #FFFFFF;
  color: var(--text-main);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(13, 90, 169, 0.12);
}

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

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

/* ----------------- TABS COMPONENT ----------------- */
.tabs-header {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  white-space: nowrap;
}

.tab-btn {
  padding: 12px 18px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--primary);
}

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

.tab-pane,
.project-tab-pane {
  display: none;
}

.tab-pane.active,
.project-tab-pane.active {
  display: block;
}

/* ----------------- MODAL DIALOGS ----------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-backdrop.show .modal-dialog {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-light);
  cursor: pointer;
}
.modal-close:hover {
  color: var(--dark);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: #F8FAFC;
}

/* ----------------- MODERNIZED LOGIN SCREEN ----------------- */
.login-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #0b1329;
  background-image: 
    radial-gradient(at 0% 0%, rgba(13, 90, 169, 0.45) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(30, 58, 138, 0.35) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(2, 132, 199, 0.15) 0px, transparent 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.login-ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 1;
}
.login-ambient-orb-1 {
  top: 10%;
  left: 15%;
  width: 320px;
  height: 320px;
  background: rgba(13, 90, 169, 0.25);
}
.login-ambient-orb-2 {
  bottom: 10%;
  right: 15%;
  width: 360px;
  height: 360px;
  background: rgba(99, 102, 241, 0.2);
}

.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.15);
  overflow: hidden;
  margin: auto;
}

.login-brand {
  padding: 32px 32px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: #FFFFFF;
}

.login-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
  padding: 0;
  background: transparent;
  border: none;
}

.login-logo-wrap img {
  height: 52px;
  width: auto;
  display: block;
  margin: 0 auto;
}

.login-brand-tag {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--primary, #0D5AA9);
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  margin: 0 auto 6px auto;
  text-align: center;
  text-transform: uppercase;
}

.login-brand h1 {
  font-size: 16px;
  color: #1E3A8A;
  font-weight: 700;
  margin: 0;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  text-align: center;
}

.login-form {
  padding: 24px 32px 28px;
}

/* Modern Input with Leading Icon */
.input-with-leading-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.input-with-leading-icon .leading-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94A3B8;
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color 0.2s;
}
.input-with-leading-icon input.form-control {
  padding-left: 38px !important;
  height: 44px;
  font-size: 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.input-with-leading-icon input.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 90, 169, 0.15);
}
.input-with-leading-icon input.form-control:focus + .leading-icon,
.input-with-leading-icon:focus-within .leading-icon {
  color: var(--primary);
}

.btn-toggle-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.btn-toggle-eye:hover {
  color: var(--primary);
  background: var(--bg-app);
}

.btn-login-submit {
  width: 100%;
  height: 46px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #0D5AA9 0%, #09478a 100%);
  border: none;
  box-shadow: 0 4px 12px rgba(13, 90, 169, 0.25);
  transition: all 0.2s ease;
}
.btn-login-submit:hover {
  background: linear-gradient(135deg, #1068c2 0%, #0D5AA9 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(13, 90, 169, 0.35);
}
.btn-login-submit:active {
  transform: translateY(0);
}

.link-forgot {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.link-forgot:hover {
  text-decoration: underline;
}

/* Biometric Login UI Card */
.biometric-login-card {
  text-align: center;
  padding: 10px 0 6px;
}

.biometric-scanner-zone {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.biometric-icon-circle {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border: 2px solid #BFDBFE;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(13, 90, 169, 0.15);
}
.biometric-scanner-zone:hover .biometric-icon-circle {
  transform: scale(1.06);
  background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
  border-color: var(--primary);
  box-shadow: 0 6px 20px rgba(13, 90, 169, 0.28);
}

.biometric-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 2px solid rgba(13, 90, 169, 0.4);
  animation: bioPulse 2.4s cubic-bezier(0.25, 0.8, 0.25, 1) infinite;
  pointer-events: none;
  z-index: 1;
}
.biometric-pulse-ring.delay {
  animation-delay: 1.2s;
}

@keyframes bioPulse {
  0% {
    width: 74px;
    height: 74px;
    opacity: 0.8;
  }
  100% {
    width: 120px;
    height: 120px;
    opacity: 0;
  }
}

.biometric-user-meta {
  margin-bottom: 20px;
}
.biometric-greeting {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.biometric-username {
  font-size: 17px;
  font-weight: 800;
  color: var(--dark);
  margin: 2px 0;
}
.biometric-device-label {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

.btn-biometric-action {
  width: 100%;
  height: 48px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0D5AA9 0%, #1e40af 100%);
  box-shadow: 0 4px 14px rgba(13, 90, 169, 0.28);
}

.biometric-switch-wrap {
  margin-top: 16px;
  text-align: center;
}
.btn-link-switch {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.15s;
}
.btn-link-switch:hover {
  background: var(--primary-light);
  text-decoration: underline;
}

/* 2FA Modern Header & OTP Inputs */
.twofa-header {
  text-align: center;
  margin-bottom: 18px;
}
.twofa-shield-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.twofa-header h3 {
  margin: 0 0 6px 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--dark);
}
.twofa-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.otp-inputs-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0 10px 0;
}
.otp-digit {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border: 2px solid #CBD5E1;
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--dark);
  transition: all 0.15s;
}
.otp-digit:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 90, 169, 0.18);
  outline: none;
  transform: scale(1.04);
}

.twofa-fallback-alert {
  background: #FFFBEB;
  border: 1px solid #F59E0B;
  color: #92400E;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  text-align: left;
}
.twofa-fallback-alert .fallback-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.twofa-fallback-alert .fallback-code-wrap {
  font-size: 16px;
}
.twofa-fallback-alert .fallback-code-wrap strong {
  font-size: 20px;
  color: #1E3A8A;
  letter-spacing: 2px;
}
.twofa-fallback-alert .fallback-hint {
  font-size: 11.5px;
  color: #78350F;
  margin-top: 4px;
}

.twofa-footer-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  font-size: 12px;
}
.twofa-back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}
.twofa-back-link:hover {
  color: var(--dark);
  text-decoration: underline;
}
.twofa-resend-btn {
  padding: 0;
  font-size: 12px;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
}

.login-footer-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid #F1F5F9;
  font-size: 11.5px;
  color: #94A3B8;
}

/* Floating Biometric Prompt Banner after login */
.biometric-prompt-banner {
  position: fixed;
  bottom: 74px;
  left: 14px;
  right: 14px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
  z-index: 2500;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUpBio 0.3s ease-out;
}
@keyframes slideUpBio {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.bio-prompt-content {
  display: flex;
  gap: 12px;
  align-items: center;
}
.bio-prompt-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #EFF6FF;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bio-prompt-text {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.bio-prompt-text strong {
  font-size: 13px;
  color: var(--dark);
  margin-bottom: 2px;
}
.bio-prompt-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ----------------- TOAST NOTIFICATIONS ----------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 12px 18px;
  min-width: 280px;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  animation: slideInRight 0.25s ease;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

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

/* ----------------- PCB / SCHEMATIC VIEWER ----------------- */
.diagram-frame {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #0B1E36;
  overflow: hidden;
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.diagram-frame img, .diagram-frame svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ----------------- FORMULAS & MATH ----------------- */
.calc-box {
  background-color: #F1F5F9;
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
}

/* ----------------- RESPONSIVE COMPONENTS & BREAKPOINTS ----------------- */

/* Sidebar Backdrop Overlay */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 98;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  padding: 6px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  line-height: 1;
}
.sidebar-close-btn:hover {
  background: var(--bg-app);
  color: var(--danger);
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  background: #FFFFFF;
  border-top: 1px solid var(--border);
  z-index: 92;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 100%;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 0;
  transition: color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  transition: transform 0.15s ease;
}

.bottom-nav-item:active {
  transform: scale(0.92);
}

.bottom-nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.bottom-nav-item.active svg {
  stroke: var(--primary);
}

/* Responsive Grid Classes */
.dashboard-main-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 24px;
}

.responsive-2col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.responsive-4col-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.filter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-toolbar-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.filter-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   ENHANCED RESPONSIVE DATA TABLES & PROPORTIONAL COLUMNS
   Solves squished columns in mobile landscape, tablet, and desktop views
   ========================================================================== */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
  background: #F1F5F9;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* Default min-width for any table inside responsive container */
.table-responsive table {
  min-width: 880px;
}

/* Specific min-widths per table to fit all columns comfortably */
.table-dashboard { min-width: 820px !important; }
.table-projects { min-width: 1000px !important; }
.table-repairs { min-width: 1180px !important; }
.table-inventory { min-width: 980px !important; }
.table-production { min-width: 1180px !important; }
.table-prod-breakdown { min-width: 980px !important; }
.table-materials { min-width: 1140px !important; }
.table-bom { min-width: 1000px !important; }
.table-transactions { min-width: 980px !important; }
.table-trash { min-width: 1000px !important; }
.table-users { min-width: 900px !important; }
.table-access-logs { min-width: 1050px !important; }
.table-repair-parts { min-width: 850px !important; }

/* Modal tables fit comfortably within dialog without forcing 880px */
.modal-dialog .table-responsive table,
.modal-dialog table {
  min-width: 100% !important;
}

/* Global Column Class Utilities */
.col-code, .col-sku, .col-id {
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
  min-width: 110px;
}
.col-name, .col-title {
  min-width: 250px;
  line-height: 1.45;
}
.col-customer {
  min-width: 210px;
  line-height: 1.45;
}
.col-status, .col-badge {
  white-space: nowrap !important;
  text-align: center !important;
  min-width: 120px;
}
.col-version, .col-rev {
  white-space: nowrap !important;
  text-align: center !important;
  min-width: 90px;
}
.col-qty, .col-count {
  white-space: nowrap !important;
  text-align: center !important;
  font-variant-numeric: tabular-nums;
  min-width: 80px;
}
.col-money, .col-price {
  white-space: nowrap !important;
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  min-width: 120px;
}
.col-date, .col-time {
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
  min-width: 130px;
}
.col-actions {
  white-space: nowrap !important;
  text-align: right !important;
  min-width: 110px;
}

/* Specific formatting per table column (ensures cells format properly even with simple JS innerHTML) */
/* Dashboard */
.table-dashboard td:nth-child(1) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-dashboard td:nth-child(3) { text-align: center; white-space: nowrap; }
.table-dashboard td:nth-child(4) { text-align: center; white-space: nowrap; }
.table-dashboard td:nth-child(5) { text-align: right; white-space: nowrap; }

/* Projects */
.table-projects td:nth-child(1) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-projects td:nth-child(3) { text-align: center; white-space: nowrap; }
.table-projects td:nth-child(4) { text-align: center; white-space: nowrap; }
.table-projects td:nth-child(5) { text-align: center; white-space: nowrap; }
.table-projects td:nth-child(6) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-projects td:nth-child(7) { text-align: right; white-space: nowrap; }

/* Repairs */
.table-repairs td:nth-child(1) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-repairs td:nth-child(4) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-repairs td:nth-child(5) { text-align: center; white-space: nowrap; }
.table-repairs td:nth-child(6) { text-align: center; white-space: nowrap; }
.table-repairs td:nth-child(7) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-repairs td:nth-child(8) { text-align: right; white-space: nowrap; }

/* Inventory */
.table-inventory th,
.table-inventory td {
  padding: 10px 12px;
}
.table-inventory td:nth-child(1) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-inventory td:nth-child(3) { white-space: nowrap; }
.table-inventory td:nth-child(4) { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-inventory td:nth-child(5) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-inventory td:nth-child(6) { white-space: nowrap; }
.table-inventory td:nth-child(7) { text-align: right; white-space: nowrap; }

/* Thao tác Action Column (Static to prevent covering intermediate columns on Tablet/Laptop) */
.table-inventory th:last-child,
.table-inventory td:last-child {
  position: static;
  text-align: right;
  white-space: nowrap;
}

/* BOM */
.table-bom td:nth-child(1) { white-space: nowrap; }
.table-bom td:nth-child(3) { text-align: center; white-space: nowrap; }
.table-bom td:nth-child(4) { text-align: center; white-space: nowrap; }
.table-bom td:nth-child(5) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-bom td:nth-child(6) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-bom td:nth-child(8) { text-align: right; white-space: nowrap; }

/* Project Materials */
.table-materials td:nth-child(3) { text-align: center; white-space: nowrap; }
.table-materials td:nth-child(4),
.table-materials td:nth-child(5),
.table-materials td:nth-child(6),
.table-materials td:nth-child(7) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-materials td:nth-child(8) { white-space: nowrap; }
.table-materials td:nth-child(9) { text-align: right; white-space: nowrap; }

/* Transactions */
.table-transactions td:nth-child(1) { white-space: nowrap; }
.table-transactions td:nth-child(2) { text-align: center; white-space: nowrap; }
.table-transactions td:nth-child(4) { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-transactions td:nth-child(6),
.table-transactions td:nth-child(7) { white-space: nowrap; }

/* Trash */
.table-trash td:nth-child(1) { text-align: center; white-space: nowrap; }
.table-trash td:nth-child(2) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-trash td:nth-child(5) { white-space: nowrap; }
.table-trash td:nth-child(6) { text-align: right; white-space: nowrap; }

/* Landscape Mobile Screen Optimization (devices in landscape with short height <= 550px) */
@media (orientation: landscape) and (max-height: 550px) {
  .table th, .table td {
    padding: 7px 10px !important;
    font-size: 12px !important;
  }
  .table th {
    font-size: 11px !important;
    letter-spacing: 0.3px !important;
  }
  .card-header {
    padding: 8px 12px !important;
  }
  .card-body {
    padding: 10px 12px !important;
  }
  .card {
    margin-bottom: 12px !important;
  }
  .filter-toolbar {
    gap: 6px !important;
  }
  .btn-sm {
    padding: 3px 8px !important;
    font-size: 11.5px !important;
  }
  .badge {
    padding: 2px 7px !important;
    font-size: 11px !important;
  }
}

/* Dual View Classes for Desktop vs Mobile */
.desktop-only-table {
  display: block;
}

.mobile-only-list {
  display: none;
}

/* Mobile Project Card Styles */
.project-card-item {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.project-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.project-code-tag {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(13, 90, 169, 0.08);
  padding: 3px 8px;
  border-radius: 6px;
  word-break: break-all;
}

.project-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  text-decoration: none;
  line-height: 1.4;
}

.project-card-name:hover {
  color: var(--primary);
}

.project-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.project-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #F1F5F9;
  margin-top: 4px;
}

/* TABLET & MOBILE BREAKPOINT (max-width: 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: min(320px, 86vw);
  }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.28);
    z-index: 999;
    width: var(--sidebar-width);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    z-index: 998;
  }
  .sidebar-header {
    padding: 0 12px 0 16px;
    gap: 8px;
  }
  .brand-logo {
    gap: 10px;
    min-width: 0;
  }
  .brand-sub {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin-top: 2px;
  }
  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    padding: 0;
    color: var(--text-muted);
  }
  .sidebar-close-btn:hover {
    background: var(--bg-app);
    color: var(--danger);
  }
  .sidebar-nav {
    padding: 16px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
  }
  .sidebar-nav::-webkit-scrollbar {
    width: 4px;
  }
  .sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
  }
  .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 4px;
  }
  .nav-section-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 10px 4px;
  }
  .nav-item {
    padding: 9px 12px;
    gap: 11px;
    font-size: 13.5px;
    white-space: nowrap;
    border-radius: 8px;
    margin-bottom: 2px;
  }
  .nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }
  .sidebar-footer {
    padding: 12px 14px;
  }
  .user-profile {
    gap: 10px;
  }
  .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
    flex-shrink: 0;
  }
  .user-info {
    min-width: 0;
    flex: 1;
  }
  .user-name {
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .user-role {
    font-size: 11.5px;
  }
  .main-wrapper {
    margin-left: 0;
  }
  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .dashboard-main-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .responsive-2col-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .responsive-2col-grid > * {
    grid-column: span 1 !important;
  }
  .responsive-4col-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* MOBILE BREAKPOINT (max-width: 640px) */
@media (max-width: 640px) {
  .page-content {
    padding: 14px 12px calc(76px + env(safe-area-inset-bottom, 0px)) 12px; /* Extra bottom padding for Bottom Nav */
  }

  .mobile-bottom-nav {
    display: block;
  }

  .top-header {
    height: 56px;
    padding: 0 12px;
    gap: 8px;
  }

  .header-left {
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  .mobile-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #F1F5F9;
    flex-shrink: 0;
  }

  .page-title {
    font-size: 14.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    margin: 0;
  }

  .header-right {
    flex-shrink: 0;
  }

  #headerAccessBadge {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
  }

  #headerAccessBadge .header-badge-domain {
    display: none;
  }

  /* -------------------------------------------------------------
     MOBILE STAT CARDS: Default 2x2 with responsive auto-containment
     ------------------------------------------------------------- */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 12px 14px;
    gap: 10px;
    border-radius: 10px;
    min-width: 0;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex-shrink: 0;
  }
  .stat-icon svg {
    width: 20px;
    height: 20px;
  }

  .stat-val {
    font-size: 18px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .stat-label {
    font-size: 11px;
    margin-top: 2px;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
  }

  /* -------------------------------------------------------------
     DASHBOARD STATS: Hero full-width money card + 3 compact cards
     ------------------------------------------------------------- */
  .dashboard-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
  }

  /* Full-width Hero card for Total Stock Value */
  .dashboard-stats-grid .stat-card-money {
    grid-column: 1 / -1 !important;
    order: -1 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 14px 16px !important;
    gap: 14px !important;
    background: linear-gradient(135deg, #FFFFFF 0%, #F0FDF4 100%) !important;
    border: 1px solid #BBF7D0 !important;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.08) !important;
    border-radius: 12px !important;
    min-width: 0 !important;
  }

  .dashboard-stats-grid .stat-card-money .stat-icon {
    width: 44px !important;
    height: 44px !important;
    border-radius: 12px !important;
    background-color: #DCFCE7 !important;
    color: #16A34A !important;
    flex-shrink: 0 !important;
  }

  .dashboard-stats-grid .stat-card-money .stat-icon svg {
    width: 24px !important;
    height: 24px !important;
  }

  .dashboard-stats-grid .stat-card-money .stat-content {
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
  }

  .dashboard-stats-grid .stat-card-money .stat-val {
    font-size: clamp(18px, 5.5vw, 24px) !important;
    font-weight: 800 !important;
    color: #15803D !important;
    white-space: nowrap !important;
    line-height: 1.1 !important;
    letter-spacing: -0.3px !important;
  }

  .dashboard-stats-grid .stat-card-money .stat-label {
    font-size: 11.5px !important;
    font-weight: 600 !important;
    color: #166534 !important;
    margin-top: 2px !important;
    white-space: nowrap !important;
  }

  /* 3 Compact Metric Cards in Row 2 */
  .dashboard-stats-grid .stat-card:not(.stat-card-money) {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 10px 4px !important;
    gap: 4px !important;
    border-radius: 10px !important;
    min-width: 0 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
  }

  .dashboard-stats-grid .stat-card:not(.stat-card-money) .stat-icon {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    margin-bottom: 2px !important;
  }

  .dashboard-stats-grid .stat-card:not(.stat-card-money) .stat-icon svg {
    width: 16px !important;
    height: 16px !important;
  }

  .dashboard-stats-grid .stat-card:not(.stat-card-money) .stat-content {
    min-width: 0 !important;
    width: 100% !important;
  }

  .dashboard-stats-grid .stat-card:not(.stat-card-money) .stat-val {
    font-size: 17px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
  }

  .dashboard-stats-grid .stat-card:not(.stat-card-money) .stat-label {
    font-size: 10.5px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    margin-top: 0 !important;
  }

  /* -------------------------------------------------------------
     INVENTORY STATS: 1 Hero money card + 4 compact cards (2x2 grid)
     ------------------------------------------------------------- */
  .inventory-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
  }

  .inventory-stats-grid .stat-card-money {
    grid-column: 1 / -1 !important;
    order: -1 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 12px 14px !important;
    gap: 12px !important;
    background: linear-gradient(135deg, #FFFFFF 0%, #F0FDF4 100%) !important;
    border: 1px solid #BBF7D0 !important;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.08) !important;
    border-radius: 12px !important;
    min-width: 0 !important;
  }

  .inventory-stats-grid .stat-card-money .stat-icon {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    background-color: #DCFCE7 !important;
    color: #16A34A !important;
    flex-shrink: 0 !important;
  }

  .inventory-stats-grid .stat-card-money .stat-val {
    font-size: clamp(18px, 5.5vw, 24px) !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
    color: #15803D !important;
  }

  .inventory-stats-grid .stat-card:not(.stat-card-money) {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 10px 6px !important;
    gap: 4px !important;
    border-radius: 10px !important;
    min-width: 0 !important;
  }

  .inventory-stats-grid .stat-card:not(.stat-card-money) .stat-icon {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
  }

  .inventory-stats-grid .stat-card:not(.stat-card-money) .stat-icon svg {
    width: 16px !important;
    height: 16px !important;
  }

  .inventory-stats-grid .stat-card:not(.stat-card-money) .stat-val {
    font-size: 16px !important;
    font-weight: 800 !important;
  }

  .inventory-stats-grid .stat-card:not(.stat-card-money) .stat-label {
    font-size: 11px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    color: var(--text-muted) !important;
  }

  /* -------------------------------------------------------------
     REPAIRS STATS: 1 Hero revenue card + status cards
     ------------------------------------------------------------- */
  .repairs-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
  }

  .repairs-stats-grid .stat-card-money {
    grid-column: 1 / -1 !important;
    order: -1 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 14px 16px !important;
    gap: 14px !important;
    background: linear-gradient(135deg, #FFFFFF 0%, #EFF6FF 100%) !important;
    border: 1px solid #BFDBFE !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08) !important;
    border-radius: 12px !important;
    min-width: 0 !important;
  }

  .repairs-stats-grid .stat-card-money .stat-val {
    font-size: clamp(18px, 5.5vw, 24px) !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
    color: var(--primary) !important;
  }

  /* -------------------------------------------------------------
     PROJECT MATERIALS STATS: Hero full-width total + 2 split + 1 banner
     ------------------------------------------------------------- */
  .materials-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
  }

  /* Full-width Hero card for Total Project Materials Cost */
  .materials-stats-grid .stat-card-hero {
    grid-column: 1 / -1 !important;
    order: -2 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 13px 15px !important;
    gap: 12px !important;
    background: linear-gradient(135deg, #FFFFFF 0%, #EFF6FF 100%) !important;
    border: 1px solid #BFDBFE !important;
    border-left: 4px solid var(--primary) !important;
    box-shadow: 0 2px 8px rgba(13, 90, 169, 0.08) !important;
    border-radius: 12px !important;
    min-width: 0 !important;
  }

  .materials-stats-grid .stat-card-hero .stat-icon {
    width: 42px !important;
    height: 42px !important;
    border-radius: 10px !important;
    background-color: #DCFCE7 !important;
    color: #16A34A !important;
    flex-shrink: 0 !important;
  }

  .materials-stats-grid .stat-card-hero .stat-icon svg {
    width: 22px !important;
    height: 22px !important;
  }

  .materials-stats-grid .stat-card-hero .stat-content {
    min-width: 0 !important;
    flex: 1 !important;
  }

  .materials-stats-grid .stat-card-hero .stat-val {
    font-size: clamp(20px, 5.8vw, 24px) !important;
    font-weight: 800 !important;
    color: var(--primary) !important;
    line-height: 1.15 !important;
    letter-spacing: -0.3px !important;
    white-space: nowrap !important;
  }

  .materials-stats-grid .stat-card-hero .stat-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--primary) !important;
    margin-top: 2px !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    letter-spacing: 0.3px !important;
    text-transform: uppercase !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  /* Two Sub-Cards: Tiền linh kiện & Phí ship */
  .materials-stats-grid .stat-card-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 10px 11px !important;
    gap: 8px !important;
    border-radius: 10px !important;
    min-width: 0 !important;
    background: #FFFFFF !important;
    border: 1px solid var(--border) !important;
  }

  .materials-stats-grid .stat-card-item .stat-icon {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .materials-stats-grid .stat-card-item .stat-icon svg {
    width: 17px !important;
    height: 17px !important;
  }

  .materials-stats-grid .stat-card-item .stat-content {
    min-width: 0 !important;
    flex: 1 !important;
  }

  .materials-stats-grid .stat-card-item .stat-val {
    font-size: clamp(14px, 4vw, 16px) !important;
    font-weight: 700 !important;
    color: var(--dark) !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
  }

  .materials-stats-grid .stat-card-item .stat-label {
    font-size: 10.5px !important;
    color: var(--text-muted) !important;
    margin-top: 2px !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  /* Full-width Quantity & Units Banner */
  .materials-stats-grid .stat-card-qty {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 9px 12px !important;
    gap: 10px !important;
    background: #FAF5FF !important;
    border: 1px solid #E9D5FF !important;
    border-radius: 10px !important;
    min-width: 0 !important;
  }

  .materials-stats-grid .stat-card-qty .stat-icon {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    background-color: #F3E8FF !important;
    color: #9333EA !important;
    flex-shrink: 0 !important;
  }

  .materials-stats-grid .stat-card-qty .stat-icon svg {
    width: 16px !important;
    height: 16px !important;
  }

  .materials-stats-grid .stat-card-qty .stat-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: baseline !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    min-width: 0 !important;
    flex: 1 !important;
  }

  .materials-stats-grid .stat-card-qty .stat-val {
    font-size: 14.5px !important;
    font-weight: 800 !important;
    color: #7E22CE !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
  }

  .materials-stats-grid .stat-card-qty .stat-label {
    font-size: 12px !important;
    color: #6B21A8 !important;
    font-weight: 500 !important;
    margin-top: 0 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  .materials-stats-grid .stat-qty-divider {
    display: inline-block !important;
    font-size: 14px !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    color: #A855F7 !important;
  }

  /* -------------------------------------------------------------
     ACCESS LOGS / WORKSTATION STATUS: Balanced 2x2 grid & meta panel
     ------------------------------------------------------------- */
  .access-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }

  .access-stats-grid .stat-card {
    padding: 10px 12px !important;
    gap: 8px !important;
    min-width: 0 !important;
    overflow: hidden !important;
    border-radius: 10px !important;
  }

  .access-stats-grid .stat-icon {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .access-stats-grid .stat-icon svg {
    width: 16px !important;
    height: 16px !important;
  }

  .access-stats-grid .stat-content {
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
  }

  .access-stats-grid .stat-val {
    font-size: 12px !important;
    font-weight: 700 !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.25 !important;
  }

  .access-stats-grid .stat-val.mono {
    font-family: inherit !important;
    font-variant-numeric: tabular-nums;
    font-size: 11.5px !important;
  }

  .access-stats-grid .stat-label {
    font-size: 10px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-top: 1px !important;
    line-height: 1.2 !important;
  }

  /* Session Meta Panel on Mobile */
  .session-meta-panel {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin-top: 12px !important;
    padding-top: 12px !important;
  }

  .session-meta-item {
    padding: 8px 12px !important;
    gap: 10px !important;
    border-radius: 8px !important;
  }

  .session-meta-icon {
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
  }
  .session-meta-icon svg {
    width: 14px !important;
    height: 14px !important;
  }

  .session-meta-title {
    font-size: 10.5px !important;
  }

  .session-meta-desc {
    font-size: 12.5px !important;
  }

  /* Dashboard Main Grid Stack */
  .dashboard-main-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .card {
    margin-bottom: 16px;
    border-radius: 10px;
  }

  .card-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .card-title {
    font-size: 14px;
  }

  .card-body {
    padding: 14px;
  }

  /* Filter Toolbars on Mobile */
  .filter-toolbar {
    width: 100%;
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .filter-toolbar-inputs {
    width: 100%;
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .filter-toolbar-inputs input,
  .filter-toolbar-inputs select,
  .filter-toolbar-inputs .form-control,
  .filter-toolbar input,
  .filter-toolbar select,
  .filter-toolbar .form-control {
    width: 100% !important;
  }

  .filter-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 8px;
  }
  .filter-toolbar-actions .btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 120px;
    justify-content: center;
  }
  .filter-toolbar-actions .btn.btn-primary:last-child {
    flex: 1 1 100%;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .responsive-2col-grid > * {
    grid-column: span 1 !important;
  }

  /* Tables Touch Responsiveness */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table th, .table td {
    padding: 9px 12px;
    font-size: 12.5px;
  }

  /* Dual View Visibility on Mobile */
  .desktop-only-table {
    display: none !important;
  }
  .mobile-only-list {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    padding: 12px 0 4px 0;
  }

  /* Tabs Horizontal Touch Swipe */
  .tabs-header {
    margin-bottom: 16px;
    gap: 4px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    padding: 9px 14px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Modal Form Collapse to 1 Column */
  .modal-backdrop {
    padding: 8px !important;
  }

  .modal-dialog {
    max-height: 94vh;
    border-radius: 12px;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-footer .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  /* Automatically collapse any multi-column grid in modal forms */
  .modal-body [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .login-card {
    border-radius: 14px;
    max-width: 100%;
  }

  .login-brand {
    padding: 24px 20px 16px;
  }

  .login-brand h1 {
    font-size: 15px;
    letter-spacing: 1px;
  }

  .login-form {
    padding: 18px 18px 24px;
  }

  .login-form .form-control,
  .modal-body .form-control {
    font-size: 16px !important; /* Prevents iOS auto-zoom on input tap */
    padding: 10px 12px;
  }

  /* Dual View for Repairs on Mobile */
  .desktop-repairs-table {
    display: none !important;
  }
  .repair-cards-container {
    display: flex !important;
  }
}

/* Circuit Designator Badge */
.circuit-badge {
  display: inline-block;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 12px;
  color: #4338CA;
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
}

/* Mobile Repair Cards */
.repair-cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.repair-card-item {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.repair-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.repair-ticket-code {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  background: rgba(13, 90, 169, 0.08);
  padding: 3px 8px;
  border-radius: 6px;
}

.repair-card-device {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  text-decoration: none;
  line-height: 1.35;
}

.repair-card-defect {
  font-size: 12px;
  color: #991B1B;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  padding: 6px 10px;
  border-radius: 6px;
  line-height: 1.4;
}

.repair-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
  border-top: 1px dashed #F1F5F9;
  border-bottom: 1px dashed #F1F5F9;
}

.repair-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.repair-card-actions {
  display: flex;
  gap: 6px;
}

@media (min-width: 641px) {
  .repair-cards-container {
    display: none !important;
  }
  .inv-cards-container {
    display: none !important;
  }
}

/* ==================== MOBILE INVENTORY CARDS ==================== */
.inv-cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.inv-card-item {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.inv-card-item:active {
  background: #F8FAFC;
}

.inv-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inv-sku-tag {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--primary);
  background: rgba(13, 90, 169, 0.08);
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  display: inline-block;
}

.inv-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  text-decoration: none;
  line-height: 1.35;
  display: block;
}

.inv-card-name:hover {
  color: var(--primary);
}

.inv-card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.inv-spec-badge {
  background: #F1F5F9;
  color: #334155;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  font-weight: 600;
}

.inv-card-devices {
  font-size: 12px;
  color: #3730A3;
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  padding: 5px 10px;
  border-radius: 6px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
}

.inv-card-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 8px;
  background: #F8FAFC;
  border: 1px solid #EDF2F7;
  border-radius: 8px;
  padding: 9px 12px;
}

.inv-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

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

.filter-chip-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 6px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
  user-select: none;
  transition: all 0.15s ease;
}

.filter-chip-checkbox input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  accent-color: #DC2626;
  margin: 0;
  cursor: pointer;
}

@media (max-width: 640px) {
  #invLocationSearch {
    display: none !important;
  }
}

/* ==================== HOSTING CLOCK & PULSE ==================== */
@keyframes pulseDot {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

#headerLiveClockBadge:hover {
  background: #E2E8F0;
  border-color: #CBD5E1;
}

/* ==================== THEME ENFORCEMENT ==================== */
:root, html, body {
  color-scheme: light !important;
}

select, option, optgroup {
  color-scheme: light !important;
  background-color: #FFFFFF !important;
  color: var(--text-main) !important;
}

/* ==================== MOBILE SELECT BOTTOM SHEET ==================== */
.mobile-select-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  display: none;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-select-backdrop.active {
  display: flex !important;
  opacity: 1;
}

.mobile-select-sheet {
  background: #FFFFFF;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.15);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.mobile-select-backdrop.active .mobile-select-sheet {
  transform: translateY(0);
}

.mobile-select-handle-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 10px;
  padding-bottom: 4px;
}

.mobile-select-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #CBD5E1;
}

.mobile-select-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 12px;
  border-bottom: 1px solid #F1F5F9;
}

.mobile-select-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-select-close {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.mobile-select-close:active {
  background: #F1F5F9;
}

.mobile-select-search-wrap {
  padding: 10px 16px 8px;
  border-bottom: 1px solid #F1F5F9;
}

.mobile-select-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #F8FAFC;
  outline: none;
}

.mobile-select-search-input:focus {
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(13, 90, 169, 0.12);
}

.mobile-select-options-list {
  overflow-y: auto;
  padding: 8px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  -webkit-overflow-scrolling: touch;
}

.mobile-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  background: #FFFFFF;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-select-option:active {
  background: #F1F5F9;
}

.mobile-select-option.selected {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  border-color: var(--primary-subtle);
}

.mobile-select-option-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.mobile-select-option.selected .mobile-select-option-check {
  border-color: var(--primary);
  background: var(--primary);
  color: #FFFFFF;
}

.mobile-select-option-check svg {
  width: 12px;
  height: 12px;
  stroke: #FFFFFF;
  stroke-width: 3;
  display: none;
}

.mobile-select-option.selected .mobile-select-option-check svg {
  display: block;
}

.mobile-select-optgroup-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 12px 14px 4px;
}

/* ==========================================================================
   RECYCLE BIN (THÙNG RÁC) STYLES
   ========================================================================== */
.btn-outline-success {
  background-color: #FFFFFF;
  border: 1px solid #BBF7D0;
  color: #16A34A;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.btn-outline-success:hover {
  background-color: #F0FDF4;
  border-color: #16A34A;
  color: #15803D;
}

.trash-notice-box {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid #FDE68A;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.trash-notice-icon {
  font-size: 20px;
  color: #D97706;
  flex-shrink: 0;
  margin-top: 2px;
}
.trash-notice-content h4 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 700;
  color: #92400E;
}
.trash-notice-content p {
  margin: 0;
  font-size: 13px;
  color: #B45309;
  line-height: 1.5;
}

.trash-tabs-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.trash-tabs-group {
  display: inline-flex;
  background: #F1F5F9;
  padding: 4px;
  border-radius: 8px;
  gap: 4px;
  overflow-x: auto;
  max-width: 100%;
}
.trash-tab-btn {
  appearance: none;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.trash-tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
}
.trash-tab-btn.active {
  background: #FFFFFF;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.trash-tab-badge {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}
.trash-tab-btn.active .trash-tab-badge {
  background: var(--primary);
  color: #FFFFFF;
}

.trash-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.trash-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 380px;
}

.trash-card-mobile {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.trash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.trash-card-code {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--primary);
  font-size: 13px;
}
.trash-card-title {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  margin-bottom: 4px;
}
.trash-card-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.trash-card-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  background: #F8FAFC;
  border-radius: 6px;
  margin-bottom: 12px;
}
.trash-card-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.trash-card-meta-item i {
  font-size: 11px;
  color: var(--text-muted);
  width: 14px;
  text-align: center;
}
.trash-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 768px) {
  .trash-tabs-group {
    width: 100%;
  }
  .trash-tab-btn {
    flex: 1;
    justify-content: center;
    padding: 7px 8px;
    font-size: 12px;
  }
  .trash-search-box {
    max-width: 100%;
    width: 100%;
  }
  .trash-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .trash-toolbar .btn-danger {
    width: 100%;
    justify-content: center;
  }
  #view-production .table-responsive {
    display: none;
  }
  #view-production .mobile-only-cards {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }
  #tabPane-materials .desktop-only-table {
    display: none;
  }
  #tabPane-materials .mobile-only-cards {
    display: block !important;
  }
}

.mobile-only-cards {
  display: none;
}

/* ==================== CUSTOMER MODULE STYLING ==================== */
.table-customers {
  min-width: 960px;
}

.customer-cards-container {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.customer-card-item {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.customer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.customer-code-badge {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  background: rgba(13, 90, 169, 0.08);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  display: inline-block;
}

.customer-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.35;
}

.customer-card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: #F8FAFC;
  padding: 8px 10px;
  border-radius: 6px;
}

.customer-card-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-word;
}

.customer-card-meta-row i {
  color: var(--text-muted);
  width: 16px;
  text-align: center;
  font-size: 12px;
  flex-shrink: 0;
}

.customer-card-counts {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.customer-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px dashed #F1F5F9;
  padding-top: 8px;
}

@media (max-width: 640px) {
  #view-customers .table-responsive {
    display: none;
  }
  .customer-cards-container {
    display: flex !important;
  }
}

/* ==================== USER MANAGEMENT MODULE STYLING ==================== */
.users-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

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

.users-header-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.user-policy-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #166534;
  padding: 12px 14px;
  border-radius: 10px;
}

.user-policy-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: #DCFCE7;
  color: #15803D;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.users-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.users-search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 220px;
}

.users-search-box svg {
  position: absolute;
  left: 12px;
  color: #94A3B8;
  pointer-events: none;
}

.users-search-box input {
  width: 100%;
  padding: 8px 32px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #FFFFFF;
  color: var(--dark);
  transition: all 0.2s;
}

.users-search-box input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 90, 169, 0.12);
}

.users-search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #94A3B8;
  cursor: pointer;
  padding: 2px 6px;
}

.users-role-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.user-role-filter-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text-muted);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.user-role-filter-btn:hover {
  border-color: #CBD5E1;
  color: var(--dark);
}

.user-role-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(13, 90, 169, 0.2);
}

/* User Cards for Mobile */
.user-cards-container {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.user-card-item {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s, box-shadow 0.15s;
}

.user-card-item.user-card-current {
  border-color: #93C5FD;
  background: linear-gradient(180deg, #F0F7FF 0%, #FFFFFF 60%);
  box-shadow: 0 2px 6px rgba(13, 90, 169, 0.08);
}

.user-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.user-card-userinfo {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.user-card-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

.user-card-names {
  min-width: 0;
  flex: 1;
}

.user-card-fullname {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.user-self-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  color: #16A34A;
  background: #DCFCE7;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.user-card-username {
  font-size: 12.5px;
  color: var(--primary);
  margin-top: 3px;
  display: flex;
  align-items: center;
}

.user-card-username code {
  background: rgba(13, 90, 169, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 700;
  color: var(--primary);
}

.user-card-role {
  flex-shrink: 0;
}

.user-card-meta {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
}

.user-card-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.user-card-meta-item svg {
  color: #94A3B8;
  flex-shrink: 0;
}

.user-card-meta-label {
  font-weight: 600;
  color: var(--dark);
  min-width: 65px;
}

.user-card-meta-val {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card-meta-val.email-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.user-card-meta-val.email-link:hover {
  text-decoration: underline;
}

.user-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed #E2E8F0;
}

.user-card-actions .btn {
  flex: 1;
  justify-content: center;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  gap: 5px;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 640px) {
  #view-users .users-table-wrapper {
    display: none !important;
  }
  #view-users .user-cards-container {
    display: flex !important;
  }
  .users-card-header {
    flex-direction: column;
    align-items: stretch !important;
  }
  .users-card-header .btn-add-user {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
  }
  .users-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .users-search-box {
    width: 100%;
  }
  .users-role-filters {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .user-policy-alert {
    padding: 10px 12px;
    font-size: 12px;
  }
}

@media (max-width: 440px) {
  #headerLiveClockBadge {
    display: none !important;
  }
  .page-title {
    font-size: 15px !important;
    font-weight: 700;
  }
}

/* Category Management Modal Responsive */
.category-form-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  gap: 10px;
  align-items: end;
}

@media (max-width: 640px) {
  .category-form-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .category-form-grid > div:last-child {
    margin-top: 4px;
    width: 100%;
  }
  .category-form-grid > div:last-child button {
    flex: 1;
    justify-content: center;
  }
}

/* Item Detail Modal Footer Layout (Desktop & Mobile) */
.item-detail-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background-color: #F8FAFC;
  border-top: 1px solid var(--border);
  gap: 12px;
}

.item-detail-modal-footer .btn-delete-item {
  background-color: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
.item-detail-modal-footer .btn-delete-item:hover {
  background-color: #FEE2E2;
  border-color: #F87171;
  color: #B91C1C;
}

.item-detail-modal-footer .item-detail-actions-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.item-detail-modal-footer .btn-text-short {
  display: none;
}
.item-detail-modal-footer .btn-text-full {
  display: inline;
}

@media (max-width: 640px) {
  .item-detail-modal-footer {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 12px !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .item-detail-modal-footer .btn {
    min-width: 0 !important;
    padding: 9px 4px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    justify-content: center !important;
    white-space: nowrap !important;
    border-radius: 6px !important;
  }

  .item-detail-modal-footer .btn-delete-item {
    flex: 1 1 26% !important;
  }

  .item-detail-modal-footer .btn-delete-item .btn-text-full {
    display: none !important;
  }
  .item-detail-modal-footer .btn-delete-item .btn-text-short {
    display: inline !important;
  }

  .item-detail-modal-footer .item-detail-actions-right {
    flex: 1 1 74% !important;
    display: flex !important;
    gap: 8px !important;
    min-width: 0 !important;
  }

  .item-detail-modal-footer .item-detail-actions-right .btn-close-detail {
    flex: 1 1 38% !important;
  }

  .item-detail-modal-footer .item-detail-actions-right .btn-edit-detail {
    flex: 1.4 1 62% !important;
    padding: 9px 6px !important;
  }
}

@media (max-width: 360px) {
  .item-detail-modal-footer .btn-edit-detail .btn-text-full {
    display: none !important;
  }
  .item-detail-modal-footer .btn-edit-detail .btn-text-short {
    display: inline !important;
  }
}

/* Extra small mobile screens: Sidebar fine-tuning */
@media (max-width: 375px) {
  :root {
    --sidebar-width: min(310px, 90vw);
  }
  .sidebar-nav {
    padding: 12px 8px !important;
  }
  .nav-item {
    padding: 8px 10px !important;
    gap: 9px !important;
    font-size: 13px !important;
  }
  .nav-item svg {
    width: 17px !important;
    height: 17px !important;
  }
}

/* ==========================================================================
   MOBILE & TABLET UI ENHANCEMENTS & STANDARDIZATION
   ========================================================================== */

/* 1. Dropbox Action Buttons Responsive Wrap */
.dropbox-action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 640px) {
  .dropbox-action-buttons {
    gap: 8px !important;
  }
  .dropbox-action-buttons .btn {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
    text-align: center;
    padding: 9px 8px !important;
    font-size: 13px !important;
    white-space: nowrap;
  }
  .dropbox-action-buttons #btnSyncDropboxNow {
    flex: 1 1 100% !important;
  }
}

/* 2. Customer Modal Footer Responsive Layout */
.customer-modal-footer {
  margin-top: 20px;
  padding: 14px 0 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.customer-modal-footer .cust-modal-actions-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.customer-modal-footer .btn-text-short {
  display: none;
}
.customer-modal-footer .btn-text-full {
  display: inline;
}

@media (max-width: 640px) {
  .customer-modal-footer {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .customer-modal-footer .btn {
    min-width: 0 !important;
    padding: 9px 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: nowrap !important;
    border-radius: 6px !important;
  }

  .customer-modal-footer .cust-btn-delete {
    flex: 1 1 28% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }
  .customer-modal-footer .cust-btn-delete .btn-text-full {
    display: none !important;
  }
  .customer-modal-footer .cust-btn-delete .btn-text-short {
    display: inline !important;
    text-align: center !important;
    width: 100% !important;
  }

  .customer-modal-footer .cust-modal-actions-right {
    flex: 1 1 72% !important;
    display: flex !important;
    gap: 8px !important;
    min-width: 0 !important;
  }

  .customer-modal-footer .cust-btn-cancel {
    flex: 1 1 35% !important;
  }

  .customer-modal-footer .cust-btn-save {
    flex: 1.5 1 65% !important;
    padding: 9px 8px !important;
  }
}

/* 3. Product Detail Modal Footer Responsive Layout */
.product-detail-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.product-detail-modal-footer .prod-detail-footer-left {
  display: flex;
  align-items: center;
}

.product-detail-modal-footer .prod-detail-footer-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.product-detail-modal-footer .btn-text-short {
  display: none;
}
.product-detail-modal-footer .btn-text-full {
  display: inline;
}

@media (max-width: 640px) {
  .product-detail-modal-footer {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding: 12px 14px !important;
  }

  .product-detail-modal-footer .prod-detail-footer-left,
  .product-detail-modal-footer .prod-detail-footer-right {
    display: contents !important;
  }

  .product-detail-modal-footer .prod-btn-sell {
    order: 1 !important;
  }
  .product-detail-modal-footer .prod-btn-edit {
    order: 2 !important;
  }
  .product-detail-modal-footer .prod-btn-delete {
    order: 3 !important;
  }
  .product-detail-modal-footer .prod-btn-close {
    order: 4 !important;
  }

  .product-detail-modal-footer .btn {
    width: 100% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 9px 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    border-radius: 6px !important;
  }
}

/* 4. Table Min-Width & Scrolling Fixes on Tablet & Mobile */
.table-access-logs {
  min-width: 950px;
}
.table-access-logs th,
.table-access-logs td {
  white-space: nowrap;
}
.table-access-logs td:nth-child(7) {
  white-space: normal;
  min-width: 200px;
  max-width: 320px;
}

.table-users {
  min-width: 880px;
}
.table-users th,
.table-users td {
  white-space: nowrap;
}

.table-customers {
  min-width: 900px;
}
.table-customers th,
.table-customers td {
  white-space: nowrap;
}

.table-inventory {
  min-width: 960px;
}
.table-inventory th,
.table-inventory td {
  white-space: nowrap;
}
.table-inventory td:nth-child(2) {
  white-space: normal;
  min-width: 230px;
}

/* 5. Production & Customer KPI Grids on Tablet & Mobile */
.prod-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.prod-stats-grid .stat-card {
  min-width: 0;
}

.prod-stats-grid .stat-content {
  min-width: 0;
  flex: 1;
}

.prod-stat-margin {
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
  white-space: nowrap;
  vertical-align: middle;
}

@media (max-width: 1199px) and (min-width: 641px) {
  .prod-stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
  }
}

@media (max-width: 640px) {
  .prod-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .prod-stats-grid .stat-card {
    padding: 10px 8px !important;
    gap: 8px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  .prod-stats-grid .stat-icon {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }
  .prod-stats-grid .stat-icon svg {
    width: 18px !important;
    height: 18px !important;
  }
  .prod-stats-grid .stat-content {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }
  .prod-stats-grid .stat-val,
  .prod-stats-grid .prod-stat-val {
    font-size: 13.5px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    word-break: break-word !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: baseline !important;
    column-gap: 4px !important;
    row-gap: 2px !important;
  }
  .prod-stat-money {
    white-space: nowrap !important;
    font-weight: 800 !important;
    font-size: 13.5px !important;
  }
  .prod-stat-margin {
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 1px 5px !important;
    border-radius: 4px !important;
    line-height: 1.3 !important;
  }
  .prod-stats-grid .stat-label {
    font-size: 10.5px !important;
    line-height: 1.25 !important;
    margin-top: 2px !important;
  }
}

.cust-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 991px) and (min-width: 541px) {
  .cust-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
}

@media (max-width: 540px) {
  .cust-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
}

/* 6. Mobile User Card Header Layout (< 480px) */
@media (max-width: 480px) {
  .user-card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .user-card-userinfo {
    width: 100% !important;
  }
  .user-card-role {
    align-self: flex-start !important;
    margin-left: 54px !important;
  }
}

/* 7. Item Detail Modal: Transaction History (Desktop Table vs Mobile Cards) */
.item-tx-desktop-table {
  display: block;
}

.item-tx-mobile-list {
  display: none;
}

@media (max-width: 640px) {
  .item-tx-desktop-table {
    display: none !important;
  }

  .item-tx-mobile-list {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .item-tx-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: background 0.15s ease;
  }

  .item-tx-card:active {
    background: #F8FAFC;
  }

  .item-tx-card-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .item-tx-badge-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .item-tx-type-badge {
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 3px 7px !important;
    border-radius: 6px !important;
    letter-spacing: 0.2px;
  }

  .item-tx-qty {
    font-size: 14px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
  }

  .item-tx-qty.qty-in {
    color: #16A34A;
  }

  .item-tx-qty.qty-out {
    color: #DC2626;
  }

  .item-tx-project {
    flex-shrink: 0;
  }

  .item-tx-prj-badge {
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 2px 7px !important;
    border-radius: 5px !important;
  }

  .item-tx-free-tag {
    font-size: 11px;
    color: var(--text-muted, #64748B);
    background: #F1F5F9;
    padding: 2px 6px;
    border-radius: 5px;
    font-weight: 600;
  }

  .item-tx-card-sub {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted, #64748B);
    border-top: 1px dashed #F1F5F9;
    padding-top: 5px;
    margin-top: 1px;
  }

  .item-tx-ref, .item-tx-time {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
  }

  .item-tx-ref strong {
    color: var(--dark, #0F172A);
  }
}





