:root {
  --primary: #0a64e2; /* Màu xanh Cainiao */
  --bg: #f2f4f8;
  --text: #2d3436;
  --white: #fff;
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* KHÓA CHẶT BODY */
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
}

.hidden {
  display: none !important;
}

/* --- SCREEN: LOGIN --- */
#login-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a64e2 0%, #003b8e 100%);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #ffffff;
  width: 100%;
  max-width: 380px;
  border-radius: 24px;
  padding: 35px 25px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  text-align: center;
  animation: bounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.login-content {
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.brand-logo {
  margin-bottom: 20px;
  filter: drop-shadow(0 5px 10px rgba(10, 100, 226, 0.2));
}
.logo-img {
  height: 80px;
  width: 80px;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(10, 100, 226, 0.3);
}
.login-card h2 {
  font-size: 22px;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 5px;
  letter-spacing: 0.5px;
}
.login-card .sub-title,
.sub-title {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 25px;
  font-weight: 500;
}
.input-group {
  position: relative;
  margin-bottom: 16px;
  background: #f8fafc;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}
.input-group:focus-within {
  border-color: #0a64e2;
  box-shadow: 0 0 0 3px rgba(10, 100, 226, 0.1);
  background: #fff;
}
.input-group i {
  position: absolute;
  top: 50%;
  left: 18px;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 16px;
  transition: color 0.3s ease;
}
.input-group:focus-within i {
  color: #0a64e2;
}
.input-group input {
  width: 100%;
  padding: 16px 16px 16px 48px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: #334155;
  font-weight: 500;
}
.input-group input::placeholder {
  color: #94a3b8;
}
.btn-login {
  width: 100%;
  padding: 16px;
  background: #0a64e2;
  color: var(--white);
  border: none;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16px;
  margin-top: 10px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(10, 100, 226, 0.25);
  transition: all 0.2s ease;
}
.btn-login:active {
  transform: scale(0.96);
  box-shadow: 0 4px 10px rgba(10, 100, 226, 0.2);
}
#login-error {
  margin-top: 15px;
  font-size: 13px;
  font-weight: 600;
  color: #ef4444;
  min-height: 18px;
}

/* --- SCREEN: HOME & LAYOUT --- */
#home-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  position: relative;
}

/* HEADER USER INFO */
.fixed-header {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  z-index: 100;
  padding: 15px 15px 8px;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  box-shadow: var(--shadow);
  padding-top: max(15px, env(safe-area-inset-top));
}
.user-card {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}
.avatar-container {
  position: relative;
}
#user-avatar-img {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  padding: 2px;
  background: #fff;
}
.user-info {
  flex: 1;
  min-width: 0;
  position: relative;
}
.user-info h3 {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 18px;
  font-weight: 800;
}
.info-row {
  font-size: 13px;
  color: #666;
  margin: 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.highlight {
  color: #2c3e50;
  font-weight: 600;
}
.time {
  color: #0a64e2;
  font-style: italic;
  font-weight: 500;
}

.header-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-left: 8px;
  flex-shrink: 0;
}
.icon-btn {
  width: 37px;
  height: 37px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  margin: 0;
}
.refresh-btn {
  background: #e8f5e9;
  color: #2e7d32;
}
.spin-anim {
  animation: spin 1s linear infinite;
}
.edit-btn {
  background: #e3f2fd;
  color: #2196f3;
}
.logout-btn {
  background: #ffebee;
  color: #ef5350;
  grid-column: span 2;
  justify-self: center;
  width: 37px;
}

/* TABS */
.tabs-container {
  display: flex;
  background: #f1f2f6;
  padding: 5px;
  border-radius: 14px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #888;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: 0.3s;
}
.tab.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.badge-count {
  position: absolute;
  top: 8px;
  right: 12px;
  background: #ff4757;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
}

/* DANH SÁCH ĐƠN HÀNG */
#list-container {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  padding-bottom: 90px;
  -webkit-overflow-scrolling: touch;
}
#list-container::-webkit-scrollbar {
  width: 0;
}

