/* ==========================================================================
   TMĐT PRICING MASTER - CLEAN MINIMALIST DESIGN SYSTEM
   Inspired by bez.vn, Linear, and modern SaaS calculators.
   Flat, simple, no emojis, clean borders & high readability.
   ========================================================================== */

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

:root {
  /* Dark Theme (Default) */
  --bg-app: #0b0f19;
  --bg-card: #111827;
  --bg-subtle: #1a2234;
  --bg-input: #151c2c;
  --bg-hover: #1f293d;

  --border-color: #242f44;
  --border-focus: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;

  /* Platform Accent Colors */
  --shopee-color: #f97316;
  --shopee-bg: rgba(249, 115, 22, 0.08);
  --shopee-border: rgba(249, 115, 22, 0.25);

  --tiktok-color: #f43f5e;
  --tiktok-bg: rgba(244, 63, 94, 0.08);
  --tiktok-border: rgba(244, 63, 94, 0.25);

  --lazada-color: #3b82f6;
  --lazada-bg: rgba(59, 130, 246, 0.08);
  --lazada-border: rgba(59, 130, 246, 0.25);

  /* Status Colors */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.3);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.3);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-border: rgba(239, 68, 68, 0.3);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Light Theme */
body.light-theme {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --bg-hover: #f8fafc;

  --border-color: #e2e8f0;
  --border-focus: #2563eb;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --accent-primary: #2563eb;
  --accent-hover: #1d4ed8;

  --shopee-color: #ea580c;
  --shopee-bg: #fff7ed;
  --shopee-border: #fed7aa;

  --tiktok-color: #e11d48;
  --tiktok-bg: #fff1f2;
  --tiktok-border: #fecdd3;

  --lazada-color: #2563eb;
  --lazada-bg: #eff6ff;
  --lazada-border: #bfdbfe;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* App Container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.header-brand h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-brand p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  overflow-x: auto;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--accent-primary);
  font-weight: 700;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* Cards & Sections */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

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

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

/* Forms & Inputs */
.form-group {
  margin-bottom: 0.85rem;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--border-focus);
}

.form-control-sm {
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}

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

.input-with-unit .form-control {
  padding-right: 2rem;
}

.input-unit {
  position: absolute;
  right: 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

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

.btn-secondary {
  background: var(--bg-subtle);
  border-color: var(--border-color);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

/* Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-pill.safe {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.status-pill.warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}

.status-pill.danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

/* Platform Cards */
.platform-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
  overflow: visible;
}

.platform-card.shopee { border-top: 2px solid var(--shopee-color); }
.platform-card.tiktok { border-top: 2px solid var(--tiktok-color); }
.platform-card.lazada { border-top: 2px solid var(--lazada-color); }

.platform-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.platform-badge.shopee { background: var(--shopee-bg); color: var(--shopee-color); border: 1px solid var(--shopee-border); }
.platform-badge.tiktok { background: var(--tiktok-bg); color: var(--tiktok-color); border: 1px solid var(--tiktok-border); }
.platform-badge.lazada { background: var(--lazada-bg); color: var(--lazada-color); border: 1px solid var(--lazada-border); }

/* Metric Boxes */
.metric-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Ratio Bar */
.ratio-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--border-color);
  margin: 0.5rem 0 0.85rem 0;
}

.ratio-seg-cost { background: #64748b; }
.ratio-seg-fee { background: var(--warning); }
.ratio-seg-profit { background: var(--success); }

/* Fee Breakdown List */
.fee-list {
  list-style: none;
  font-size: 0.8rem;
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.fee-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

body.light-theme .fee-item {
  background: rgba(0, 0, 0, 0.015);
  border-color: rgba(0, 0, 0, 0.05);
}

.fee-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.fee-item.disabled-fee {
  opacity: 0.4;
  background: transparent;
}

.fee-item.disabled-fee .fee-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.fee-item.disabled-fee .fee-rate-control {
  opacity: 0.5;
  pointer-events: none;
}

.fee-item-info {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.fee-checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  min-width: 0;
}

.fee-checkbox {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent-primary);
  flex-shrink: 0;
}

.fee-name {
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fee-rate-control {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.05rem 0.25rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin-left: 0.25rem;
}

.fee-rate-control:hover,
.fee-rate-control:focus-within {
  border-color: var(--accent-primary);
  background: var(--bg-input);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.fee-inline-input {
  width: 40px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: right;
  padding: 0;
}

.fee-inline-input.fee-inline-fixed {
  width: 48px;
}

.fee-inline-input.fee-inline-cap {
  width: 48px;
}

.fee-inline-input::-webkit-inner-spin-button,
.fee-inline-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.fee-inline-input {
  -moz-appearance: textfield;
}

.fee-inline-unit {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-left: 1px;
}

.fee-cap-wrap {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin-left: 0.25rem;
  border-left: 1px solid var(--border-color);
  padding-left: 0.25rem;
}

.fee-amt {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
  margin-left: 0.5rem;
}

/* Search Dropdown */
.searchable-select {
  position: relative;
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  max-height: 280px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
  box-shadow: var(--shadow-md);
  margin-top: 4px;
}

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

.search-item, .search-prod-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.1s ease;
}

.search-item:hover, .search-prod-item:hover, .search-prod-item.active {
  background: var(--bg-subtle);
}

.search-prod-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.search-prod-meta {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.tag-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Quick Industry Presets & Combo Buttons */
.preset-cat-btn, .quick-combo-btn {
  font-size: 0.75rem !important;
  padding: 0.3rem 0.6rem !important;
  border-radius: var(--radius-sm) !important;
  background: var(--bg-subtle) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-secondary) !important;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-cat-btn:hover, .quick-combo-btn:hover {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-focus) !important;
}

/* Combo Chips */
.combo-quick-chip {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: border-color 0.15s ease;
}

.combo-quick-chip:hover {
  border-color: var(--border-focus);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.data-table th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

/* Toggle Switch */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  display: none;
}

.toggle-track {
  width: 32px;
  height: 18px;
  background: var(--border-color);
  border-radius: 9px;
  position: relative;
  transition: background 0.15s ease;
}

.toggle-thumb {
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.15s ease;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(14px);
}

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

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  box-shadow: var(--shadow-md);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--accent-primary); }

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open,
.modal-overlay.active {
  display: flex !important;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   EXPIRY & BATCH MANAGEMENT DESIGN SYSTEM
   ========================================================================== */

/* Nav Badge Count */
.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 0.68rem;
  font-weight: 800;
  background: var(--danger);
  color: #ffffff;
  margin-left: 0.4rem;
  animation: none;
}


  50% { transform: scale(1.08); box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
}

