/* nhapkhau.azpos.vn — ưu tiên điện thoại, tự theo sáng/tối của máy */
:root {
  --nen: #f3f5f8; --the: #ffffff; --chu: #16202c; --mo: #5d6b7c; --vien: #dfe4ea;
  --chinh: #1f4e78; --chinh-chu: #ffffff; --nhan: #2f6f3e; --nhan-nen: #e8f3ea;
  --cam: #b85c00; --cam-nen: #fff1e3; --loi: #b42318; --loi-nen: #fde8e7; --ok: #1d7a3a; --ok-nen: #e6f4ea;
  --danh-dau: #ffe58a; --bong: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --bo: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --nen: #0f141a; --the: #18202a; --chu: #e6ebf1; --mo: #9aa7b6; --vien: #2a3441;
    --chinh: #5b9bd5; --chinh-chu: #0f141a; --nhan: #7cc68d; --nhan-nen: #1c2e22;
    --cam: #ffb366; --cam-nen: #33240f; --loi: #ff8a80; --loi-nen: #3a1715; --ok: #7cc68d; --ok-nen: #1c2e22;
    --danh-dau: #6b5a12; --bong: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--nen); color: var(--chu);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--chinh); }
h1 { font-size: 18px; margin: 0; line-height: 1.25; }
.mo { color: var(--mo); margin: 2px 0 0; font-size: 13px; }
code { background: var(--nen); border: 1px solid var(--vien); border-radius: 5px; padding: 0 4px; font-size: 12.5px; }
button, input, select { font: inherit; color: inherit; }

/* ---------- đăng nhập / đổi mật khẩu ---------- */
.o-giua { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.the-nho {
  width: 100%; max-width: 380px; background: var(--the); border: 1px solid var(--vien);
  border-radius: var(--bo); padding: 24px 20px; box-shadow: var(--bong);
}
.the-nho h1 { font-size: 20px; }
.the-nho label { display: block; margin-top: 14px; font-size: 13px; color: var(--mo); font-weight: 600; }
.the-nho input {
  display: block; width: 100%; margin-top: 6px; padding: 12px; font-size: 16px;
  background: var(--nen); border: 1px solid var(--vien); border-radius: 10px;
}
.the-nho input:focus { outline: 2px solid var(--chinh); outline-offset: 1px; }
.logo-dn {
  width: 48px; height: 48px; border-radius: 12px; background: var(--chinh); color: var(--chinh-chu);
  display: grid; place-items: center; font-weight: 800; margin-bottom: 12px; letter-spacing: .5px;
}
.nut-chinh {
  width: 100%; margin-top: 18px; padding: 12px; border: 0; border-radius: 10px;
  background: var(--chinh); color: var(--chinh-chu); font-weight: 700; font-size: 16px; cursor: pointer;
}
.bao-loi, .bao-ok { border-radius: 10px; padding: 10px 12px; margin: 14px 0 0; font-size: 14px; }
.bao-loi { background: var(--loi-nen); color: var(--loi); }
.bao-ok { background: var(--ok-nen); color: var(--ok); }

/* ---------- đầu trang + tìm kiếm (dính trên cùng) ---------- */
.dau {
  position: sticky; top: 0; z-index: 10; background: var(--the); border-bottom: 1px solid var(--vien);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.dau-trong, .tim { max-width: 1200px; margin: 0 auto; }
.dau-trong { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ten-trang { min-width: 0; }
.menu-tk { position: relative; flex: none; }
.menu-tk summary { list-style: none; cursor: pointer; }
.menu-tk summary::-webkit-details-marker { display: none; }
.cham-tk {
  display: inline-block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 6px 12px; border: 1px solid var(--vien); border-radius: 999px; font-size: 13px; font-weight: 600;
}
.menu-tk-hop {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 170px; background: var(--the);
  border: 1px solid var(--vien); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); padding: 6px; z-index: 20;
}
.menu-tk-hop a, .menu-tk-hop button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none;
  border-radius: 8px; text-decoration: none; color: var(--chu); font-size: 14px; cursor: pointer;
}
.menu-tk-hop a:hover, .menu-tk-hop button:hover { background: var(--nen); }
.tim { margin-top: 10px; }
.o-tim { position: relative; }
.o-tim svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: var(--mo); }
.o-tim input {
  width: 100%; padding: 11px 40px 11px 38px; font-size: 16px; background: var(--nen);
  border: 1px solid var(--vien); border-radius: 12px; -webkit-appearance: none; appearance: none;
}
.o-tim input:focus { outline: 2px solid var(--chinh); outline-offset: 1px; background: var(--the); }
.o-tim input::-webkit-search-cancel-button { display: none; }
.nut-xoa {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: var(--vien); font-size: 18px; line-height: 1; cursor: pointer;
}
.loc { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.loc::-webkit-scrollbar { display: none; }
.loc select, .nut-phu {
  flex: none; max-width: 190px; padding: 7px 28px 7px 10px; font-size: 13.5px; background: var(--nen);
  border: 1px solid var(--vien); border-radius: 999px; -webkit-appearance: none; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--mo) 50%), linear-gradient(135deg, var(--mo) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
  text-overflow: ellipsis;
}
.loc select.dang-loc { border-color: var(--chinh); color: var(--chinh); font-weight: 600; }
.nut-phu { background-image: none; padding: 7px 12px; }
.huong-dan {
  margin-top: 8px; padding: 10px 12px; background: var(--nen); border: 1px solid var(--vien);
  border-radius: 12px; font-size: 13.5px;
}
.huong-dan p { margin: 0 0 6px; }
.huong-dan ul { margin: 0; padding-left: 18px; }
.huong-dan li { margin: 3px 0; }

/* ---------- danh sách lô — MỖI LÔ MỘT HÀNG GỌN (anh Vinh chốt 05/10/2026) ----------
   [ảnh cao bằng hàng] [mã · model · NCC · nhập] [đơn giá · SL · tổng] [thông số 1 dòng · HS/cảng]   + "Chi tiết" mở xuống */
.noi-dung { max-width: 1280px; margin: 0 auto; padding: 10px 16px calc(32px + env(safe-area-inset-bottom)); }
.dem { margin: 0 0 8px; color: var(--mo); font-size: 13px; }
.dem b { color: var(--chu); }
.ds { display: grid; gap: 8px; grid-template-columns: 1fr; }
.trong { text-align: center; color: var(--mo); padding: 40px 0; }

.lo {
  background: var(--the); border: 1px solid var(--vien); border-radius: 12px; box-shadow: var(--bong);
  padding: 10px; display: grid; gap: 6px 12px; min-width: 0;
  grid-template-columns: 88px minmax(0, 1fr);            /* điện thoại: ảnh | định danh, phần còn lại xuống dưới */
}
.lo > * { min-width: 0; }
.lo p { margin: 0; }
.lo-hinh {
  grid-row: 1; grid-column: 1; align-self: stretch; min-height: 88px; padding: 0; overflow: hidden; position: relative;
  border: 1px solid var(--vien); border-radius: 10px; background: #fff; cursor: zoom-in;
}
.lo-hinh img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.lo-hinh-trong { display: grid; place-items: center; text-align: center; font-size: 11.5px; color: var(--mo); background: var(--nen); cursor: default; padding: 4px; }
.lo-hinh-dem { position: absolute; right: 4px; bottom: 4px; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .6); border-radius: 999px; padding: 1px 6px; }
.lo-trai { grid-row: 1; grid-column: 2; display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.lo-giua, .lo-phai, .lo-chi-tiet { grid-column: 1 / -1; }

.lo-ma { font-size: 12px; color: var(--mo); font-weight: 600; }
.lo-ma .the-cam { margin-left: 6px; }
.lo-model { font-size: 16px; font-weight: 700; margin: 0; line-height: 1.25; word-break: break-word; }
.lo-cty { font-size: 12.5px; color: var(--chu); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lo-nhan { color: var(--mo); }

.lo-gia { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.lo-gia b { font-size: 18px; color: var(--nhan); white-space: nowrap; }
.lo-gia small { font-size: 12.5px; color: var(--mo); white-space: nowrap; }
.lo-sl { font-size: 12.5px; color: var(--mo); }
.lo-sl b { color: var(--chu); }

.ts-dong {
  font-size: 13px; line-height: 1.45; color: var(--chu); word-break: break-word;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.ds.ts-day-du .ts-dong { display: block; -webkit-line-clamp: unset; line-clamp: unset; }
.ts-nhan { color: var(--mo); }
.ts-cham { color: var(--mo); }
.trong-ts { color: var(--mo); font-style: italic; }
.lo-phu { font-size: 12px; color: var(--mo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px !important; }
.the-cam { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--cam-nen); color: var(--cam); font-weight: 600; }

.lo-chi-tiet { border-top: 1px dashed var(--vien); padding-top: 4px; }
.lo-chi-tiet summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--chinh); list-style: none; padding: 2px 0; }
.lo-chi-tiet summary::-webkit-details-marker { display: none; }
.lo-chi-tiet summary::before { content: "▸ "; }
.lo-chi-tiet[open] summary::before { content: "▾ "; }
.chi-tiet { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; margin: 6px 0 4px; font-size: 13px; }
.chi-tiet dt { color: var(--mo); }
.chi-tiet dd { margin: 0; word-break: break-word; }
.ts-bang { width: 100%; border-collapse: collapse; font-size: 13px; }
.ts-bang th, .ts-bang td { text-align: left; vertical-align: top; padding: 3px 4px; border-bottom: 1px solid var(--vien); word-break: break-word; }
.ts-bang th { width: 34%; color: var(--mo); font-weight: 600; padding-right: 10px; }
.ts-bang tr:last-child th, .ts-bang tr:last-child td { border-bottom: 0; }
@media (max-width: 420px) {
  .chi-tiet { grid-template-columns: 1fr; gap: 0; }
  .chi-tiet dt { margin-top: 6px; font-size: 12px; }
}

/* máy tính: 4 cột trên MỘT hàng, ảnh cao bằng cả hàng (kể cả dòng "Chi tiết") */
@media (min-width: 900px) {
  .ds .lo { grid-template-columns: 112px minmax(0, 1.15fr) minmax(230px, .75fr) minmax(0, 1.6fr); gap: 2px 16px; padding: 10px 12px; align-items: center; }
  .ds .lo-hinh { grid-row: 1 / span 2; grid-column: 1; min-height: 104px; }
  .ds .lo-trai { grid-row: 1; grid-column: 2; }
  .ds .lo-giua { grid-row: 1; grid-column: 3; border-left: 1px solid var(--vien); padding-left: 16px; align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
  .ds .lo-phai { grid-row: 1; grid-column: 4; border-left: 1px solid var(--vien); padding-left: 16px; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
  .ds .lo-chi-tiet { grid-row: 2; grid-column: 2 / -1; }
}
mark { background: var(--danh-dau); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- xem ảnh toàn màn hình ---------- */
.xem-anh {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .92); display: grid; place-items: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); touch-action: pan-y;
}
.xem-anh[hidden] { display: none; }
.xem-anh img { max-width: 100vw; max-height: 86vh; max-height: 86dvh; object-fit: contain; user-select: none; }
.xem-anh button {
  position: absolute; border: 0; background: rgba(255, 255, 255, .14); color: #fff; width: 44px; height: 44px;
  border-radius: 50%; font-size: 28px; line-height: 1; cursor: pointer;
}
.xa-dong { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.xa-truoc { left: 10px; top: 50%; transform: translateY(-50%); }
.xa-sau { right: 10px; top: 50%; transform: translateY(-50%); }
.xa-chu { position: absolute; bottom: calc(12px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #ddd; font-size: 13px; margin: 0; }
@media (prefers-reduced-motion: no-preference) { .lo { transition: border-color .15s; } }