.group-card {
  background: var(--white);
  border-radius: 18px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  display: flex;
  gap: 12px;
  animation: slideUp 0.4s ease;
  border: 1px solid #f0f0f0;
}
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.group-img {
  width: 75px;
  height: 75px;
  border-radius: 12px;
  object-fit: cover;
  background: #eee;
  flex-shrink: 0;
  cursor: pointer;
}
.group-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* Tối ưu phần Header của thẻ đơn hàng */
.group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* Căn lên trên để nếu text dài không bị lệch badge */
  margin-bottom: 8px;
  gap: 10px; /* Tạo khoảng cách an toàn giữa Mã và Trạng thái */
}

.codes {
  font-weight: 800;
  color: #333;
  font-size: 16px; /* Tăng cỡ chữ */
  flex: 1; /* Cho phép mã đơn chiếm hết phần không gian trống bên phải */
  word-break: break-word; /* Cho phép rớt chữ hợp lý thay vì dồn cục */
  line-height: 1.4;
}

/* Phóng to Trạng thái */
.status {
  font-size: 12px; /* Tăng từ 10px lên 12px */
  font-weight: 800;
  padding: 6px 12px; /* Tăng lề để nút trông to và rõ hơn */
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0; /* Đảm bảo badge không bị ép nhỏ lại */
  white-space: nowrap; /* Cấm xuống dòng trong badge */
}
.st-pending {
  background: #fff8e1;
  color: #f39c12;
}
.st-shipping {
  background: #e3f2fd;
  color: #2980b9;
}
.st-done {
  background: #e8f5e9;
  color: #27ae60;
}

.middle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  gap: 8px;
}
.tracking-list {
  flex: 1;
}
.tracking-item {
  font-family: monospace;
  font-size: 13px;
  color: #555;
  background: #f8f9fa;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
  display: inline-block;
}

.mini-pay-btn {
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(39, 174, 96, 0.3);
  margin: 0;
}
.mini-pay-btn:active {
  transform: scale(0.95);
}

/* Chỉnh lại hàng dưới cùng để chia đều 2 bên Trái - Phải */
.total {
  border-top: 1px dashed #eee;
  padding-top: 10px;
  margin-top: auto;
  display: flex;
  justify-content: space-between; /* Đẩy thông tin ra 2 sát lề */
  align-items: center;
  min-height: 30px;
  font-weight: 800;
}
.money-text {
  font-weight: 800;
  color: #e74c3c;
  font-size: 16px;
  margin-left: auto;
}

/* BADGES NGÀY LƯU KHO */
/* Phóng to Ngày tồn kho */
.badge-warning {
  font-size: 12px; /* Tăng từ 10px lên 12px */
  padding: 6px 10px; /* Tăng độ dày */
  border-radius: 6px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  margin-bottom: 0;
}
.lv-1 {
  background: #fff3cd;
  color: #856404;
  border: 1px dashed #ffeeba;
}
.lv-2 {
  background: #ffe082;
  color: #5d4037;
  border: 1px solid #ffca28;
}
.lv-3 {
  background: #ffccbc;
  color: #bf360c;
  border: 1px dashed #ffab91;
}
.lv-4 {
  background: #ffcdd2;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.fee-badge,
.risk-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  display: inline-block;
  font-weight: 600;
  width: fit-content;
  animation: fadeIn 0.5s;
}
.fee-badge {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}
.risk-badge {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
.fee-badge i,
.risk-badge i {
  margin-right: 4px;
}

/* THANH CẢNH BÁO */
.warning-bar {
  display: flex;
  align-items: center;
  background: #fff3cd;
  color: #856404;
  padding: 8px 12px;
  margin-top: 10px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid #ffeeba;
  overflow: hidden;
}
.warning-bar i {
  margin-right: 10px;
  color: #f39c12;
  flex-shrink: 0;
  animation: shake 1s infinite;
}
.marquee-content {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}
.marquee-content span {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 15s linear infinite;
}
@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-10deg);
  }
  75% {
    transform: rotate(10deg);
  }
}