/* KPI Statistics Grid (6 Cards) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* FIX: dam bao 6 the KPI luon dan hang ngang tren desktop (do uu tien cao,
   chong bi ghi de boi rule khac). */
#tab-batches .kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
#tab-batches .kpi-card {
  min-width: 0;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.75rem;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

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

.kpi-card.active {
  border-color: var(--accent-primary);
  background: var(--bg-subtle);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.kpi-card.kpi-expired { border-left: 3px solid #ef4444; }
.kpi-card.kpi-urgent { border-left: 3px solid #f43f5e; }
.kpi-card.kpi-month1 { border-left: 3px solid #f97316; }
.kpi-card.kpi-month2 { border-left: 3px solid #f59e0b; }
.kpi-card.kpi-month3 { border-left: 3px solid #eab308; }
.kpi-card.kpi-safe { border-left: 3px solid #10b981; }

.kpi-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.kpi-num {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.1;
  font-family: 'JetBrains Mono', monospace;
}

.kpi-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status Pills for Batches & Expiry */
.status-pill.expired {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
  font-weight: 700;
}
.status-pill.no-hsd {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.35);
  color: #94a3b8;
  font-weight: 600;
}

.status-pill.urgent {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: #f43f5e;
  font-weight: 700;
  animation: none;
}


  50% { opacity: 0.65; }
}

.status-pill.month1 {
  background: rgba(249, 115, 22, 0.15);
  border-color: rgba(249, 115, 22, 0.4);
  color: #f97316;
  font-weight: 700;
}

.status-pill.month2 {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  font-weight: 600;
}

.status-pill.month3 {
  background: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.4);
  color: #eab308;
  font-weight: 600;
}

.status-pill.safe-pill {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
  font-weight: 600;
}

.status-pill.sold-out {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.3);
  color: #94a3b8;
  font-weight: 600;
}

.status-pill.active-stock {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: #3b82f6;
  font-weight: 700;
}

/* FIFO Weighted Average Cost Box (Tab 1 Workspace) */
.fifo-cost-box {
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.fifo-cost-box:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.4);
}

.fifo-cost-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.fifo-cost-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.fifo-cost-val {
  font-size: 1.1rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-primary);
}

.fifo-cost-sub {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

/* Deduction Preview List in FIFO Modal */
.deduction-preview-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-top: 0.75rem;
  max-height: 220px;
  overflow-y: auto;
}

.deduction-log-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px dashed var(--border-color);
  font-size: 0.75rem;
}

.deduction-log-row:last-child {
  border-bottom: none;
}

/* Expiry Filter Pills */
.filter-chip {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filter-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.filter-chip.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  font-weight: 700;
}

/* Expiry Alert Box on Workspace Tab */
.workspace-expiry-banner {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  animation: slideInDown 0.3s ease;
}

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

.workspace-expiry-banner.warning-level {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Compact Dimension Badge */
.dim-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* ==========================================================================
   BANNER CẢNH BÁO HẠN SỬ DỤNG (EXPIRY ALERT BANNER)
   ========================================================================== */
.expiry-alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.85rem;
}

.expiry-alert-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.expiry-alert-body {
  flex: 1;
  min-width: 0;
}

