/* ===== TrueMark Component Library CSS ===== */
/* Quy chuẩn các thành phần UI thuần dựa trên biến tokens.css */

/* ----- 1. Tiện ích bố cục (Layout Utilities) ----- */
.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.grow { flex: 1; min-width: 0; }
.screen-pad { padding: 0 var(--space-4); }

.stack-1 { display: flex; flex-direction: column; gap: var(--space-1); }
.stack-2 { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-3 { display: flex; flex-direction: column; gap: var(--space-3); }
.stack-4 { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-6 { display: flex; flex-direction: column; gap: var(--space-6); }

.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-mono { font-family: var(--font-mono); }

.section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin: var(--space-4) 0 var(--space-2);
}

.divider {
  height: 1px;
  background-color: var(--color-border);
  border: none;
  margin: var(--space-3) 0;
}

/* ----- 2. Nút bấm (Buttons) ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: 0 var(--space-5);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text);
  text-decoration: none;
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: scale(0.97);
}
.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: var(--color-secondary-soft);
  color: var(--color-secondary-hover);
  border-color: rgba(22, 163, 74, 0.2);
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-secondary);
  color: var(--color-on-secondary);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text);
}
.btn-ghost:hover:not(:disabled) {
  background-color: var(--color-surface-2);
}

.btn-danger {
  background-color: var(--color-danger);
  color: var(--color-on-danger);
}
.btn-danger:hover:not(:disabled) {
  background-color: #B91C1C;
}

.btn-outlined {
  background-color: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-outlined:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-sm {
  min-height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
}
.btn-lg {
  min-height: 52px;
  padding: 0 var(--space-6);
  font-size: var(--text-md);
}
.btn-block {
  width: 100%;
}
.btn-icon {
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border-radius: var(--radius-full);
}

/* ----- 3. Huy hiệu & Chip (Badges & Chips) ----- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-success {
  background-color: var(--color-success-soft);
  color: var(--color-success);
}
.badge-warning {
  background-color: var(--color-warning-soft);
  color: var(--color-warning);
}
.badge-danger {
  background-color: var(--color-danger-soft);
  color: var(--color-danger);
}
.badge-tech {
  background-color: var(--color-tertiary-soft);
  color: var(--color-tertiary);
}
.badge-neutral {
  background-color: var(--color-surface-2);
  color: var(--color-text-muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.chip.active {
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}

/* ----- 4. Biểu mẫu & Nhập liệu (Forms & Inputs) ----- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}
.field-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.field-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.field-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
}

.input, .textarea, .select {
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea {
  min-height: 88px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.input.has-error, .textarea.has-error {
  border-color: var(--color-danger);
  background-color: var(--color-danger-soft);
}

/* Checkbox & Switch */
.checkbox-wrap {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text);
  user-select: none;
}
.checkbox-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  margin-top: 2px;
  cursor: pointer;
}

/* Segmented Control */
.segmented {
  display: flex;
  background-color: var(--color-surface-2);
  padding: 3px;
  border-radius: var(--radius-full);
  gap: 2px;
}
.segmented-item {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  text-align: center;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  border: none;
  background: transparent;
}
.segmented-item.active {
  background-color: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

/* ----- 5. Hiển thị (Cards, Lists, Avatars) ----- */
.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

/* Banner xác thực chính hãng GS1 */
.banner-authentic {
  background: var(--gradient-banner-authentic);
  border: 1px solid var(--color-banner-border);
  box-shadow: var(--shadow-banner);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.banner-authentic-ring {
  background-color: var(--color-banner-ring);
  box-shadow: 0 0 0 6px rgba(236, 253, 245, 0.9);
  padding: 10px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
}
.banner-authentic-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  background: var(--gradient-icon-authentic);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}
.banner-authentic-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--color-banner-border);
  color: var(--color-primary);
  font-size: var(--text-badge);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-sm);
}
.banner-authentic-title {
  color: var(--color-success-dark);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 var(--space-1);
}
.banner-authentic-sub {
  color: var(--color-success-sub);
  font-size: var(--text-code);
  font-weight: 500;
  margin: 0;
  max-width: 280px;
}