/* --- BUTTONS BOTTOM ACTIONS --- */
.bottom-actions {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 90;
  padding-bottom: env(safe-area-inset-bottom);
}
.action-btn {
  border-radius: 16px;
  border: none;
  color: white;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s;
}
.action-btn:active {
  transform: scale(0.96);
}
.support-btn {
  flex: 1;
  flex-direction: column;
  background: linear-gradient(135deg, #0a64e2, #0056d6);
  padding: 10px;
  gap: 2px;
  font-size: 11px;
}
.point-btn {
  flex: 1;
  flex-direction: column;
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  padding: 10px;
  gap: 2px;
  font-size: 11px;
}

.noti-btn {
  width: 50px;
  flex-shrink: 0;
  background: white;
  color: #0a64e2;
  border-radius: 16px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s;
}
.noti-btn i {
  font-size: 22px;
  transform-origin: top center;
}
.noti-btn:hover i {
  animation: bell-ring 1s infinite;
}
.noti-btn.has-news i {
  animation: bell-ring 2s infinite;
}
.bell-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bell-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: red;
  color: white;
  font-size: 10px;
  font-weight: bold;
  height: 18px;
  min-width: 18px;
  padding: 0 4px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  z-index: 2;
}
.btn-icon {
  font-size: 18px;
}
@keyframes bell-ring {
  0% {
    transform: rotate(0);
  }
  10% {
    transform: rotate(30deg);
  }
  30% {
    transform: rotate(-30deg);
  }
  50% {
    transform: rotate(15deg);
  }
  70% {
    transform: rotate(-15deg);
  }
  100% {
    transform: rotate(0);
  }
}

/* --- MODALS CHUNG --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-content {
  background: var(--white);
  width: 88%;
  max-width: 340px;
  border-radius: 24px;
  padding: 25px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.bounce-in {
  animation: bounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes bounce {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h3 {
  margin: 0;
  color: var(--primary);
  font-size: 18px;
}
.close-btn {
  font-size: 26px;
  color: #bbb;
  cursor: pointer;
  padding: 5px;
}
.modal-input {
  width: 100%;
  padding: 14px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  margin-bottom: 12px;
  background: #fafafa;
  font-size: 15px;
}
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: bold;
  cursor: pointer;
}

/* MODAL HỖ TRỢ / PHẢN HỒI */
.support-link {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 14px;
  color: #333;
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 12px;
  transition: 0.2s;
}
.support-link:active {
  background: #eee;
}
.support-link i {
  font-size: 20px;
  width: 25px;
  text-align: center;
}
.support-link.call i {
  color: #2196f3;
}
/* Nút bấm Wechat */
.support-link.wechat {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  cursor: pointer;
  width: 100%;
  font-size: 15px;
}
.support-link.wechat i {
  color: #07c160;
  font-size: 22px;
}
.support-link.mess i {
  color: #0084ff;
}
.support-link.feedback {
  background: #fff;
  border: 1px dashed #95a5a6;
  color: #555;
  justify-content: center;
  cursor: pointer;
  width: 100%;
  font-size: 14px;
}
.support-link.feedback:active {
  background: #f1f2f6;
  border-color: #7f8c8d;
}
.support-link.feedback i {
  color: var(--primary);
}
.separator-line {
  height: 1px;
  background: #eee;
  margin: 15px 0;
}
.btn-feedback {
  width: 100%;
  padding: 12px;
  background: #f1f2f6;
  color: #2c3e50;
  border: 1px dashed #bdc3c7;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-feedback:active {
  background: #e0e0e0;
  transform: scale(0.98);
}
.btn-feedback:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff;
}

/* THÔNG BÁO ITEM */
.noti-item {
  background: white;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  border-left: 4px solid #ddd;
  animation: fadeIn 0.3s ease;
  transition: transform 0.2s ease;
}
.noti-item:active {
  transform: scale(0.98);
}
.noti-item.danger {
  border-left-color: #e74c3c;
  background: #fff5f5;
}
.noti-item.warning {
  border-left-color: #f39c12;
  background: #fffcf5;
}
.noti-item.normal {
  border-left-color: #2ecc71;
}
.noti-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.noti-title {
  font-weight: 700;
  font-size: 14px;
  color: #333;
}
.noti-time {
  font-size: 10px;
  color: #999;
}
.noti-desc {
  font-size: 13px;
  color: #555;
  line-height: 1.4;
}

