:root {
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --rose-600: #e11d48;
  --rose-50: #fff1f2;
  --amber-600: #d97706;
  --amber-50: #fffbeb;
  --emerald-600: #059669;
  --emerald-50: #ecfdf5;
  --purple-600: #7c3aed;
  --purple-50: #f5f3ff;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --bg: #f4f7f9;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--slate-900);
  font-size: 15px;
  line-height: 1.45;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* ==================== LOGIN SCREEN ==================== */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: linear-gradient(145deg, #0f766e 0%, #115e59 55%, #1e293b 100%);
}

.login-card {
  width: 100%;
  max-width: 410px;
  background: #ffffff;
  border-radius: 22px;
  padding: 26px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.login-brand img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-shrink: 0;
}

.login-brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  color: var(--slate-900);
}

.login-brand p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--slate-500);
}

.staff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.staff-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--slate-200);
  background: var(--slate-100);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--slate-700);
  transition: all 0.15s ease;
  text-align: left;
}

.staff-chip.active {
  border-color: var(--teal-600);
  background: var(--teal-50);
  color: var(--teal-800);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.18);
}

.staff-chip .role-dot {
  font-size: 16px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-700);
  margin: 10px 0 6px;
}

.input, .textarea, .select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1.5px solid var(--slate-200);
  font-size: 15px;
  font-family: inherit;
  color: var(--slate-900);
  background: #fff;
  transition: border-color 0.15s;
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.14);
}

.pin-input {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 6px;
}

/* ==================== TOP HEADER ==================== */
.app-shell {
  min-height: 100dvh;
  padding-bottom: 78px;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.top-left img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
}

.top-title {
  font-weight: 800;
  font-size: 15.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-sub {
  font-size: 12px;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #10b981;
}

.status-dot.offline {
  background: #f59e0b;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.user-pill {
  background: var(--teal-50);
  color: var(--teal-800);
  border: 1px solid var(--teal-100);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* ==================== MAIN CONTAINER & CARDS ==================== */
.main-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 12px 24px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, 0.85);
  margin-bottom: 12px;
  min-width: 0;
}

.section-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 11px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s;
  white-space: nowrap;
}

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

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 13px;
  border-radius: 9px;
}

.btn-primary {
  background: var(--teal-600);
  color: #fff;
}

.btn-primary:hover {
  background: var(--teal-700);
}

.btn-rose {
  background: var(--rose-600);
  color: #fff;
}

.btn-amber {
  background: var(--amber-600);
  color: #fff;
}

.btn-purple {
  background: var(--purple-600);
  color: #fff;
}

.btn-outline {
  background: #fff;
  color: var(--slate-700);
  border: 1.5px solid var(--slate-200);
}

.btn-soft {
  background: var(--teal-50);
  color: var(--teal-800);
  border: 1px solid var(--teal-100);
}

/* ==================== BARCODE SCANNER ==================== */
.scanner-hero-btn {
  width: 100%;
  min-height: 54px;
  font-size: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(13, 148, 136, 0.28);
}

.scanner-box {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  margin-top: 10px;
  aspect-ratio: 4 / 3;
  max-height: 310px;
  width: 100%;
}

.scanner-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-reticle {
  position: absolute;
  inset: 16% 10%;
  border: 2px solid rgba(45, 212, 191, 0.9);
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

.scanner-laser {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 2.5px;
  background: #fb7185;
  box-shadow: 0 0 10px #f43f5e;
  animation: scanPulse 1.6s infinite ease-in-out;
}

@keyframes scanPulse {
  0%, 100% { transform: translateY(-34px); opacity: 0.75; }
  50% { transform: translateY(34px); opacity: 1; }
}

.scanner-controls {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* ==================== FILTER PILLS ==================== */
.pill-bar {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 10px 0;
  scrollbar-width: none;
}

.pill-bar::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--slate-200);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-700);
  white-space: nowrap;
  cursor: pointer;
}

.filter-pill.active {
  background: var(--teal-600);
  border-color: var(--teal-600);
  color: #fff;
}

/* ==================== PRODUCT LIST ==================== */
.prod-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

@media (min-width: 680px) {
  .prod-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.prod-item {
  display: flex;
  gap: 11px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 13px;
  padding: 11px;
  align-items: center;
  min-width: 0;
}

.prod-thumb {
  width: 66px;
  height: 66px;
  border-radius: 10px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  object-fit: contain;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

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

.prod-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--slate-900);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prod-meta {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge-teal { background: var(--teal-50); color: var(--teal-800); }
.badge-amber { background: var(--amber-50); color: var(--amber-600); }
.badge-rose { background: var(--rose-50); color: var(--rose-600); }
.badge-emerald { background: var(--emerald-50); color: var(--emerald-600); }
.badge-purple { background: var(--purple-50); color: var(--purple-600); }

/* ==================== ORDER CARDS ==================== */
.order-card {
  background: #fff;
  border-radius: 14px;
  border: 1.5px solid var(--slate-200);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.order-card.status-pending {
  border-left: 5px solid var(--rose-600);
}

.order-card.status-processing {
  border-left: 5px solid var(--amber-600);
}

.order-card.status-confirmed {
  border-left: 5px solid var(--emerald-600);
}

.order-card.status-follow_up {
  border-left: 5px solid var(--purple-600);
}

.order-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.order-items-box {
  background: var(--slate-100);
  border-radius: 10px;
  padding: 10px;
  margin: 9px 0;
  font-size: 13.5px;
}

.order-item-row {
  padding: 5px 0;
  border-bottom: 1px dashed var(--slate-200);
}

.order-item-row:last-child {
  border-bottom: none;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

/* ==================== BOTTOM NAVIGATION ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: #ffffff;
  border-top: 1px solid var(--slate-200);
  display: flex;
  justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

.nav-tab {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 4px;
  color: var(--slate-500);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
}

.nav-tab .nav-icon {
  font-size: 20px;
  line-height: 1.1;
}

.nav-tab.active {
  color: var(--teal-700);
}

.nav-badge {
  position: absolute;
  top: 1px;
  right: calc(50% - 22px);
  background: var(--rose-600);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==================== MODAL / DRAWER ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.58);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 16px;
  }
}

.modal-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  overflow-y: auto;
  padding: 18px 16px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.22);
}

@media (min-width: 640px) {
  .modal-sheet {
    border-radius: 20px;
    padding-bottom: 20px;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--slate-200);
  margin-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
}

.compare-imgs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.img-preview-card {
  border: 1.5px dashed var(--slate-200);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  background: var(--slate-100);
}

.img-preview-card img {
  width: 100%;
  max-width: 150px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  background: var(--slate-100);
  border-radius: 10px;
  margin: 7px 0;
  font-size: 13.5px;
  font-weight: 600;
}

/* ==================== ZALO CHAT ==================== */
.zalo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 760px) {
  .zalo-layout {
    grid-template-columns: 290px minmax(0, 1fr);
  }
}

.msg-bubble {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 13px;
  margin-bottom: 8px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-in {
  background: var(--slate-100);
  color: var(--slate-900);
  border-bottom-left-radius: 4px;
}

.msg-out {
  background: var(--teal-600);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

/* ==================== TOAST ==================== */
.toast-container {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
  pointer-events: auto;
}

.toast.error {
  background: #be123c;
}

.toast.success {
  background: #0f766e;
}