/* Banner cảnh báo quét lặp / Cần lưu ý */
.banner-warning {
  background: linear-gradient(180deg, #FFFBEB 0%, #FFFFFF 65%, #FEF3C7 100%);
  border: 1px solid rgba(251, 191, 36, 0.6);
  box-shadow: 0 10px 25px -5px rgba(217, 119, 6, 0.12), 0 8px 10px -6px rgba(217, 119, 6, 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.banner-warning-ring {
  background-color: rgba(254, 243, 199, 0.9);
  box-shadow: 0 0 0 6px rgba(254, 243, 199, 0.5);
  padding: 10px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
}
.banner-warning-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}
.banner-warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(251, 191, 36, 0.6);
  color: #B45309;
  font-size: var(--text-badge);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-sm);
}
.banner-warning-title {
  color: #92400E;
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 var(--space-1);
}
.banner-warning-sub {
  color: #B45309;
  font-size: var(--text-code);
  font-weight: 500;
  margin: 0;
  max-width: 290px;
}

/* Banner cảnh báo nguy hiểm / Nghi giả / Thu hồi */
.banner-danger {
  background: linear-gradient(180deg, #FEF2F2 0%, #FFFFFF 65%, #FEE2E2 100%);
  border: 1px solid rgba(248, 113, 113, 0.6);
  box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.12), 0 8px 10px -6px rgba(220, 38, 38, 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.banner-danger-ring {
  background-color: rgba(254, 226, 226, 0.9);
  box-shadow: 0 0 0 6px rgba(254, 226, 226, 0.5);
  padding: 10px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
}
.banner-danger-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}
.banner-danger-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(248, 113, 113, 0.6);
  color: #991B1B;
  font-size: var(--text-badge);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-sm);
}
.banner-danger-title {
  color: #991B1B;
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 var(--space-1);
}
.banner-danger-sub {
  color: #B91C1C;
  font-size: var(--text-code);
  font-weight: 500;
  margin: 0;
  max-width: 290px;
}

/* Khối chi tiết kỹ thuật có thể mở rộng (Collapsible Details) */
.details-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.details-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.details-summary::-webkit-details-marker { display: none; }
.details-summary .details-arrow {
  transition: transform var(--dur) var(--ease);
}
.details-card[open] .details-summary .details-arrow {
  transform: rotate(180deg);
}
.details-body {
  padding: 0 var(--space-4) var(--space-4);
}
.tech-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}
.tech-cell {
  background-color: var(--color-surface-2);
  border-radius: var(--radius-md);
  padding: 10px;
}
.tech-cell-label {
  font-size: var(--text-badge);
  color: var(--color-text-muted);
  margin-bottom: 2px;
}
.tech-cell-value {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text);
}

.list {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  min-height: var(--tap-min);
  border-bottom: 1px solid var(--color-border-subtle);
  background: transparent;
  color: var(--color-text);
  text-decoration: none;
}
.list-item:last-child {
  border-bottom: none;
}
.list-item-clickable {
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.list-item-clickable:hover {
  background-color: var(--color-surface-2);
}
.list-item-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.list-item-trailing {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary-soft);
  color: var(--color-primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--text-sm);
  flex-shrink: 0;
  overflow: hidden;
}

/* Stepper tăng giảm số lượng (+ / -) */
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background-color: var(--color-surface);
  padding: 2px;
}
.stepper-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--color-text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.stepper-btn:hover:not(:disabled) {
  background-color: var(--color-surface-2);
}
.stepper-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.stepper-value {
  min-width: 36px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-text);
}

/* Hiển thị giá & Ưu đãi */
.price-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}
.price-current {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--color-primary);
}
.price-original {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: line-through;
}
.discount-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background-color: var(--color-danger-soft);
  color: var(--color-danger);
  font-size: 10px;
  font-weight: 700;
}