/* MODAL ĐIỂM & QUÀ TẶNG */
.point-box {
  position: absolute;
  right: 20px;
  top: 8px;
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #90caf9;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 10;
}
.point-label {
  font-size: 11px;
  color: #0277bd;
  font-weight: 700;
  text-transform: uppercase;
}
.point-number {
  font-size: 15px;
  font-weight: 800;
  color: #01579b;
}

.point-tabs-header {
  display: flex;
  align-items: center;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
  position: relative;
  padding-right: 40px;
  padding-left: 40px;
}
.icon-help {
  position: absolute;
  left: 15px;
  top: 12px;
  font-size: 22px;
  color: var(--primary);
  cursor: pointer;
  z-index: 5;
}
.exchange-banner {
  background: linear-gradient(135deg, #74b9ff, #0984e3);
  border-radius: 16px;
  padding: 15px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(9, 132, 227, 0.4);
  border: 2px solid white;
  transition: transform 0.1s;
}
.exchange-banner:active {
  transform: scale(0.98);
}
.ex-content h3 {
  margin: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}
.ex-content p {
  margin: 4px 0 0;
  color: #e0f7fa;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.ex-img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.2));
}
.rules-table {
  padding: 10px;
}
.r-section-title {
  font-size: 12px;
  font-weight: 800;
  padding: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 6px;
  margin-top: 10px;
  margin-bottom: 5px;
}
.r-section-title.green {
  background: #e8f5e9;
  color: #27ae60;
}
.r-section-title.red {
  background: #ffebee;
  color: #c0392b;
}
.r-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px dashed #eee;
  font-size: 13px;
}
.r-row:last-child {
  border-bottom: none;
}
.r-row span {
  color: #555;
}
.r-row b {
  color: #2c3e50;
}
.text-red {
  color: #e74c3c !important;
}
.my-point-mini {
  text-align: center;
  margin-bottom: 15px;
  font-size: 14px;
}
.gift-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.gift-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.gift-img {
  font-size: 30px;
  margin-bottom: 5px;
}
.gift-card h4 {
  margin: 5px 0;
  font-size: 13px;
  color: #333;
}
.g-price {
  font-weight: bold;
  color: var(--primary);
  font-size: 12px;
  margin-bottom: 10px;
}
.btn-claim {
  background: #27ae60;
  color: white;
  border: none;
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}
.pt-tab {
  flex: 1;
  text-align: center;
  padding: 15px;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.pt-tab.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  background: #fff;
}
.close-btn-absolute {
  position: absolute;
  right: 15px;
  top: 10px;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  line-height: 1;
}
.modal-body-scroll {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

/* Bảng xếp hạng */
.my-rank-card {
  background: linear-gradient(135deg, #34495e, #2c3e50);
  color: white;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(44, 62, 80, 0.3);
  margin-bottom: 20px;
}
.rank-icon-large {
  font-size: 30px;
  color: #f1c40f;
  margin-bottom: 5px;
}
.rank-info-text h2 {
  margin: 0;
  font-size: 36px;
  font-weight: 800;
}
.rank-name {
  font-size: 14px;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
}
.rank-progress-bar {
  background: rgba(255, 255, 255, 0.2);
  height: 6px;
  border-radius: 3px;
  margin: 10px 0 5px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #2ecc71;
}
.next-rank-text {
  font-size: 10px;
  color: #ccc;
  margin: 0;
}
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed #eee;
}
.his-left {
  display: flex;
  flex-direction: column;
}
.his-reason {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}
.his-date {
  font-size: 10px;
  color: #999;
}
.his-amount {
  font-weight: 800;
  font-size: 14px;
}
.his-amount.plus {
  color: #27ae60;
}
.his-amount.minus {
  color: #e74c3c;
}
.leaderboard-list {
  margin-bottom: 20px;
}
.rank-row {
  display: flex;
  align-items: center;
  background: #fff;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #f0f0f0;
}
.r-num {
  width: 30px;
  font-weight: 800;
  font-size: 16px;
  color: #7f8c8d;
  text-align: center;
}
.r-top-1 {
  color: #f1c40f;
  font-size: 20px;
}
.r-top-2 {
  color: #bdc3c7;
  font-size: 18px;
}
.r-top-3 {
  color: #d35400;
  font-size: 18px;
}
.r-info {
  flex: 1;
  padding-left: 10px;
}
.r-name {
  font-weight: 700;
  font-size: 13px;
  display: block;
}
.r-reward {
  font-size: 10px;
  color: var(--primary);
}
.r-point {
  font-weight: 800;
  color: #2c3e50;
}
.exchange-section {
  border-top: 4px solid #f0f0f0;
  padding-top: 15px;
}
.gift-item {
  display: flex;
  align-items: center;
  background: #f8fbff;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid #d0e1fd;
}
.gift-icon {
  font-size: 24px;
  margin-right: 12px;
}
.gift-info {
  flex: 1;
}
.gift-info b {
  font-size: 13px;
  display: block;
  color: var(--primary);
}
.gift-info span {
  font-size: 10px;
  color: #666;
}
.btn-exchange {
  background: var(--primary);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

/* MODAL THANH TOÁN QR */
.currency-tabs {
  display: flex;
  background: #f0f0f0;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 15px;
}
.cur-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}
.cur-tab.active {
  background: white;
  color: #27ae60;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
.qr-box {
  text-align: center;
  margin-bottom: 15px;
}
.qr-img {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  border: 1px solid #eee;
}
.bank-info p {
  margin: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  padding-bottom: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.money-highlight {
  font-size: 24px;
  font-weight: 800;
  color: #27ae60;
  margin: 10px 0;
}
.note {
  font-size: 12px;
  color: #e74c3c;
  background: #fff0e6;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  margin-top: 15px;
  font-weight: 500;
}

/* --- IMAGE VIEWER SLIDER --- */
.image-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.viewer-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#viewer-img {
  max-width: 100%;
  max-height: 80vh;
  transition: opacity 0.2s ease;
}
.close-viewer-icon {
  position: absolute;
  top: 40px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  z-index: 102;
  cursor: pointer;
}
.viewer-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 80px;
  background: rgba(20, 20, 20, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  z-index: 101;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  padding: 10px;
  cursor: pointer;
}
.nav-btn:active {
  color: var(--primary);
}
.img-counter {
  color: white;
  font-weight: bold;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.1);
  padding: 5px 15px;
  border-radius: 20px;
}
.viewer-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
}
.loading-spinner.white {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #fff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

/* --- SKELETON LOADING --- */
.skeleton-wrapper {
  padding: 15px;
}
.skeleton-card {
  background: white;
  border-radius: 18px;
  padding: 15px;
  margin-bottom: 15px;
  display: flex;
  gap: 12px;
  border: 1px solid #f0f0f0;
}
.skeleton-anim {
  background: #eee;
  background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  to {
    background-position-x: -200%;
  }
}
.sk-img {
  width: 75px;
  height: 75px;
  border-radius: 12px;
  flex-shrink: 0;
}
.sk-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sk-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}
.sk-line-short {
  width: 30%;
  height: 14px;
}
.sk-line-medium {
  width: 60%;
  height: 14px;
}
.sk-line-long {
  width: 100%;
  height: 14px;
}