.expiry-alert-title {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.expiry-alert-desc {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.expiry-alert-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.expiry-alert-close {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  color: inherit;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.expiry-alert-close:hover {
  opacity: 1;
  background: rgba(0,0,0,0.1);
}

/* Banner Variants */
.expiry-alert-banner.expired {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.expiry-alert-banner.urgent {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.expiry-alert-banner.month1 {
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.3);
  color: #fb923c;
}

.expiry-alert-banner.month2,
.expiry-alert-banner.month3 {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

/* Role Badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.role-badge.admin {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.role-badge.staff {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Staff Read-only Lock */
.staff-disabled {
  opacity: 0.5 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
}

.staff-hidden {
  display: none !important;
}

/* Platform Switcher Tabs (Shopee | TikTok Shop | Lazada | So Sánh 3 Sàn) */
.mobile-platform-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  background: var(--bg-card);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  max-width: 100%;
}

.mobile-platform-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.5rem 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-platform-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.mobile-platform-btn.active {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.mobile-platform-btn[data-platform="shopee"].active {
  color: #fff !important;
  background: #ee4d2d !important;
  border-color: #ee4d2d !important;
  box-shadow: 0 2px 8px rgba(238, 77, 45, 0.4) !important;
}

.mobile-platform-btn[data-platform="tiktok"].active {
  color: #00f2fe !important;
  background: #0f172a !important;
  border-color: #00f2fe !important;
  box-shadow: 0 2px 8px rgba(0, 242, 254, 0.25) !important;
}

.mobile-platform-btn[data-platform="lazada"].active {
  color: #fff !important;
  background: #1e3a8a !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.4) !important;
}

.mobile-platform-btn[data-platform="all"].active {
  color: #fff !important;
  background: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3) !important;
}

.grid-single-platform {
  display: grid;
  grid-template-columns: 1fr !important;
  width: 100% !important;
  margin-bottom: 1rem;
}

/* Responsive Header Columns & Toolbar Actions */
.responsive-col {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-action-grid {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ==========================================================================
   TOÀN DIỆN TỐI ƯU HOÁ GIAO DIỆN MOBILE & THIẾT BỊ CẢM ỨNG (RESPONSIVE MASTER)
   ========================================================================== */

/* Chống tuyệt đối tràn màn hình ngang (No Horizontal Scroll) */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
}

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

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: minmax(0, 1fr) !important; }
  .grid-2 { grid-template-columns: minmax(0, 1fr) !important; }
  .grid-2 > *, .grid-3 > *, .grid-4 > * { min-width: 0 !important; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 768px) {
  /* App Container & Safe Areas */
  .app-container {
    padding: 0.5rem !important;
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px)) !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* Compact Cards & Platform Cards */
  .card, .platform-card {
    padding: 0.85rem 0.75rem !important;
    border-radius: var(--radius-sm) !important;
    margin-bottom: 0.75rem !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Card Headers */
  .card-header {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.45rem !important;
    margin-bottom: 0.75rem !important;
    align-items: flex-start !important;
  }

  .card-header > * {
    min-width: 0 !important;
  }

  .card-title {
    font-size: 0.8rem !important;
    line-height: 1.35 !important;
  }

  /* Header Brand & Actions */
  .app-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
    padding: 0.65rem 0.75rem !important;
    margin-bottom: 0.65rem !important;
  }

  .header-brand {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0.4rem !important;
  }

  .header-brand h1 {
    font-size: 1.15rem !important;
    letter-spacing: -0.01em !important;
  }

  .header-brand p {
    font-size: 0.68rem !important;
    line-height: 1.25 !important;
    max-width: 210px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .header-user-chip {
    padding: 0.2rem 0.45rem !important;
    gap: 0.35rem !important;
    flex-shrink: 0 !important;
  }

  .header-user-avatar {
    width: 22px !important;
    height: 22px !important;
    font-size: 0.7rem !important;
  }

  .header-user-name {
    font-size: 0.72rem !important;
  }

  .header-user-role {
    font-size: 0.62rem !important;
  }

  .header-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.35rem !important;
    width: 100% !important;
  }

  .header-actions .btn {
    font-size: 0.72rem !important;
    padding: 0.3rem 0.45rem !important;
    flex: 1 1 auto !important;
    min-height: 34px !important;
  }

  #cloud-sync-status-badge {
    font-size: 0.7rem !important;
    padding: 0.2rem 0.45rem !important;
  }

  /* Navigation Tabs */
  .nav-tabs {
    gap: 0.25rem !important;
    padding-bottom: 0.4rem !important;
    margin-bottom: 0.65rem !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    scroll-snap-type: x mandatory !important;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none !important;
  }

  .tab-btn {
    padding: 0.4rem 0.65rem !important;
    font-size: 0.75rem !important;
    flex-shrink: 0 !important;
    scroll-snap-align: start !important;
    min-height: 36px !important;
  }

  /* Mobile Platform Tabs (Shopee / TikTok / Lazada Switcher) */
  .mobile-platform-tabs {
    display: flex !important;
    gap: 0.25rem !important;
    margin-bottom: 0.65rem !important;
    background: var(--bg-card) !important;
    padding: 0.25rem !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border-color) !important;
  }

  .mobile-platform-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 0.45rem 0.15rem !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    text-align: center !important;
    border-radius: var(--radius-sm) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .mobile-platform-btn.active {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--border-color);
  }

  .mobile-platform-btn[data-platform="shopee"].active {
    color: #fff !important;
    background: #ee4d2d !important;
    border-color: #ee4d2d !important;
    box-shadow: 0 2px 8px rgba(238, 77, 45, 0.4) !important;
  }

  .mobile-platform-btn[data-platform="tiktok"].active {
    color: #00f2fe !important;
    background: #0f172a !important;
    border-color: #00f2fe !important;
    box-shadow: 0 2px 8px rgba(0, 242, 254, 0.25) !important;
  }

  .mobile-platform-btn[data-platform="lazada"].active {
    color: #fff !important;
    background: #1e3a8a !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.4) !important;
  }

  .mobile-platform-btn[data-platform="all"].active {
    color: #fff !important;
    background: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3) !important;
  }

  /* Responsive Column Headers (Chống ép dọc chữ trên điện thoại) */
  .responsive-col {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.45rem !important;
  }

  .responsive-col .card-title,
  .dim-card-header .card-title {
    width: 100% !important;
    flex: 1 1 100% !important;
    font-size: 0.85rem !important;
    line-height: 1.35 !important;
    word-break: normal !important;
    white-space: normal !important;
  }

  .dim-header-actions {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: 0.25rem !important;
  }

  /* Grid 2x2 cho nút bấm toolbar (chống xếp dọc 4 nút choán hết màn hình) */
  .header-action-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.35rem !important;
    width: 100% !important;
  }

  .header-action-grid .btn {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 0.72rem !important;
    padding: 0.45rem 0.25rem !important;
    min-height: 36px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Chống tràn ngang cho ngành hàng */
  .industry-presets {
    overflow-x: auto !important;
    max-width: 100% !important;
    flex-wrap: nowrap !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 0.25rem !important;
  }

  .industry-presets::-webkit-scrollbar {
    display: none !important;
  }

  .preset-cat-btn {
    flex-shrink: 0 !important;
    font-size: 0.72rem !important;
    padding: 0.3rem 0.6rem !important;
  }

  /* Platform Card Header */
  .platform-card-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
    margin-bottom: 0.55rem !important;
  }

  .platform-rate-control {
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
  }

  /* Metric Boxes (KPIs in Workspace) */
  .metric-box {
    padding: 0.65rem 0.75rem !important;
    margin-bottom: 0.55rem !important;
  }

  .metric-label {
    font-size: 0.68rem !important;
  }

  .metric-value {
    font-size: 1.15rem !important;
  }

  .metric-sub {
    font-size: 0.7rem !important;
  }

  /* Fee Item Layout on Mobile (Bóc Tách Phí Chuẩn Đẹp) */
  .fee-list {
    gap: 0.2rem !important;
    margin-top: 0.5rem !important;
  }

  .fee-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0.35rem 0.45rem !important;
    gap: 0.3rem !important;
    min-width: 0 !important;
  }

  .fee-item-info {
    display: flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .fee-checkbox-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .fee-name {
    font-size: 0.73rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 130px !important;
  }

  .fee-rate-control {
    flex-shrink: 0 !important;
    margin-left: 0.15rem !important;
    padding: 0.05rem 0.2rem !important;
  }

  .fee-inline-input {
    width: 36px !important;
    font-size: 0.72rem !important;
  }

  .fee-inline-input.fee-inline-fixed {
    width: 44px !important;
  }

  .fee-amt {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    margin-left: 0.35rem !important;
    text-align: right !important;
    min-width: 65px !important;
  }

  /* FIFO Card Overhaul (Screenshot 2 Fix) */
  .fifo-cost-box {
    padding: 0.65rem 0.75rem !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.45rem !important;
  }

  .fifo-cost-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 0.3rem !important;
  }

  .fifo-body-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.45rem !important;
    width: 100% !important;
  }

  .fifo-cost-val {
    font-size: 1.15rem !important;
  }

  .fifo-cost-sub {
    font-size: 0.68rem !important;
    line-height: 1.3 !important;
  }

  .fifo-btn-group {
    display: flex !important;
    gap: 0.35rem !important;
    width: 100% !important;
  }

  .fifo-btn-group .btn {
    flex: 1 1 50% !important;
    min-width: 120px !important;
    padding: 0.4rem 0.45rem !important;
    font-size: 0.72rem !important;
    text-align: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
  }

  /* Dimension Card & Packing Volume (Screenshot 3 Fix) */
  .dim-card-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.45rem !important;
  }

  .dim-header-actions {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    gap: 0.4rem !important;
  }

  .dim-header-actions select {
    max-width: 180px !important;
  }

  .grid-4 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.45rem !important;
  }

  .dim-result-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.3rem !important;
    text-align: center !important;
  }

  .dim-result-grid > div {
    min-width: 0 !important;
  }

  /* Combo Quick Chips Grid */
  #combo-quick-chips {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.35rem !important;
  }

  .combo-quick-chip {
    padding: 0.35rem 0.45rem !important;
    font-size: 0.72rem !important;
  }

  /* Industry Presets Carousel */
  .industry-presets {
    display: flex !important;
    gap: 0.3rem !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 0.3rem !important;
    width: 100% !important;
    scrollbar-width: none !important;
  }

  .industry-presets::-webkit-scrollbar {
    display: none !important;
  }

  .preset-cat-btn {
    flex-shrink: 0 !important;
    font-size: 0.72rem !important;
    padding: 0.25rem 0.55rem !important;
    white-space: nowrap !important;
  }

  /* Lưới nhập liệu giá vốn & số lượng gọn gàng trên mobile */
  .mobile-cost-qty-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }

  .mobile-cost-qty-grid .col-total-cost {
    grid-column: span 2 !important;
  }

  /* Lưới 3 ô giá bán Shopee, TikTok, Lazada trên mobile */
  .mobile-prices-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 0.35rem !important;
  }

  /* Expiry Alert xếp gọn trên mobile */
  .expiry-alert-banner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
    padding: 0.65rem !important;
  }

  .expiry-alert-actions {
    width: 100% !important;
    display: flex !important;
    gap: 0.4rem !important;
  }

  .expiry-alert-actions .btn {
    flex: 1 !important;
    text-align: center !important;
    justify-content: center !important;
  }

  /* Modals on Mobile */
  .modal-overlay {
    padding: 0.4rem !important;
    align-items: flex-end !important;
  }

  .modal-content {
    max-width: 100% !important;
    width: 100% !important;
    max-height: 94vh !important;
    padding: 0.85rem 0.75rem !important;
    border-radius: 14px 14px 0 0 !important;
  }

  /* Data Tables Scrolling */
  .table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
  }

  .data-table {
    min-width: 580px !important;
    font-size: 0.75rem !important;
  }

  .data-table th, .data-table td {
    padding: 0.45rem 0.55rem !important;
  }

  /* RBAC Perm Table on Mobile */
  .perm-matrix-container {
    max-height: 52vh !important;
  }

  .perm-table {
    min-width: 320px !important;
    font-size: 0.72rem !important;
  }

  .perm-table th, .perm-table td {
    padding: 0.35rem 0.4rem !important;
  }

  .perm-table .cell-action {
    width: 48px !important;
  }

  /* Combo Section Header */
  #section-combo-matrix .card-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }
}

