/* =====================================================================
 * ds-62.css — DANH SÁCH (bản 62) · Trường Giang
 * Lớp riêng, gỡ được: xoá thẻ <link> trong index.html là về như bản 61.
 *
 *  A) Điện thoại/máy tính bảng (≤768px): danh sách chảy liền với trang
 *     – bỏ khung cuộn lồng + hàng nút "Chi tiết | Đầu | Qua DS | Toàn màn hình"
 *  B) Thẻ gọn: tên + trạng thái · công ty · loại · ngày vào · SĐT · tổng công
 *     – chạm tên hoặc mũi tên ▾ để mở đủ thông tin
 *  C) Nút ↑ nổi để lên đầu danh sách
 *  D) Ngăn "Công cụ": mỗi nút ghi kèm 1 dòng giải thích, bỏ nút chỉ dùng trên máy tính
 * ===================================================================== */

:root {
  --d6-or: #BF550A; --d6-or-d: #9A4306; --d6-tint: #FFF4EA; --d6-tint-line: #F3D9C0;
  --d6-ink: #1F1B16; --d6-ink2: #4A4036; --d6-mute: #7B6F63; --d6-line: #E8E3DC; --d6-paper: #FAF8F5;
  --d6-ok: #1E7F4F;
}

@media (max-width: 768px) {
  /* ---------- A) bỏ khung cuộn lồng ---------- */
  body #tab-list #ldCardBox .sbox-bar { display: none !important; }
  #ldCardBox #ldCardScroll.sbox {
    max-height: none !important; overflow: visible !important;
    border: 0 !important; background: transparent !important; padding: 0 !important; border-radius: 0 !important;
  }
  #ldCardList { gap: 10px !important; padding-bottom: 4px !important; }
  /* bỏ 2 lớp viền bọc ngoài (thẻ đã có viền riêng) → thẻ rộng hết màn hình */
  body #tab-list #dataDisplaySection,
  body #tab-list #dataDisplaySection > .table-responsive:has(> #ldCardBox) {
    border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; overflow: visible !important;
  }
  #tab-list .ls-footer { margin: 6px 0 90px; text-align: center; font-size: .76rem; color: var(--d6-mute); }
  #tab-list #tableCountInfo #lsShowAllBtn { display: none !important; }     /* tự tải khi cuộn – không cần "Hiện tất cả" */
  /* công tắc "Mở hết / Thu gọn hết" (bản 63): nằm cuối dòng đếm, không thêm hàng mới */
  body #tab-list #tableCountInfo { align-items: center; min-height: 30px; flex-wrap: wrap !important; row-gap: 4px; }   /* chật thì dòng đồng bộ (● giờ ↻) xuống dòng chứ không bị đẩy mất */
  body #tab-list #tableCountInfo #lsCountText { flex: 1 1 auto !important; min-width: 0; }
  #tab-list #tableCountInfo .ld-allbtn {
    margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 5px;
    height: 30px; padding: 0 11px; border-radius: 999px;
    border: 1px solid var(--d6-line); background: #fff; color: var(--d6-ink2);
    font-size: .76rem; font-weight: 700; font-style: normal; line-height: 1; white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
  }
  #tab-list #tableCountInfo .ld-allbtn .bi { font-size: .82rem; color: var(--d6-or); }
  #tab-list #tableCountInfo .ld-allbtn[aria-pressed="true"] { background: var(--d6-tint); border-color: var(--d6-tint-line); color: var(--d6-or-d); }
  #tab-list #tableCountInfo .ld-allbtn:focus-visible { outline: 2px solid var(--d6-or); outline-offset: 2px; }

  /* ---------- B) thẻ gọn ---------- */
  #ldCardList .ld-card { padding: 12px 12px 10px 16px !important; gap: 0 !important; }
  #ldCardList .ld-card .ld-main { padding-left: 0 !important; display: flex; flex-direction: column; gap: 6px; }

  #ldCardList .ld-card .ld-name {
    display: flex !important; align-items: center !important; gap: 6px !important;
    margin: 0 !important; font-size: 1.06rem !important; font-weight: 800; line-height: 1.25; color: var(--d6-ink);
  }
  #ldCardList .ld-card .ld-name > span:first-child { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
  #ldCardList .ld-card .ld-name .lb-stp { margin: 0 !important; }
  #ldCardList .ld-card .ld-name .dq-dot { margin: 0 !important; }

  /* nút mở / thu gọn */
  .ld-card .ld-xp {
    flex: none; width: 34px; height: 34px; margin: -4px -4px -4px 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--d6-line); border-radius: 50%; background: #fff; color: var(--d6-ink2);
    font-size: .9rem; padding: 0; -webkit-tap-highlight-color: transparent;
  }
  .ld-card .ld-xp .bi { transition: transform .2s ease; }
  .ld-card.ld-open .ld-xp { background: var(--d6-tint); border-color: var(--d6-tint-line); color: var(--d6-or-d); }
  .ld-card.ld-open .ld-xp .bi { transform: rotate(180deg); }
  .ld-card .ld-xp:focus-visible { outline: 2px solid var(--d6-or); outline-offset: 2px; }

  /* công ty · loại · ngày vào */
  .ld-card .ld-meta {
    font-size: .82rem; color: var(--d6-ink2); line-height: 1.35; cursor: pointer;
    display: flex; flex-wrap: wrap; align-items: center; column-gap: 0; row-gap: 2px;
  }
  .ld-card .ld-meta .ld-dot { font-style: normal; color: #C9BFB2; margin: 0 7px; }
  .ld-card .ld-meta .lb-mine { font-weight: 700; }

  /* SĐT + tổng công */
  .ld-card .ld-sumrow { display: flex; align-items: center; gap: 8px; }
  #ldCardList .ld-card .ld-phone {
    flex: 1 1 auto; min-width: 0; margin: 0 !important;
    display: flex; align-items: center; gap: 2px;
    background: var(--d6-paper) !important; border: 1px solid #EFE8DE !important; border-radius: 10px !important;
    padding: 2px 4px 2px 10px !important; height: 38px;
  }
  #ldCardList .ld-card .ld-phone::before { content: none !important; display: none !important; }
  .ld-card .ld-phone .ld-ph-ic { color: var(--d6-mute); font-size: .85rem; margin-right: 6px; }
  #ldCardList .ld-card .ld-phone .phone-cell { flex: 1 1 auto; min-width: 0; font-size: .92rem !important; font-weight: 600; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #ldCardList .ld-card .ld-phone .btn-link { width: 32px !important; height: 32px !important; margin: 0 !important; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
  .ld-card .ld-cong {
    flex: none; height: 38px; display: inline-flex; align-items: center; gap: 4px; padding: 0 12px;
    border-radius: 10px; background: var(--d6-tint); border: 1px solid var(--d6-tint-line);
    font-size: .76rem; color: var(--d6-or-d); white-space: nowrap;
  }
  .ld-card .ld-cong b { font-size: 1.05rem; font-weight: 800; }
  .ld-card .ld-cong-vet .bi { color: #D99A0B; font-size: .8rem; }

  /* nhãn phụ (mã, đợt, chờ duyệt, thêm STK…) */
  .ld-card .ld-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 5px; }
  .ld-card .ld-tags > * { margin: 0 !important; }
  /* hồ sơ còn thiếu: nhãn chữ, màu theo mức (đỏ: bắt buộc · tím: cần xem lại · vàng: nên bổ sung) */
  .ld-card .ld-dq {
    --t: #c98a00; display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px;
    border-radius: 999px; border: 1px solid color-mix(in srgb, var(--t) 35%, #fff); background: color-mix(in srgb, var(--t) 9%, #fff);
    color: color-mix(in srgb, var(--t) 85%, #000); font-size: .72rem; font-weight: 700; line-height: 1;
  }
  .ld-card .ld-dq--req { --t: #d63939; }
  .ld-card .ld-dq--chk { --t: #6d4bd8; }
  .ld-card .ld-dq .bi { font-size: .78rem; }
  .ld-card .ld-code {
    display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px;
    background: #F3F0EB; color: var(--d6-ink2); font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  }
  .ld-card .ld-code::before { content: 'Mã '; font-weight: 500; color: var(--d6-mute); margin-right: 2px; }
  #ldCardList .ld-card .ld-add-stk.bq-add {
    display: inline-flex !important; width: auto !important; align-items: center; gap: 4px;
    height: 24px; padding: 0 9px !important; margin: 0 !important; border-radius: 999px;
    font-size: .72rem; font-weight: 700;
  }

  /* ghi chú: 2 dòng khi gọn, đủ khi mở */
  .ld-card .ld-note {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font-size: .8rem; line-height: 1.4; color: var(--d6-ink2);
    background: #FFFBF0; border-left: 3px solid #EBCB7A; border-radius: 0 8px 8px 0; padding: 4px 8px;
    overflow-wrap: anywhere; white-space: pre-line;
  }
  .ld-card .ld-note .bi { color: #B8902E; margin-right: 5px; font-size: .75rem; }
  .ld-card.ld-open .ld-note { -webkit-line-clamp: unset; display: block; }

  /* phần chi tiết: chỉ hiện khi mở thẻ */
  .ld-card .ld-more { display: none; }
  .ld-card.ld-open .ld-more { display: block; animation: d6Open .18s ease-out; }
  @keyframes d6Open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
  .ld-card .ld-more .ld-spec { margin: 2px 0 6px !important; }
  .ld-card .ld-more .ld-rows { margin: 0 0 4px !important; }
  body.ld-dense .ld-card.ld-open .ld-more .ld-info-list.mt-1 { display: flex !important; }
  .ld-card .ld-more .ld-info-list.mt-1 { margin-top: 6px !important; padding-top: 6px; }
  .ld-card .ld-more .ld-image-list:empty { display: none; }

  /* nút hành động: 1 hàng, gọn */
  #ldCardList .ld-card .ld-actions.ld-actions-bottom { margin-top: 2px !important; padding-top: 8px; border-top: 1px solid #F1ECE5; }
  #ldCardList .ld-card .ld-actions.ld-actions-bottom > .btn { min-height: 40px !important; }

  /* đang "Chọn nhiều": ẩn nút mở thẻ để chạm là chọn */
  body.bk-selecting .ld-card .ld-xp { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .ld-card .ld-xp .bi, .ld-card.ld-open .ld-more { transition: none !important; animation: none !important; }
}

/* ---------- ô tìm trên điện thoại: chỉ 1 viền sáng ở khung ngoài (bỏ viền thứ 2 của ô nhập) ---------- */
body #l6Bar .l6-q input, body #l6Bar .l6-q input:focus, body #l6Bar .l6-q input:focus-visible {
  box-shadow: none !important; outline: 0 !important; border: 0 !important; background: transparent !important; border-radius: 0 !important;
}
body #l6Bar .l6-q input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }   /* đã có nút ⓧ riêng */

/* ---------- C) nút ↑ nổi ---------- */
#l6Top, .ld-allbtn { display: none; }
@media (max-width: 768px) {
  #l6Top {
    position: fixed; right: 14px; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); z-index: 1029;
    width: 46px; height: 46px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; color: var(--d6-or-d); border: 1px solid var(--d6-tint-line);
    box-shadow: 0 6px 18px rgba(60, 40, 10, .22); font-size: 1.15rem;
    opacity: 0; transform: translateY(10px) scale(.9); pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
  }
  #l6Top.on { opacity: 1; transform: none; pointer-events: auto; }
  html.l6-lock #l6Top, body.modal-open #l6Top { opacity: 0 !important; pointer-events: none !important; }
}

/* ---------- D) ngăn "Công cụ" trên điện thoại: mỗi công cụ 1 hàng, kèm dòng giải thích ---------- */
@media (max-width: 576px) {
  body #tab-list .ld-toolbar.l6-sheet-on #freezeColGroup,
  body #tab-list .ld-toolbar.l6-sheet-on .l5-audit-grp,
  body #tab-list .ld-toolbar.l6-sheet-on > .lb-t-toggle,
  body #tab-list .ld-toolbar.l6-sheet-on .adv-i { display: none !important; }

  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on {
    grid-template-columns: minmax(0, 1fr) !important; gap: 8px !important;
  }
  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on > #stkCtlGroup {
    grid-column: 1 / -1 !important; grid-template-columns: minmax(0, 1fr) !important;
  }
  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on [data-d6-desc] {
    display: grid !important; grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: auto auto;
    column-gap: 12px !important; row-gap: 1px !important; align-items: center; justify-items: start; align-content: center;
    text-align: left !important; width: 100% !important; min-height: 60px !important; height: auto !important;
    padding: 9px 12px !important; border-radius: 14px !important; white-space: normal !important;
    font-size: .9rem !important; font-weight: 700 !important; line-height: 1.2 !important;
  }
  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on [data-d6-desc] span,
  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on [data-d6-desc] .stk-lbl,
  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on [data-d6-desc] #stkModeTxt .stk-t { font-size: .9rem !important; font-weight: 700 !important; }
  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on [data-d6-desc] > i:first-child {
    grid-row: 1 / span 2; grid-column: 1; width: 38px !important; height: 38px !important; border-radius: 11px !important; margin: 0 !important;
  }
  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on [data-d6-desc] > :not(i:first-child) { grid-column: 2; grid-row: 1; min-width: 0; }
  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on [data-d6-desc]::after {
    content: attr(data-d6-desc); grid-column: 2; grid-row: 2; display: block !important;
    font-size: .76rem; font-weight: 500; color: var(--d6-mute); line-height: 1.3; letter-spacing: 0; text-transform: none;
    border: 0 !important; margin: 0 !important; width: auto !important; height: auto !important; vertical-align: baseline;
  }
  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on #stkModeBtn #stkModeTxt { flex-direction: row !important; align-items: baseline !important; gap: 6px !important; }
  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on #stkModeBtn #stkModeTxt .stk-v { font-size: .74rem !important; }
  /* "Chọn nhiều" đang bật (nền cam): dòng giải thích màu sáng */
  body #tab-list #dataDisplaySection .ld-toolbar.l6-sheet-on #bkModeBtn.active::after { color: rgba(255, 255, 255, .86); }
}


/* ===== v68 – dòng Công ty / Loại / Vào / Nghỉ: 2 hàng gọn, thẳng lề, không ngắt giữa ngày ===== */
.ld-card .ld-meta { display: block; line-height: 1.3; }
.ld-card .ld-meta .ld-m1 { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; }
.ld-card .ld-meta .ld-m2 { display: flex; flex-wrap: nowrap; align-items: baseline; gap: 6px; margin-top: 4px; font-size: .8rem; color: var(--d6-ink2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ld-card .ld-meta .ld-d { display: inline-flex; align-items: baseline; gap: 4px; flex: none; }
.ld-card .ld-meta .ld-dl { color: var(--d6-mute); font-size: .74rem; }
.ld-card .ld-meta .ld-d b { font-weight: 600; color: var(--d6-ink, #3d342d); }
.ld-card .ld-meta .ld-arr { font-style: normal; color: #C9BFB2; flex: none; }
.ld-card .ld-meta .ld-d-out b { color: #B4472B; }


/* ===== v70 – Thẻ lao động + Vị trí trên thẻ điện thoại =====
   Đóng thẻ: chỉ hiện cái đang CÓ (vị trí ở hàng công ty, thẻ ở hàng nhãn).
   Mở thẻ: hiện thêm nút 🏷 gắn thẻ và nút "+ Vị trí" để thêm ngay. */
  #ldCardList .ld-card .ld-m1 .vt-line { display: inline-flex; margin: 0; }
  #ldCardList .ld-card .ld-m1 .vt-chip { height: 21px !important; line-height: 19px; padding: 0 9px !important; font-size: .72rem !important; font-weight: 700; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  #ldCardList .ld-card .ld-tags .the-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 5px; margin: 0 !important; }
  #ldCardList .ld-card .ld-tags .the-chip,
  #ldCardList .ld-card .ld-tags .vt-chip { height: 24px !important; line-height: 22px; padding: 0 9px !important; font-size: .72rem !important; font-weight: 700; border-radius: 999px; }
  #ldCardList .ld-card .ld-tags .the-chip i { font-size: .78rem; }
  #ldCardList .ld-card .ld-tags .the-chip span { max-width: 44vw; }
  #ldCardList .ld-card .ld-tags .the-add {
    display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0;
    border-radius: 999px; border: 1px dashed #F0C9A4; background: #fff; color: var(--d6-or-d); font-size: .78rem;
  }
  /* thẻ đang đóng: giấu các nút "thêm" cho gọn (chỉ còn thông tin thật) */
  .ld-card:not(.ld-open) .ld-tags .the-add { display: none !important; }
  .ld-card:not(.ld-open) .ld-tags .the-chips:not(:has(.the-chip)) { display: none !important; }
  .ld-card:not(.ld-open) .ld-tags .vt-line:has(.vt-add) { display: none !important; }