/* --- CUSTOM TOAST NOTIFICATION --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  left: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  align-items: center;
}
.toast-msg {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  color: #333;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  border-left: 5px solid var(--primary);
  animation: slideDownToast 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
  max-width: 400px;
  width: auto;
  pointer-events: auto;
}
.toast-msg.info {
  border-left-color: var(--primary);
  background: #e3f2fd;
  color: #0056d6;
}
.toast-msg.info span {
  color: #0056d6;
}
.toast-msg.success {
  border-left-color: #2ecc71;
}
.toast-msg.error {
  border-left-color: #e74c3c;
}
.toast-msg.warning {
  border-left-color: #f1c40f;
}
.toast-icon {
  font-size: 20px;
}

@keyframes slideDownToast {
  from {
    transform: translateY(-50px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
@keyframes fadeOutUpToast {
  from {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  to {
    transform: translateY(-30px) scale(0.9);
    opacity: 0;
  }
}
/* --- SEARCH BAR --- */
.search-container {
  position: relative;
  margin-bottom: 12px;
  z-index: 105;
}
.search-bar {
  display: flex;
  align-items: center;
  background: #f1f2f6;
  border-radius: 12px;
  padding: 10px 15px;
  border: 1px solid #e2e8f0;
  transition: 0.3s;
}
.search-bar:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(10, 100, 226, 0.1);
}
.search-bar i.fa-magnifying-glass {
  color: #94a3b8;
  font-size: 16px;
}
.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  padding: 0 10px;
  font-size: 14px;
  color: #333;
}
.clear-search {
  cursor: pointer;
  color: #cbd5e1;
  font-size: 18px;
  transition: 0.2s;
}
.clear-search:active {
  color: #94a3b8;
}
.suggestions-box {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 200;
  max-height: 250px;
  overflow-y: auto;
  margin-top: 8px;
  border: 1px solid #f0f0f0;
}
.sug-item {
  padding: 12px 15px;
  border-bottom: 1px dashed #f5f5f5;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sug-item:last-child {
  border-bottom: none;
}
.sug-item:active {
  background: #f8fafc;
}
.sug-title {
  font-weight: 700;
  color: var(--primary);
  font-size: 14px;
}
.sug-desc {
  font-size: 12px;
  color: #64748b;
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* =========================================
   BỘ CSS THU GỌN GIAO DIỆN (ÉP KHÔNG GIAN)
   ========================================= */

/* 1. Ép mỏng Header và Header-Card */
.fixed-header {
  padding: 10px 15px 5px !important;
  padding-top: max(10px, env(safe-area-inset-top)) !important;
}
.user-card {
  margin-bottom: 8px !important;
}
#user-avatar-img {
  width: 42px !important;
  height: 42px !important;
  border-width: 1px !important;
}
.user-info h3 {
  margin: 0 0 2px !important;
  font-size: 15px !important;
}
.info-row {
  font-size: 12px !important;
  margin: 0 !important;
}
.icon-btn {
  width: 32px !important;
  height: 32px !important;
  font-size: 14px !important;
  border-radius: 8px !important;
}