/* Extra Tweaks for Small Mobile Screens <= 480px */
@media (max-width: 480px) {
  .mobile-prices-grid {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }

  .mobile-prices-grid .form-group {
    background: var(--bg-subtle) !important;
    padding: 0.5rem 0.65rem !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border-color) !important;
  }

  .mobile-prices-grid .form-group:nth-child(1) { border-left: 3px solid var(--shopee-color) !important; }
  .mobile-prices-grid .form-group:nth-child(2) { border-left: 3px solid var(--tiktok-color) !important; }
  .mobile-prices-grid .form-group:nth-child(3) { border-left: 3px solid var(--lazada-color) !important; }

  /* Login Screen (Screenshot 4) */
  #pin-lock-screen > div {
    padding: 1.35rem 1.15rem !important;
    max-width: 100% !important;
    border-radius: 12px !important;
  }

  #btn-lark-sso-login {
    height: 48px !important;
    font-size: 0.92rem !important;
  }

  .fee-name {
    max-width: 110px !important;
  }
}

/* ==========================================================================
   STYLING CHO PHÂN HỆ HOÁ ĐƠN PDF, ĐỐI SOÁT DOANH THU & CLOUD SYNC
   ========================================================================== */

/* Dropzone Kéo Thả File PDF / Excel */
.dropzone-box {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  background: var(--bg-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropzone-box:hover,
.dropzone-box.dragover {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.08);
  transform: translateY(-2px);
}

/* Selected Row in Data Tables */
tr.row-selected {
  background: rgba(59, 130, 246, 0.09) !important;
}

/* Cloud Sync Pulse Dot Animation */
.sync-dot {
  animation: none;
}


  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 8px rgba(16, 185, 129, 0.6); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Badge count indicator on tabs */
.badge-count {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-primary);
  margin-left: 0.35rem;
}

