/* Bảng live Kissy Kid — host nhìn từ xa trong lúc đang lên sóng,
   nên chữ to, màu trạng thái rõ, không có chi tiết rườm rà. */

:root {
  --nen: #12101a;
  --nen-2: #1b1825;
  --nen-3: #241f31;
  --vien: #332c42;
  --chu: #f4f1f8;
  --chu-mo: #9a92ad;
  --chu-rat-mo: #6b6480;

  --hong: #ff4d8d;          /* màu thương hiệu Kissy Kid */
  --hong-mo: #ff4d8d22;
  --do: #ff4d4d;            /* đã giơ mà chưa ai đặt */
  --cam: #ffa726;           /* có đơn nhưng tồn còn nhiều */
  --xanh: #2ecc71;          /* hết sạch hàng */
  --lam: #4aa8ff;           /* đang bán tốt */
  --xam: #5c5570;           /* chưa giơ */

  --bo-goc: 14px;
  --bo-goc-nho: 9px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--nen);
  color: var(--chu);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------- đăng nhập */

.khung-dang-nhap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, #ff4d8d22, transparent 70%),
    var(--nen);
}

.the-dang-nhap {
  width: 100%;
  max-width: 380px;
  background: var(--nen-2);
  border: 1px solid var(--vien);
  border-radius: 20px;
  padding: 34px 28px;
  text-align: center;
}

.the-dang-nhap .logo {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 4px;
}
.the-dang-nhap .logo span { color: var(--hong); }
.the-dang-nhap .phu {
  color: var(--chu-mo);
  font-size: 14px;
  margin: 0 0 26px;
}

.the-dang-nhap input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  color: var(--chu);
  background: var(--nen-3);
  border: 1px solid var(--vien);
  border-radius: var(--bo-goc-nho);
  outline: none;
}
.the-dang-nhap input:focus { border-color: var(--hong); }

.the-dang-nhap button {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--hong);
  border: 0;
  border-radius: var(--bo-goc-nho);
  cursor: pointer;
}
.the-dang-nhap button:hover { filter: brightness(1.08); }

.loi-dang-nhap {
  margin: 14px 0 0;
  color: var(--do);
  font-size: 14px;
  min-height: 18px;
}
.ghi-chu-noi-bo {
  margin: 22px 0 0;
  font-size: 12px;
  color: var(--chu-rat-mo);
  line-height: 1.5;
}

/* ------------------------------------------------------------- bố cục */

#phao-hoa {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.trang {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ------------------------------------------------------------ dải KPI */

.dai-kpi {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto repeat(4, minmax(0, 1fr)) auto;
  gap: 1px;
  background: var(--vien);
  border-bottom: 1px solid var(--vien);
}