/* 2. Ép thanh Tìm kiếm & Tabs */
.search-container {
  margin-bottom: 8px !important;
}
.search-bar {
  padding: 6px 12px !important;
  border-radius: 10px !important;
  min-height: 36px;
}
.search-bar input {
  font-size: 13px !important;
}
.tabs-container {
  padding: 3px !important;
  border-radius: 10px !important;
}
.tab {
  padding: 6px !important;
  font-size: 12px !important;
}

/* 3. Ép thanh Cảnh báo */
.warning-bar {
  padding: 5px 10px !important;
  margin-top: 6px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
}

/* 4. Ép dàn nút Bottom Actions phía đáy */
.bottom-actions {
  bottom: 10px !important;
  left: 15px !important;
  right: 15px !important;
}
.support-btn,
.point-btn {
  padding: 6px !important;
  font-size: 10px !important;
  border-radius: 12px !important;
}
.noti-btn {
  width: 42px !important;
  border-radius: 12px !important;
}
.noti-btn i {
  font-size: 18px !important;
}
.btn-icon {
  font-size: 14px !important;
}

/* 5. Giảm khoảng trống đáy của danh sách đơn để hiển thị được nhiều đơn hơn */
#list-container {
  padding-bottom: 65px !important;
}
/* --- NÚT CHUÔNG TRÊN HEADER --- */
.noti-btn-top {
  background: #f1f2f6;
  color: #0a64e2;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.noti-btn-top i {
  transform-origin: top center;
}
.noti-btn-top.has-news i {
  animation: bell-ring 2s infinite;
}