/* ==========================================================================
   STYLING CHO HỆ THỐNG QUẢN LÝ TÀI KHOẢN & MA TRẬN PHÂN QUYỀN (RBAC)
   ========================================================================== */

/* Trạng thái quyền hạn trên DOM */
[data-perm-denied="hidden"] {
  display: none !important;
}

/* Relaxed permission display */
[data-perm-denied="disabled"] {
  opacity: 0.85;
}

/* User Status Pill */
.user-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.user-status-pill.active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.user-status-pill.locked {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Header User Profile Chip */
.header-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.65rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.header-user-chip:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

.header-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.header-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}

.header-user-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.header-user-role {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Ma Trận Phân Quyền (Permissions Matrix) Trong Modal */
.perm-matrix-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.perm-matrix-group {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
}

.perm-matrix-group-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.perm-matrix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.75rem;
}

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

.perm-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-sm);
  transition: background 0.1s ease;
}

.perm-checkbox-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.perm-checkbox-item input[type="checkbox"] {
  margin-top: 0.2rem;
  cursor: pointer;
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.perm-checkbox-item-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.perm-checkbox-item-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.25;
  margin-top: 0.1rem;
}



/* ==========================================================================
   STYLING BẢNG MA TRẬN PHÂN QUYỀN 2 PHẦN (HỆ THỐNG VS VẬN HÀNH)
   ========================================================================== */