/* Thẻ ưu đãi ra mắt (0đ / -50% theo Thông tư 39/2025/TT-BCT) */
.deal-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.deal-progress-bar {
  height: 6px;
  background-color: var(--color-surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-2);
}
.deal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #16A34A 0%, #0F5132 100%);
  border-radius: var(--radius-full);
  transition: width var(--dur) var(--ease);
}

/* Thẻ đổi quà Got It / UrBox / Thẻ nạp */
.voucher-card {
  display: flex;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.voucher-leading {
  width: 80px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  text-align: center;
}
.voucher-content {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.voucher-code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  display: inline-block;
  margin-top: var(--space-1);
}

/* Thẻ đơn hàng COD */
.order-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: var(--space-3);
}
.order-id {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-xs);
  color: var(--color-text);
}

/* Khối cuộn ngang (Horizontal Scroll Container) */
.scroll-x {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  padding: var(--space-1) var(--space-4) var(--space-3);
  margin: 0 calc(-1 * var(--space-4));
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.scroll-x::-webkit-scrollbar {
  display: none;
}
.scroll-snap-item {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* Banner Quét tem nhanh (Quick Scan Banner) */
.quick-scan-banner {
  background: var(--gradient-header);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-header);
  position: relative;
  overflow: hidden;
}
.quick-scan-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #ffffff;
}

/* Thẻ tóm tắt thành viên & ví điểm (Member Summary Card) */
.member-summary-card {
  background: linear-gradient(135deg, rgba(15, 81, 50, 0.08) 0%, rgba(2, 132, 199, 0.08) 100%);
  border: 1px solid rgba(15, 81, 50, 0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

/* Thẻ sản phẩm bảo chứng TrueMark (Product Card) */
.product-card {
  display: flex;
  gap: var(--space-3);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.product-card:active {
  transform: scale(0.99);
}
.product-thumb {
  width: 84px;
  height: 84px;
  border-radius: var(--radius-md);
  background-color: var(--color-surface-2);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--color-border-subtle);
}
.product-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
}

/* Màn hình tràn viền (Immersive Screens: Splash, Onboarding, Scan) */
.screen[data-screen="splash"],
.screen[data-screen="onboarding"],
.screen[data-screen="scan"] {
  padding-top: 0;
  background: transparent;
}
.screen[data-screen="splash"] .screen-body,
.screen[data-screen="onboarding"] .screen-body,
.screen[data-screen="scan"] .screen-body {
  padding-top: var(--statusbar-h, 54px);
  padding-bottom: calc(var(--space-6) + 16px);
}

/* Khung ngắm Camera & Quét mã (Camera Viewfinder & Scanner) */
.scan-viewport {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  background: #0a0d10 radial-gradient(circle at 50% 40%, #16241b 0%, #0a0d10 80%);
  color: #ffffff;
  padding: var(--statusbar-h, 54px) var(--space-4) var(--space-6);
  box-sizing: border-box;
  overflow: hidden;
}
.scan-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  z-index: 10;
}
.scan-header-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}
.scan-flash-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.scan-flash-btn.active {
  background: #EAB308;
  color: #000000;
  box-shadow: 0 0 16px rgba(234, 179, 8, 0.6);
}
.scan-box-wrap {
  position: relative;
  width: 250px;
  height: 250px;
  display: grid;
  place-items: center;
  margin: auto 0;
}
.scan-box-frame {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.scan-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: #10B981;
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}
.scan-corner-tl { top: -2px; left: -2px; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 12px; }
.scan-corner-tr { top: -2px; right: -2px; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 12px; }
.scan-corner-bl { bottom: -2px; left: -2px; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 12px; }
.scan-corner-br { bottom: -2px; right: -2px; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 12px; }
.scan-laser-line {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #10B981 20%, #34D399 50%, #10B981 80%, transparent);
  box-shadow: 0 0 12px 2px #10B981;
  pointer-events: none;
  animation: scanLaserAnim 2.2s ease-in-out infinite alternate;
}
@keyframes scanLaserAnim {
  0% { top: 8px; opacity: 0.3; }
  50% { opacity: 1; }
  100% { top: calc(100% - 10px); opacity: 0.3; }
}
.scan-sim-box {
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-md);
  z-index: 10;
}