/* --- CỤM NÚT NỔI DỌC BÊN PHẢI --- */
.right-floating-actions {
  position: absolute;
  bottom: 30px;
  right: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 90;
}
.float-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  color: white;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s;
}
.float-btn:active {
  transform: scale(0.9);
}
.float-point {
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
}
.float-support {
  background: linear-gradient(135deg, #0a64e2, #0056d6);
}

/* Giải phóng không gian đáy cho List Đơn Hàng */
#list-container {
  padding-bottom: 20px !important;
}
/* --- TIMELINE MỚI ĐẸP HƠN --- */
.better-timeline {
  display: flex;
  justify-content: space-between;
  position: relative;
  padding: 0 5px;
}
.better-timeline::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 20px;
  right: 20px;
  height: 3px;
  background: #f0f0f0;
  z-index: 1;
}
.bt-step {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.bt-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f0f0f0;
  color: #a0a0a0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 4px solid #fff;
  transition: 0.3s;
}
.bt-step.done .bt-icon {
  background: #27ae60;
  color: #fff;
  box-shadow: 0 0 0 2px #27ae6030;
}
.bt-step.active .bt-icon {
  background: #f39c12;
  color: #fff;
  box-shadow: 0 0 0 2px #f39c1230;
}
.bt-text {
  font-size: 11px;
  font-weight: bold;
  color: #999;
  text-align: center;
  white-space: nowrap;
}
.bt-step.done .bt-text {
  color: #27ae60;
}
.bt-step.active .bt-text {
  color: #f39c12;
}

/* Loader dưới cùng cho Infinite Scroll */
.bottom-loader-container {
  padding: 15px;
  text-align: center;
  color: var(--primary);
  font-size: 24px;
}
/* --- AVATAR GRID --- */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-height: 250px;
  overflow-y: auto;
  padding: 5px;
}
.avatar-item {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  background: #f8fafc;
}
.avatar-item:active {
  transform: scale(0.9);
}
.avatar-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(10, 100, 226, 0.2);
}
.input-group-modern input:focus,
.input-group-modern textarea:focus {
  border-color: var(--primary) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(10, 100, 226, 0.1);
  outline: none;
}
/* File: style.css */

.modal-input:focus {
  border-color: #0a64e2 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 4px rgba(10, 100, 226, 0.1);
  outline: none;
}

.addr-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: #fff;
  border: 1.5px solid #f1f5f9;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.addr-icon {
  width: 36px;
  height: 36px;
  background: #eff6ff;
  color: #3b82f6;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.addr-info {
  flex: 1;
  min-width: 0;
}

.addr-name {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.addr-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.addr-check {
  color: #cbd5e1;
  font-size: 18px;
  opacity: 0;
}

.active-addr {
  border-color: #0a64e2;
  background: #f0f7ff;
}

.active-addr .addr-check {
  opacity: 1;
  color: #0a64e2;
}
.addr-card-simple {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.addr-card-simple:hover {
  background: #f1f5f9;
}

.addr-card-simple.selected {
  background: #eff6ff;
}

.addr-card-simple.selected .check-icon {
  display: block;
  color: #0a64e2;
}

.check-icon {
  display: none;
  font-size: 14px;
}

.other-opt {
  padding-top: 15px;
  justify-content: space-between;
}
.addr-pop-item {
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: 0.2s;
}
.addr-pop-item:active {
  background: #f1f5f9;
}
.selected-addr {
  border-color: #0a64e2;
  background: #f0f7ff;
}
/* --- TOGGLE SWITCH PWA --- */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  margin: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
input:checked + .slider {
  background-color: #27ae60;
}
input:checked + .slider:before {
  transform: translateX(20px);
}
.slider.round {
  border-radius: 26px;
}
.slider.round:before {
  border-radius: 50%;
}
/* --- FIX LỖI PWA KHÔNG HIỆN BÀN PHÍM LẦN ĐẦU MỞ APP --- */
input,
textarea {
  user-select: auto !important;
  -webkit-user-select: auto !important;
  -webkit-touch-callout: default !important;
}

/* Đảm bảo ô nhập liệu không bị che khuất bởi vùng tap ẩn */
.input-group input {
  position: relative;
  z-index: 10;
}