.perm-section-block {
  border-radius: var(--radius-sm);
}

.perm-section-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.perm-section-header.system {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border-left: 3px solid #ef4444;
}

.perm-section-header.operations {
  background: rgba(14, 165, 233, 0.12);
  color: #38bdf8;
  border-left: 3px solid #0ea5e9;
}

.perm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.perm-table th {
  background: rgba(0, 0, 0, 0.25);
  padding: 0.45rem 0.6rem;
  font-size: 0.71rem;
  color: var(--text-secondary);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  white-space: nowrap;
}

.perm-table th.col-feature {
  text-align: left;
}

.perm-col-toggle {
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  transition: background 0.15s ease;
  user-select: none;
}

.perm-col-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-primary);
}

.perm-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

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

.perm-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.perm-table .cell-action {
  text-align: center;
  width: 65px;
}

.perm-table .cell-action input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.perm-table .cell-extra {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.perm-feature-title {
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
}

.perm-feature-desc {
  font-size: 0.67rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.25;
}


/* ==========================================================================
   HỆ THỐNG GIAO DIỆN TỐI ƯU TOÀN DIỆN CHO WEB MOBILE & APP MOBILE (CLEAN & MINIMAL)
   Thuận mắt, thân thiện, dễ dùng, không hoa lá cành, không icon rườm rà
   ========================================================================== */

/* Chống chọn nhầm text khi chạm vuốt trên ứng dụng mobile */
button, .tab-btn, .filter-chip, .mobile-platform-btn, .preset-cat-btn, .combo-quick-chip {
  -webkit-tap-highlight-color: transparent !important;
  touch-action: manipulation;
  user-select: none;
}

/* Thanh công cụ nút bấm ở tất cả các Tab (Catalog, Batches, Invoices, Revenue) */
.tab-actions-toolbar {
  display: flex !important;
  gap: 0.35rem !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding-bottom: 0.3rem !important;
  scrollbar-width: none !important;
  width: 100% !important;
}

.tab-actions-toolbar::-webkit-scrollbar {
  display: none !important;
}

.tab-actions-toolbar .btn {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  font-size: 0.74rem !important;
  padding: 0.35rem 0.6rem !important;
  min-height: 36px !important;
}

/* Thẻ thống kê KPI đơn giản, gọn gàng, thuận mắt */
.kpi-card {
  background: var(--bg-subtle) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.65rem 0.75rem !important;
  box-shadow: none !important;
}

.kpi-title, .kpi-label {
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  color: var(--text-secondary) !important;
  margin-bottom: 0.2rem !important;
}

.kpi-num, .kpi-value {
  font-size: 1.25rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  font-family: 'JetBrains Mono', monospace !important;
  color: var(--text-primary) !important;
}

.kpi-sub {
  font-size: 0.66rem !important;
  color: var(--text-muted) !important;
  margin-top: 0.15rem !important;
}

/* Dropzone PDF & Excel tối ưu cho điện thoại */
.dropzone-box {
  padding: 1rem 0.75rem !important;
  border-radius: var(--radius-sm) !important;
  background: var(--bg-subtle) !important;
  border: 1px dashed var(--border-color) !important;
  text-align: center !important;
  cursor: pointer !important;
  transition: border-color 0.15s ease !important;
}

.dropzone-box:hover {
  border-color: var(--accent-primary) !important;
}

/* Bộ lọc Chips (Tất cả, Đơn hàng, Trạng thái...) */
.filter-chip {
  padding: 0.3rem 0.6rem !important;
  font-size: 0.74rem !important;
  font-weight: 600 !important;
  border-radius: var(--radius-sm) !important;
  background: var(--bg-subtle) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-secondary) !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
  min-height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
}

.filter-chip.active {
  background: #1e293b !important;
  border-color: var(--accent-primary) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* Tối ưu Tab Công Thức (Recipes) trên Mobile */
#recipes-list-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  gap: 0.75rem !important;
}