/* ----- 6. Điều hướng: Appbar & Tabbar (Navigation) ----- */
.appbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(48px + var(--statusbar-h, 54px));
  padding: var(--statusbar-h, 54px) var(--space-2) 0;
  box-sizing: border-box;
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 50;
}
.appbar-gradient {
  background: var(--gradient-header);
  color: #ffffff;
  border-bottom: none;
  box-shadow: var(--shadow-header);
}
.appbar-gradient .appbar-title {
  color: #ffffff;
}
.appbar-gradient .appbar-action {
  color: #ffffff;
}
.appbar-gradient .appbar-action:hover {
  background-color: rgba(255, 255, 255, 0.15);
}
.appbar-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.appbar-action {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-text);
  cursor: pointer;
  background: transparent;
  border: none;
}
.appbar-action:hover {
  background-color: var(--color-surface-2);
}

/* Skin Tabbar hiện đại có Material Icons */
#tabbar.tabbar {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}
#tabbar .tab {
  color: var(--color-text-muted);
  font-weight: 600;
  transition: color var(--dur) var(--ease);
}
#tabbar .tab .tab-icon {
  margin-bottom: 2px;
}
#tabbar .tab.active {
  color: var(--color-primary);
}
#tabbar .tab[data-tab="scan"] .tab-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0F5132 0%, #15803D 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -14px;
  box-shadow: 0 4px 12px rgba(15, 81, 50, 0.35);
  transition: all 0.2s ease;
}
#tabbar .tab[data-tab="scan"] .tab-icon svg {
  color: #ffffff !important;
}
#tabbar .tab[data-tab="scan"]:active .tab-icon {
  transform: scale(0.95);
}
#tabbar .tab[data-tab="scan"].active .tab-icon {
  background: linear-gradient(135deg, #0A3B24 0%, #0F5132 100%);
  box-shadow: 0 6px 16px rgba(15, 81, 50, 0.45);
}

/* ----- 7. Overlays (Modal, Bottom Sheet, Toast) ----- */
.backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 60;
  opacity: 0;
  animation: fadeIn var(--dur) var(--ease) forwards;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85%;
  background-color: var(--color-surface);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5) var(--space-6);
  z-index: 70;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  animation: slideUp var(--dur) var(--ease) forwards;
  overflow-y: auto;
}
.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background-color: var(--color-border);
  margin: 0 auto var(--space-4);
  flex-shrink: 0;
}

.modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: calc(100% - 48px);
  max-width: 340px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  z-index: 70;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  animation: modalIn var(--dur) var(--ease) forwards;
}
.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0 0 var(--space-2);
  color: var(--color-text);
}
.modal-body {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
  line-height: var(--leading-normal);
}
.modal-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

.toast {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background-color: var(--color-surface-inverted);
  color: var(--color-on-inverted);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 99;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  opacity: 0;
  animation: toastIn var(--dur) var(--ease) forwards;
  white-space: nowrap;
}

@keyframes fadeIn { to { opacity: 1; } }
@keyframes slideUp { to { transform: translateY(0); } }
@keyframes modalIn { to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes toastIn { to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ----- 8. Trạng thái (Skeleton, Empty State, Error State) ----- */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-2) 25%, var(--color-border-subtle) 50%, var(--color-surface-2) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state, .error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8) var(--space-4);
  gap: var(--space-3);
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background-color: var(--color-surface-2);
  color: var(--color-text-muted);
  display: grid;
  place-items: center;
}
.error-state .empty-state-icon {
  background-color: var(--color-danger-soft);
  color: var(--color-danger);
}
.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}
.empty-state-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 280px;
  margin: 0;
}