.o-kpi {
  background: var(--nen-2);
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.o-kpi .nhan {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--chu-rat-mo);
  white-space: nowrap;
}
.o-kpi .so {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.o-kpi .phu {
  font-size: 12px;
  color: var(--chu-mo);
  white-space: nowrap;
}
.o-kpi.nhan-manh .so { color: var(--hong); }
.o-kpi.tot .so { color: var(--xanh); }
.o-kpi.canh-bao .so { color: var(--do); }
/* Ô "Tiến độ gọn hàng": dòng phụ dài -> cắt bằng "…", rê chuột xem đủ */
.o-kpi .phu { overflow: hidden; text-overflow: ellipsis; }
.o-kpi .phu b { color: var(--chu); font-weight: 700; }

.o-thuong-hieu {
  background: var(--nen-2);
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.o-thuong-hieu .ten {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.o-thuong-hieu .ten span { color: var(--hong); }
.o-thuong-hieu .dong-ho {
  font-size: 13px;
  color: var(--chu-mo);
  font-weight: 600;
}

.o-dieu-khien {
  background: var(--nen-2);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nut {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--chu);
  background: var(--nen-3);
  border: 1px solid var(--vien);
  border-radius: var(--bo-goc-nho);
  cursor: pointer;
  white-space: nowrap;
}
.nut:hover { border-color: var(--hong); }
.nut.chinh { background: var(--hong); border-color: var(--hong); color: #fff; }
.nut.tat { opacity: 0.45; }
.nut.nho { padding: 6px 10px; font-size: 12px; }

/* ------------------------------------------------- thanh tiến độ mục tiêu */

.thanh-muc-tieu {
  height: 6px;
  background: var(--nen-3);
  position: relative;
  overflow: hidden;
}
.thanh-muc-tieu > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--hong), #ff9ec4);
  transition: width 0.6s cubic-bezier(.2,.8,.2,1);
}

/* ------------------------------------------------------------- thân */

.than {
  flex: 1;
  display: grid;
  /* cột trái | thanh kéo | cột phải — bề rộng cột phải do --rong-cot-phai (JS đặt khi kéo),
     kẹp trong [280px, 70%] để màn đổi cỡ vẫn không vỡ */
  grid-template-columns: minmax(0, 1fr) 10px clamp(280px, var(--rong-cot-phai, 330px), 70%);
  column-gap: 3px;
  row-gap: 16px;
  padding: 16px;
  align-items: start;
}

/* ------------------------------------------------------- thanh kéo */

.thanh-keo {
  position: sticky;
  top: 86px;
  align-self: start;
  height: calc(100vh - 86px - 16px);
  cursor: col-resize;
  touch-action: none;
  display: flex;
  justify-content: center;
  border-radius: 6px;
  outline: none;
}
.thanh-keo::before {
  content: "";
  width: 2px;
  height: 100%;
  border-radius: 2px;
  background: var(--vien);
  opacity: 0.6;
  transition: background 0.15s, opacity 0.15s, width 0.15s;
}
.thanh-keo:hover::before,
.thanh-keo:focus-visible::before,
.thanh-keo.dang-keo::before {
  width: 4px;
  background: var(--hong);
  opacity: 1;
}
body.dang-keo-cot {
  user-select: none;
  -webkit-user-select: none;
  cursor: col-resize;
}

.khu { min-width: 0; }

.tieu-de-khu {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--chu-mo);
}
.tieu-de-khu .dem {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--nen-3);
  color: var(--chu);
  font-size: 12px;
  letter-spacing: 0;
}
.tieu-de-khu.gap { color: var(--do); }
.tieu-de-khu.gap .dem { background: var(--do); color: #fff; }

/* ------------------------------------------- khối CẦN GIỚI THIỆU LẠI */

.nhac-lai {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(276px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.the-nhac {
  background: linear-gradient(180deg, #2a1620, var(--nen-2));
  border: 1px solid #5b2030;
  border-left: 5px solid var(--do);
  border-radius: 17px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.the-nhac:hover { border-color: var(--hong); }
.the-nhac.cam { border-left-color: var(--cam); border-color: #5b3f1a; }

/* Ảnh sản phẩm: vuông, đủ to để host nhìn từ xa */
.the-nhac .anh {
  flex: 0 0 auto;
  width: 106px;
  height: 106px;
  border-radius: 11px;
  object-fit: cover;
  background: var(--nen-3);
  display: block;
}
.the-nhac .anh.trong {
  display: grid;
  place-items: center;
  font-size: 46px;
  font-weight: 800;
  color: var(--chu-rat-mo);
  border: 1px dashed var(--vien);
}

.the-nhac .chu {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.the-nhac .ma {
  font-size: 31px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.the-nhac .ton {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--do);
  white-space: nowrap;
}
.the-nhac.cam .ton { color: var(--cam); }

/* ------------------------------------------------------ cột bên phải */

.cot-phai {
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: calc(100vh - 86px - 16px);   /* cao tới đáy màn hình */
}

/* Hộp "Đơn mới về" kéo dài lấp hết phần còn lại của cột, danh sách bên trong tự cuộn */
.hop-don {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.hop-don .dong-don {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.hop {
  background: var(--nen-2);
  border: 1px solid var(--vien);
  border-radius: var(--bo-goc);
  padding: 14px;
}

.dong-don {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 46vh;
  overflow-y: auto;
}

/* Mỗi đơn = 1 ô cao CỐ ĐỊNH, 2 dòng (tên khách / mã.size ··· tiền).
   Mọi dòng đều nowrap + cắt "…" nên ô không bao giờ cao thêm. */
.don {
  flex: 0 0 auto;                   /* không co/giãn trong cột flex */
  box-sizing: border-box;
  height: 56px;                     /* 2 dòng × ~22px + đệm 2×6px */
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  background: var(--nen-3);
  border-radius: var(--bo-goc-nho);
  border-left: 2px solid var(--hong);
  font-size: 15.6px;                /* ×1.2 so với 13px cũ */
  font-variant-numeric: tabular-nums;
  animation: don-vao 0.4s cubic-bezier(.2,.9,.2,1);
}
@keyframes don-vao {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: none; }
}
.don .khach {
  font-size: 16.4px;
  font-weight: 700;
  line-height: 22px;
  height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.don .dong-duoi {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 22px;
  height: 22px;
  min-width: 0;
}
.don .ds-mon {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.don .mon { white-space: nowrap; }
.don .mon .ma {
  color: var(--chu-mo);
  font-weight: 600;
}
.don .mon .sl {
  color: var(--chu-mo);
  font-weight: 600;
}
.don .them {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--chu-mo);
  background: var(--nen-2);
  border-radius: 8px;
  padding: 0 6px;
  line-height: 18px;
}
.don .them[hidden] { display: none; }
.don .tien {
  flex: 0 0 auto;
  margin-left: auto;
  text-align: right;
  font-size: 16.8px;
  font-weight: 800;
  color: var(--hong);
  white-space: nowrap;
}
.don .ngan { color: var(--chu-rat-mo); }

.rong {
  padding: 26px 10px;
  text-align: center;
  color: var(--chu-rat-mo);
  font-size: 13px;
  line-height: 1.5;
}

/* ------------------------------------------------- bảng bắt đầu phiên */

.man-che {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #0b0910e8;
  backdrop-filter: blur(6px);
}
.man-che[hidden] {
  display: none;
}
.bang-bat-dau {
  width: 100%;
  max-width: 430px;
  background: var(--nen-2);
  border: 1px solid var(--vien);
  border-radius: 20px;
  padding: 28px;
}
.bang-bat-dau h2 {
  margin: 0 0 6px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.4px;
}
.bang-bat-dau .phu {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--chu-mo);
  line-height: 1.5;
}
.o-nhap { margin-bottom: 14px; }
.o-nhap label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--chu-rat-mo);
  margin-bottom: 6px;
}
.o-nhap input {
  width: 100%;
  padding: 12px 14px;
  font-size: 17px;
  font-weight: 700;
  color: var(--chu);
  background: var(--nen-3);
  border: 1px solid var(--vien);
  border-radius: var(--bo-goc-nho);
  outline: none;
}
.o-nhap input:focus { border-color: var(--hong); }
.o-nhap .goi-y {
  font-size: 12px;
  color: var(--chu-rat-mo);
  margin-top: 5px;
}

/* ------------------------------------------------------- thông báo nhỏ */

.khay-thong-bao {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.thong-bao {
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--nen-3);
  border: 1px solid var(--vien);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 34px #0008;
  animation: tb-vao 0.3s ease;
}
.thong-bao.xanh { border-color: var(--xanh); color: var(--xanh); }
.thong-bao.hong { border-color: var(--hong); color: var(--hong); }
.thong-bao.do   { border-color: var(--do); color: var(--do); }
@keyframes tb-vao {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.den-ket-noi {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--xanh);
  flex: 0 0 auto;
}
.den-ket-noi.mat { background: var(--do); }

/* ------------------------------------------------------------ màn nhỏ */

@media (max-width: 1080px) {
  .than { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .thanh-keo { display: none; }
  .cot-phai { position: static; height: auto; }
  .hop-don .dong-don { max-height: 46vh; }
  .dai-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .o-thuong-hieu, .o-dieu-khien { grid-column: 1 / -1; }
  .o-dieu-khien { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .dai-kpi { grid-template-columns: minmax(0, 1fr); }
  .o-kpi { flex-direction: row; align-items: baseline; gap: 10px; }
  .o-kpi .nhan { flex: 1; }
  .than { padding: 12px; gap: 12px; }
  .nhac-lai { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