/* Tối ưu Modals thành Bottom Sheet trên Mobile */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 0 !important;
    align-items: flex-end !important;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(4px) !important;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
    padding: 1rem 0.85rem !important;
    box-sizing: border-box !important;
  }

  .modal-content .card-header {
    position: sticky !important;
    top: 0 !important;
    background: var(--bg-card) !important;
    z-index: 20 !important;
    padding-bottom: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    border-bottom: 1px solid var(--border-color) !important;
  }

  #recipes-list-grid {
    grid-template-columns: 1fr !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.45rem !important;
  }

  #tab-invoices .grid-4,
  #tab-revenue .grid-4 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.45rem !important;
  }

  #tab-invoices .grid-4 .card,
  #tab-revenue .grid-4 .card {
    padding: 0.65rem 0.75rem !important;
    margin-bottom: 0 !important;
  }
}


/* ==========================================================================
   SIDEBAR LAYOUT & COLLAPSIBLE NAVIGATION (MENU DỌC BÊN TRÁI)
   ========================================================================== */
.app-container {
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

.app-wrapper {
  display: flex;
  min-height: calc(100vh - 65px);
  width: 100%;
}

/* Sidebar Menu */
.app-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 50;
  user-select: none;
}

/* FIX: sidebar dinh khi cuon noi dung (desktop). Mobile (off-canvas,
   position:fixed trong mobile.css) khong anh huong. */
@media (min-width: 769px) {
  .app-sidebar {
    position: sticky;
    top: 0.75rem;
    align-self: flex-start;
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
  }
}

.app-sidebar.collapsed {
  width: 64px;
  min-width: 64px;
}

.sidebar-header {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-brand {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-sidebar.collapsed .sidebar-brand-text {
  display: none;
}

.sidebar-toggle-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.sidebar-nav {
  flex: 1;
  padding: 0.65rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-align: left;
  width: 100%;
  position: relative;
}

.sidebar-nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--accent-primary);
  font-weight: 700;
}

.sidebar-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-nav-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.app-sidebar.collapsed .sidebar-nav-text {
  display: none;
}

.app-sidebar.collapsed .badge-count {
  position: absolute;
  top: 4px;
  right: 6px;
  padding: 0.1rem 0.3rem;
  font-size: 0.6rem;
}

.sidebar-nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.45rem 0.35rem;
}

.sidebar-footer {
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.app-sidebar.collapsed .sidebar-footer {
  display: none;
}

/* Main Content Wrapper */
.app-main {
  flex: 1;
  min-width: 0;
  padding: 1rem 1.25rem;
  background: var(--bg-app);
  overflow-x: hidden;
}

/* Test Suite Console in Tab Pane */
.test-console-card {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  color: #c9d1d9;
}

.test-terminal-output {
  background: #010409;
  border: 1px solid #21262d;
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  max-height: 450px;
  overflow-y: auto;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==============================================================================
   BIZONE ERP — Module "Góp ý cải tiến" (FAB + dialog + trang quản trị)
   ============================================================================== */

/* --- Nút nổi FAB --- */
#feedback-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(14, 165, 233, 0.45);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#feedback-fab:hover { transform: scale(1.08); box-shadow: 0 8px 28px rgba(14, 165, 233, 0.6); }

/* --- Overlay + Dialog --- */
#feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(3px);
  z-index: 9001;
}
#feedback-dialog {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: min(420px, calc(100vw - 48px));
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  z-index: 9002;
  color: #e2e8f0;
}
.fb-dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #334155;
  font-weight: 700;
  font-size: 1rem;
}
.fb-dlg-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
}
.fb-dlg-close:hover { color: #f8fafc; }
.fb-dlg-body { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.fb-dlg-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  border-top: 1px solid #334155;
}
.fb-lbl { font-size: 0.78rem; font-weight: 600; color: #94a3b8; margin-top: 0.3rem; }
.fb-input {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 8px;
  color: #f1f5f9;
  padding: 0.55rem 0.7rem;
  font-size: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}
.fb-input:focus { outline: none; border-color: #0ea5e9; }
textarea.fb-input { resize: vertical; min-height: 90px; font-family: inherit; }
.fb-dropzone {
  border: 1px dashed #475569;
  border-radius: 8px;
  padding: 0.8rem;
  text-align: center;
  font-size: 0.8rem;
  color: #94a3b8;
}
.fb-dropzone.drag { border-color: #0ea5e9; background: rgba(14, 165, 233, 0.08); }
.fb-link { background: none; border: none; color: #38bdf8; cursor: pointer; font-size: 0.8rem; text-decoration: underline; }
.fb-thumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.fb-thumb { position: relative; width: 72px; height: 72px; }
.fb-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid #475569; }
.fb-thumb-rm {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #ef4444; color: #fff; border: none; cursor: pointer; font-size: 0.7rem; line-height: 1;
}
.fb-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
}
.fb-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #065f46;
  color: #ecfdf5;
  padding: 0.7rem 1.2rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.fb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- Trang quản trị --- */
.fb-page { display: flex; flex-direction: column; gap: 1rem; }
.fb-page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem; }
.fb-page-head h2 { margin: 0; font-size: 1.2rem; }
.fb-head-actions { display: flex; gap: 0.5rem; }
.fb-counts { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.fb-count {
  background: var(--card-bg, #0f172a);
  border: 1px solid var(--border-color, #334155);
  border-radius: 10px;
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  color: inherit;
}
.fb-count:hover { border-color: #0ea5e9; }
.fb-count .n { font-size: 1.4rem; font-weight: 800; }
.fb-count .t { font-size: 0.75rem; color: var(--text-muted, #94a3b8); }
.fb-filters { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.fb-filter { width: auto; }
.fb-check { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; cursor: pointer; }
.fb-list { display: flex; flex-direction: column; gap: 0.8rem; }
.fb-card {
  background: var(--card-bg, #0f172a);
  border: 1px solid var(--border-color, #334155);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.fb-card-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.fb-seq { font-weight: 800; color: #38bdf8; }
.fb-cat { font-size: 0.78rem; background: rgba(14, 165, 233, 0.12); padding: 0.15rem 0.55rem; border-radius: 20px; }
.fb-status { font-size: 0.78rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 20px; }
.fb-status.st-new { background: rgba(234, 179, 8, 0.15); color: #facc15; }
.fb-status.st-doing { background: rgba(14, 165, 233, 0.15); color: #38bdf8; }
.fb-status.st-done { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.fb-status.st-rejected { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.fb-meta { font-size: 0.75rem; color: var(--text-muted, #94a3b8); margin-left: auto; }
.fb-content { font-size: 0.9rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.fb-page-url { font-size: 0.75rem; color: var(--text-muted, #94a3b8); }
.fb-shots { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.fb-shot { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-color, #334155); }
.fb-note {
  background: rgba(14, 165, 233, 0.08);
  border-left: 3px solid #0ea5e9;
  padding: 0.5rem 0.8rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.82rem;
}
.fb-tech { font-size: 0.78rem; }
.fb-tech summary { cursor: pointer; color: #94a3b8; }
.fb-tech pre {
  background: #020617;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.6rem;
  overflow-x: auto;
  font-size: 0.72rem;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.fb-stars { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.fb-stars-avg { font-size: 0.82rem; color: #fbbf24; font-weight: 600; }
.fb-stars-btns { display: flex; gap: 0.15rem; }
.fb-star {
  background: none; border: none; cursor: pointer;
  font-size: 1.25rem; color: #475569; padding: 0 0.1rem;
}
.fb-star:hover { color: #fbbf24; transform: scale(1.15); }
.fb-star.active { color: #fbbf24; }
.fb-star:disabled { cursor: not-allowed; opacity: 0.5; }
.fb-admin { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.fb-status-sel { width: auto; }
.fb-admin-note { flex: 1; min-width: 200px; }
.fb-empty { text-align: center; color: var(--text-muted, #94a3b8); padding: 2rem; font-size: 0.9rem; }
.fb-error-text { color: #fca5a5; }
.fb-pager { display: flex; justify-content: center; }
.fb-leaderboard { margin-bottom: 0.5rem; }
.fb-leaderboard h3 { margin: 0 0 0.6rem 0; font-size: 1rem; }
.fb-board-table { width: 100%; }
.fb-title { font-weight: 700; font-size: 0.95rem; margin: 0.15rem 0 0.35rem 0; }
.fb-req { color: #f87171; }
.fb-board-note { font-size: 0.78rem; color: var(--text-muted, #94a3b8); margin: 0 0 0.6rem 0; }

/* --- Font an toàn tiếng Việt cho module Góp ý (Tăng yêu cầu 2026-10-06):
   ép font stack có đầy đủ dấu tiếng Việt, không phụ thuộc webfont Inter --- */
#feedback-fab,
#feedback-overlay,
#feedback-dialog,
#feedback-dialog .fb-input,
#feedback-dialog textarea,
#feedback-dialog select,
#feedback-dialog button,
.fb-toast,
#tab-feedback,
#tab-feedback .fb-input,
#tab-feedback select,
#tab-feedback textarea,
#tab-feedback button,
#tab-feedback input {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ==========================================================================
 * BỐ CỤC 2 CỘT CHO MÀN HÌNH TÍNH GIÁ (Tăng yêu cầu 2026-10-06, cap nhat lan 2):
 *   Desktop (>=769px):  [BƯỚC 1 | BƯỚC 2]
 *                       [BƯỚC 3 |   "   ]  (B2 keo dai 3 hang)
 *                       [BƯỚC 4 |   "   ]
 *   Khối "So sánh 3 sàn" đứng ngoài container nên tự full-width bên dưới.
 *   Mobile (<=768px): xem mobile.css — trở về 1 cột dọc 1-2-3-4.
 * align-items: start để các card cao thấp khác nhau không bị kéo giãn lạ.
 * KHÔNG đổi logic tính toán, id, hay binding JS nào.
 * ========================================================================== */
.pricing-steps-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}
.pricing-step-1 { grid-column: 1; grid-row: 1; }
.pricing-step-2 { grid-column: 2; grid-row: 1 / 4; }
.pricing-step-3 { grid-column: 1; grid-row: 2; }
.pricing-step-4 { grid-column: 1; grid-row: 3; }
