/* v158 Driver history - unified Card Table Hybrid, isolated styles */
.driver-history-page{display:flex;flex-direction:column;gap:14px;padding-bottom:8px}
.dh-head{padding:4px 2px 0}
.dh-head h1{margin:0;color:#0f172a;font-size:32px;line-height:1.12;font-weight:950;letter-spacing:-.02em}
.dh-head p{margin:6px 0 0;color:#64748b;font-weight:800;font-size:15px}
.dh-head.detail{display:flex;flex-direction:column;gap:4px}
.dh-head.detail .ghost{align-self:flex-start;margin-bottom:4px}
.dh-search-card{display:flex;align-items:center;gap:10px;background:#fff;border:1px solid #e5eaf3;border-radius:22px;padding:12px;box-shadow:0 10px 30px rgba(15,23,42,.07)}
.dh-search-box{display:flex;align-items:center;gap:10px;flex:1;min-width:0;border:1px solid #dbe3ef;border-radius:18px;background:#f8fafc;padding:0 12px;height:54px}
.dh-search-box svg,.dh-filter-btn svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round;color:#334155;flex:0 0 auto}
.dh-search-box input{border:0;background:transparent;outline:none;width:100%;height:100%;font-size:15px;font-weight:800;color:#0f172a;min-width:0}
.dh-search-box input::placeholder{color:#8290a3}
.dh-filter-btn{width:54px;height:54px;border:0;background:#fff;color:#334155;border-radius:16px;display:grid;place-items:center}
.dh-list{display:flex;flex-direction:column;gap:12px}
.dh-card{display:grid;grid-template-columns:64px minmax(0,1fr) auto;align-items:center;gap:12px;background:#fff;border:1px solid #e6ecf5;border-radius:22px;padding:14px;box-shadow:0 8px 24px rgba(15,23,42,.06)}
.dh-icon{width:56px;height:56px;border-radius:50%;display:grid;place-items:center;overflow:hidden;flex:0 0 auto}
.dh-icon svg{width:36px;height:36px;fill:none;stroke:currentColor;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.dh-icon-truck{background:#eef5ff;color:#2563eb}
.dh-icon-tube{background:#ecfdf5;color:#059669}
.dh-icon-microscope{background:#fff1f2;color:#e11d48}
.dh-main{min-width:0;display:flex;flex-direction:column;gap:5px}
.dh-date{display:flex;align-items:center;gap:7px;color:#475569;font-size:14px;font-weight:800;line-height:1.2}
.dh-date svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2.1;stroke-linecap:round;stroke-linejoin:round;color:#334155}
.dh-type{font-size:18px;line-height:1.15;font-weight:950;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dh-status-line{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:13px;font-weight:850;color:#64748b}
.dh-status-line i{width:1px;height:22px;background:#e2e8f0;display:inline-block;margin:0 2px}
.dh-label{color:#64748b;font-weight:900}
.dh-chip{display:inline-flex;align-items:center;justify-content:center;border-radius:999px;padding:5px 11px;font-size:13px;line-height:1;font-weight:950;font-style:normal;white-space:nowrap}
.dh-chip.ok{background:#dcfce7;color:#166534}
.dh-chip.bad{background:#fee2e2;color:#b91c1c}
.dh-chip.wait{background:#fef3c7;color:#b45309}
.dh-detail-btn{height:44px;border:1px solid #bfdbfe;background:#fff;color:#2563eb;border-radius:15px;padding:0 12px;display:inline-flex;align-items:center;gap:6px;font-size:14px;font-weight:950;white-space:nowrap}
.dh-detail-btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.dh-pagination{display:grid;grid-template-columns:1fr 1fr 1fr;align-items:center;background:#fff;border:1px solid #dbe3ef;border-radius:18px;overflow:hidden;box-shadow:0 6px 18px rgba(15,23,42,.04)}
.dh-pagination button{border:0;background:#fff;color:#2563eb;font-weight:950;font-size:15px;min-height:50px}
.dh-pagination button:disabled{color:#94a3b8;background:#f8fafc}
.dh-pagination span{text-align:center;font-weight:950;color:#0f172a;border-left:1px solid #e5eaf3;border-right:1px solid #e5eaf3;min-height:50px;display:grid;place-items:center}
.dh-empty{background:#fff;border:1px dashed #cbd5e1;border-radius:18px;padding:18px;text-align:center;color:#64748b;font-weight:900}
.dh-empty.small{font-size:14px;padding:12px}
.dh-detail-card{background:#fff;border:1px solid #e6ecf5;border-radius:22px;padding:16px;box-shadow:0 8px 24px rgba(15,23,42,.06)}
.dh-detail-card h2{margin:0 0 12px;font-size:18px;font-weight:950;color:#0f172a}
.dh-detail-top{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.dh-detail-top b{display:block;font-size:20px;font-weight:950;color:#0f172a}
.dh-detail-top small{display:block;font-size:14px;font-weight:850;color:#64748b;margin-top:2px}
.dh-detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.dh-detail-grid div{background:#f8fafc;border:1px solid #edf2f7;border-radius:15px;padding:11px;min-width:0}
.dh-detail-grid span{display:block;font-size:12px;color:#64748b;font-weight:900;margin-bottom:4px}
.dh-detail-grid b{display:block;font-size:14px;color:#111827;font-weight:950;line-height:1.35;word-break:break-word}
.dh-photo-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.dh-photo-grid button{border:1px solid #dbe3ef;background:#f8fafc;border-radius:16px;padding:6px;min-width:0;text-align:left;overflow:hidden}
.dh-photo-grid img{width:100%;aspect-ratio:1/1;object-fit:cover;border-radius:12px;background:#e2e8f0;display:block}
.dh-photo-grid span{display:block;margin-top:5px;font-size:11px;font-weight:850;color:#475569;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:480px){
  .dh-head h1{font-size:30px}
  .dh-card{grid-template-columns:54px minmax(0,1fr);gap:11px;padding:13px}
  .dh-icon{width:50px;height:50px}
  .dh-icon svg{width:32px;height:32px}
  .dh-detail-btn{grid-column:2;justify-self:end;margin-top:4px;height:40px}
  .dh-type{font-size:17px}
  .dh-status-line{gap:7px;font-size:12px}
  .dh-chip{font-size:12px;padding:5px 10px}
}
@media(max-width:380px){
  .dh-head h1{font-size:27px}
  .dh-search-card{padding:10px;border-radius:20px}
  .dh-search-box{height:50px}
  .dh-filter-btn{width:50px;height:50px}
  .dh-status-line i{display:none}
  .dh-detail-grid{grid-template-columns:1fr}
  .dh-photo-grid{grid-template-columns:repeat(2,1fr)}
}

/* v161 history detail: inspection list, full-width test photos, signatures */
.dh-photo-full-list{display:flex;flex-direction:column;gap:12px}
.dh-photo-full{width:100%;border:1px solid #dbe3ef;background:#fff;border-radius:18px;padding:8px;text-align:left;overflow:hidden;box-shadow:0 6px 16px rgba(15,23,42,.04)}
.dh-photo-full img{width:100%;max-height:420px;object-fit:contain;border-radius:14px;background:#f1f5f9;display:block}
.dh-photo-full span{display:block;margin-top:7px;font-size:13px;font-weight:900;color:#334155}
.dh-inspection-items{display:flex;flex-direction:column;gap:10px}
.dh-inspection-item{border:1px solid #e5eaf3;background:#f8fafc;border-radius:16px;padding:12px}
.dh-item-main{display:flex;align-items:center;justify-content:space-between;gap:10px}
.dh-item-main b{font-size:15px;font-weight:950;color:#0f172a;line-height:1.25}
.dh-inspection-item p{margin:8px 0 0;color:#64748b;font-size:13px;font-weight:800}
.dh-item-thumbs{display:flex;gap:8px;overflow-x:auto;margin-top:10px;padding-bottom:2px}
.dh-item-thumb{width:82px;min-width:82px;border:1px solid #dbe3ef;background:#fff;border-radius:12px;padding:5px;text-align:left;overflow:hidden}
.dh-item-thumb img{width:70px;height:70px;object-fit:cover;border-radius:9px;background:#e2e8f0;display:block}
.dh-item-thumb span{display:block;margin-top:4px;font-size:10px;font-weight:850;color:#475569;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dh-signature-section{margin-bottom:10px}
.dh-signature-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.dh-signature-grid>div{min-width:0}
.dh-signature-grid b{display:block;margin-bottom:7px;color:#0f172a;font-weight:950}
.dh-signature-photo{width:100%;border:1px solid #dbe3ef;background:#fff;border-radius:16px;padding:7px;text-align:left;overflow:hidden}
.dh-signature-photo img{width:100%;height:110px;object-fit:contain;border-radius:12px;background:#f8fafc;display:block}
.dh-signature-photo span{display:block;margin-top:5px;font-size:11px;font-weight:850;color:#475569;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:420px){
  .dh-signature-grid{grid-template-columns:1fr}
  .dh-photo-full img{max-height:330px}
}



/* v171: history detail image ratio fix */
.driver-history-detail img,
.history-detail img,
.history-photo-full,
.history-detail-photo,
.driver-history-photo,
.dh-photo{
  width:100%!important;
  height:auto!important;
  max-height:none!important;
  object-fit:contain!important;
  object-position:center center!important;
  aspect-ratio:auto!important;
  border-radius:16px!important;
  background:#f8fafc!important;
}

.driver-history-detail .thumb img,
.history-detail .thumb img,
.inspection-thumb img,
.history-thumb img{
  width:72px!important;
  height:72px!important;
  object-fit:contain!important;
  object-position:center center!important;
  background:#f8fafc!important;
}



/* v171 History Detail Image Ratio Fix
   Requirement: ประวัติ > ดูรายละเอียด รูปต้องไม่ถูกบีบ ไม่ crop และแสดงเต็มสัดส่วนเดิม */
body:not(.admin-body) .driver-history-detail .dh-photo-wrap,
body:not(.admin-body) .history-detail .dh-photo-wrap,
body:not(.admin-body) .driver-history-detail .photo-wrap,
body:not(.admin-body) .history-detail .photo-wrap,
body:not(.admin-body) .driver-history-detail .signature-box,
body:not(.admin-body) .history-detail .signature-box{
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  overflow:visible!important;
  display:block!important;
  padding:0!important;
  background:#ffffff!important;
}

body:not(.admin-body) .driver-history-detail .dh-detail-img,
body:not(.admin-body) .history-detail .dh-detail-img,
body:not(.admin-body) .driver-history-detail img.dh-photo,
body:not(.admin-body) .history-detail img.dh-photo,
body:not(.admin-body) .driver-history-detail img.history-photo-full,
body:not(.admin-body) .history-detail img.history-photo-full,
body:not(.admin-body) .driver-history-detail img.history-detail-photo,
body:not(.admin-body) .history-detail img.history-detail-photo,
body:not(.admin-body) .driver-history-detail img.driver-history-photo,
body:not(.admin-body) .history-detail img.driver-history-photo,
body:not(.admin-body) .driver-history-detail img.dh-signature-img,
body:not(.admin-body) .history-detail img.dh-signature-img,
body:not(.admin-body) .driver-history-detail .signature-card img,
body:not(.admin-body) .history-detail .signature-card img{
  display:block!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  aspect-ratio:auto!important;
  object-fit:contain!important;
  object-position:center center!important;
  border-radius:16px!important;
  background:#f8fafc!important;
  border:1px solid #e2e8f0!important;
  box-sizing:border-box!important;
}

/* Full-width photo rows for alcohol / amphetamine details */
body:not(.admin-body) .driver-history-detail .dh-photo-full,
body:not(.admin-body) .history-detail .dh-photo-full,
body:not(.admin-body) .driver-history-detail .history-photo-row,
body:not(.admin-body) .history-detail .history-photo-row{
  width:100%!important;
  height:auto!important;
  overflow:visible!important;
  display:block!important;
}

/* Vehicle inspection item thumbnails: keep compact but not distorted/cropped */
body:not(.admin-body) .driver-history-detail .dh-thumb,
body:not(.admin-body) .history-detail .dh-thumb,
body:not(.admin-body) .driver-history-detail .inspection-thumb,
body:not(.admin-body) .history-detail .inspection-thumb,
body:not(.admin-body) .driver-history-detail .history-thumb,
body:not(.admin-body) .history-detail .history-thumb{
  width:88px!important;
  height:auto!important;
  min-height:64px!important;
  max-height:none!important;
  overflow:visible!important;
  background:#ffffff!important;
}

body:not(.admin-body) .driver-history-detail .dh-thumb img,
body:not(.admin-body) .history-detail .dh-thumb img,
body:not(.admin-body) .driver-history-detail .inspection-thumb img,
body:not(.admin-body) .history-detail .inspection-thumb img,
body:not(.admin-body) .driver-history-detail .history-thumb img,
body:not(.admin-body) .history-detail .history-thumb img,
body:not(.admin-body) .driver-history-detail img.dh-thumb-img,
body:not(.admin-body) .history-detail img.dh-thumb-img{
  display:block!important;
  width:88px!important;
  height:auto!important;
  min-height:64px!important;
  max-height:120px!important;
  aspect-ratio:auto!important;
  object-fit:contain!important;
  object-position:center center!important;
  border-radius:12px!important;
  background:#f8fafc!important;
  border:1px solid #e2e8f0!important;
}

/* Prevent parent rows from forcing image strip height */
body:not(.admin-body) .driver-history-detail .photo-list,
body:not(.admin-body) .history-detail .photo-list,
body:not(.admin-body) .driver-history-detail .dh-photo-list,
body:not(.admin-body) .history-detail .dh-photo-list{
  display:flex!important;
  flex-direction:column!important;
  gap:12px!important;
  width:100%!important;
  height:auto!important;
  overflow:visible!important;
}

body:not(.admin-body) .driver-history-detail .inspection-item-row,
body:not(.admin-body) .history-detail .inspection-item-row,
body:not(.admin-body) .driver-history-detail .vehicle-item-row,
body:not(.admin-body) .history-detail .vehicle-item-row{
  height:auto!important;
  min-height:72px!important;
  overflow:visible!important;
  align-items:flex-start!important;
}



/* v171 REAL history detail image render fix
   Target actual classes generated by driver-history.js:
   - dh-photo-full
   - dh-signature-photo
   - dh-item-thumb
   - dh-render-full / dh-render-thumb
*/
body:not(.admin-body) .dh-photo-full-list{
  width:100%!important;
  display:flex!important;
  flex-direction:column!important;
  gap:14px!important;
  height:auto!important;
  overflow:visible!important;
}

body:not(.admin-body) button.dh-photo-full,
body:not(.admin-body) button.dh-signature-photo,
body:not(.admin-body) button.dh-render-full{
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  justify-content:flex-start!important;
  gap:8px!important;
  padding:10px!important;
  overflow:visible!important;
  border:1px solid #dbe3ef!important;
  border-radius:18px!important;
  background:#fff!important;
  box-sizing:border-box!important;
  text-align:left!important;
}

body:not(.admin-body) button.dh-photo-full img,
body:not(.admin-body) button.dh-signature-photo img,
body:not(.admin-body) button.dh-render-full img,
body:not(.admin-body) img.dh-render-full-img{
  display:block!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  aspect-ratio:auto!important;
  object-fit:contain!important;
  object-position:center center!important;
  border-radius:14px!important;
  background:#f8fafc!important;
  border:1px solid #e2e8f0!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) button.dh-photo-full span,
body:not(.admin-body) button.dh-signature-photo span,
body:not(.admin-body) button.dh-render-full span{
  display:block!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  padding:4px 2px 0!important;
  color:#334155!important;
  font-size:13px!important;
  line-height:1.25!important;
  font-weight:850!important;
  text-align:left!important;
  white-space:normal!important;
}

/* Signatures must not be shown as thin cropped strips */
body:not(.admin-body) .dh-signature-grid{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:16px!important;
}

body:not(.admin-body) .dh-signature-grid > div{
  width:100%!important;
  min-width:0!important;
  overflow:visible!important;
}

/* Inspection item thumbnails: compact but keep original ratio */
body:not(.admin-body) .dh-item-thumbs{
  display:flex!important;
  flex-wrap:wrap!important;
  align-items:flex-start!important;
  gap:8px!important;
  width:100%!important;
  height:auto!important;
  overflow:visible!important;
  margin-top:8px!important;
}

body:not(.admin-body) button.dh-item-thumb,
body:not(.admin-body) button.dh-render-thumb{
  width:96px!important;
  height:auto!important;
  min-height:72px!important;
  max-height:none!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  justify-content:flex-start!important;
  gap:4px!important;
  padding:6px!important;
  overflow:visible!important;
  border:1px solid #dbe3ef!important;
  border-radius:14px!important;
  background:#fff!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) button.dh-item-thumb img,
body:not(.admin-body) button.dh-render-thumb img,
body:not(.admin-body) img.dh-render-thumb-img{
  display:block!important;
  width:100%!important;
  height:auto!important;
  min-height:54px!important;
  max-height:110px!important;
  aspect-ratio:auto!important;
  object-fit:contain!important;
  object-position:center center!important;
  border-radius:10px!important;
  background:#f8fafc!important;
  border:1px solid #e2e8f0!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) button.dh-item-thumb span,
body:not(.admin-body) button.dh-render-thumb span{
  display:block!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  padding:2px 0 0!important;
  color:#334155!important;
  font-size:10px!important;
  line-height:1.15!important;
  font-weight:800!important;
  text-align:center!important;
  white-space:normal!important;
}

/* Avoid old fixed strip layouts from previous versions */
body:not(.admin-body) .dh-detail-card,
body:not(.admin-body) .dh-inspection-item{
  overflow:visible!important;
  height:auto!important;
  max-height:none!important;
}

body:not(.admin-body) .dh-inspection-item{
  align-items:flex-start!important;
}



/* v171 history detail photo clean + pass criteria */
body:not(.admin-body) button.dh-photo-full,
body:not(.admin-body) button.dh-signature-photo,
body:not(.admin-body) button.dh-render-full{
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  overflow:visible!important;
  gap:0!important;
}

body:not(.admin-body) button.dh-photo-full img,
body:not(.admin-body) button.dh-signature-photo img,
body:not(.admin-body) button.dh-render-full img,
body:not(.admin-body) img.dh-render-full-img{
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
}

body:not(.admin-body) button.dh-photo-full span,
body:not(.admin-body) button.dh-signature-photo span,
body:not(.admin-body) button.dh-render-full span,
body:not(.admin-body) button.dh-item-thumb span,
body:not(.admin-body) button.dh-render-thumb span{
  display:none!important;
}

body:not(.admin-body) button.dh-item-thumb,
body:not(.admin-body) button.dh-render-thumb{
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  padding:0!important;
  border-radius:0!important;
}

body:not(.admin-body) button.dh-item-thumb img,
body:not(.admin-body) button.dh-render-thumb img,
body:not(.admin-body) img.dh-render-thumb-img{
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  border-radius:8px!important;
}

body:not(.admin-body) .dh-pass-criteria{
  display:block!important;
  margin-top:6px!important;
  color:#64748b!important;
  font-size:12px!important;
  line-height:1.35!important;
  font-weight:800!important;
}

body:not(.admin-body) .dh-pass-criteria strong{
  color:#334155!important;
  font-weight:950!important;
}

body:not(.admin-body) .dh-item-main{
  display:flex!important;
  flex-direction:column!important;
  gap:4px!important;
}



/* v171 History inspection item alignment
   Requirement: หัวข้อและเกณฑ์ผ่านชิดซ้าย / ผ่าน-ไม่ผ่านชิดขวา */
body:not(.admin-body) .driver-history-detail .dh-inspection-item,
body:not(.admin-body) .history-detail .dh-inspection-item,
body:not(.admin-body) .dh-inspection-item{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  grid-template-areas:
    "main status"
    "photos photos"
    "note note"!important;
  align-items:start!important;
  column-gap:12px!important;
  row-gap:10px!important;
  text-align:left!important;
}

body:not(.admin-body) .driver-history-detail .dh-inspection-item .dh-item-main,
body:not(.admin-body) .history-detail .dh-inspection-item .dh-item-main,
body:not(.admin-body) .dh-inspection-item .dh-item-main{
  grid-area:main!important;
  min-width:0!important;
  width:100%!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
  text-align:left!important;
  gap:5px!important;
}

body:not(.admin-body) .driver-history-detail .dh-inspection-item .dh-item-main > b,
body:not(.admin-body) .history-detail .dh-inspection-item .dh-item-main > b,
body:not(.admin-body) .dh-inspection-item .dh-item-main > b{
  display:block!important;
  width:100%!important;
  text-align:left!important;
  margin:0!important;
  color:#111827!important;
  font-size:17px!important;
  line-height:1.25!important;
  font-weight:950!important;
}

body:not(.admin-body) .driver-history-detail .dh-inspection-item .dh-pass-criteria,
body:not(.admin-body) .history-detail .dh-inspection-item .dh-pass-criteria,
body:not(.admin-body) .dh-inspection-item .dh-pass-criteria{
  display:block!important;
  width:100%!important;
  text-align:left!important;
  margin:0!important;
  color:#64748b!important;
  font-size:12px!important;
  line-height:1.35!important;
  font-weight:800!important;
}

body:not(.admin-body) .driver-history-detail .dh-inspection-item .dh-pass-criteria strong,
body:not(.admin-body) .history-detail .dh-inspection-item .dh-pass-criteria strong,
body:not(.admin-body) .dh-inspection-item .dh-pass-criteria strong{
  color:#334155!important;
  font-weight:950!important;
}

body:not(.admin-body) .driver-history-detail .dh-inspection-item .dh-chip,
body:not(.admin-body) .history-detail .dh-inspection-item .dh-chip,
body:not(.admin-body) .dh-inspection-item .dh-chip{
  grid-area:status!important;
  justify-self:end!important;
  align-self:start!important;
  margin:0!important;
  min-width:72px!important;
  height:44px!important;
  padding:0 14px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  text-align:center!important;
  border-radius:16px!important;
  font-size:15px!important;
  font-weight:950!important;
  white-space:nowrap!important;
}

body:not(.admin-body) .driver-history-detail .dh-inspection-item .dh-item-thumbs,
body:not(.admin-body) .history-detail .dh-inspection-item .dh-item-thumbs,
body:not(.admin-body) .dh-inspection-item .dh-item-thumbs{
  grid-area:photos!important;
  justify-self:start!important;
  width:100%!important;
  margin-top:2px!important;
}

body:not(.admin-body) .driver-history-detail .dh-inspection-item > p,
body:not(.admin-body) .history-detail .dh-inspection-item > p,
body:not(.admin-body) .dh-inspection-item > p{
  grid-area:note!important;
  text-align:left!important;
  margin:0!important;
}

@media(max-width:430px){
  body:not(.admin-body) .driver-history-detail .dh-inspection-item,
  body:not(.admin-body) .history-detail .dh-inspection-item,
  body:not(.admin-body) .dh-inspection-item{
    grid-template-columns:minmax(0,1fr) auto!important;
    column-gap:10px!important;
  }
  body:not(.admin-body) .driver-history-detail .dh-inspection-item .dh-item-main > b,
  body:not(.admin-body) .history-detail .dh-inspection-item .dh-item-main > b,
  body:not(.admin-body) .dh-inspection-item .dh-item-main > b{
    font-size:16px!important;
  }
  body:not(.admin-body) .driver-history-detail .dh-inspection-item .dh-chip,
  body:not(.admin-body) .history-detail .dh-inspection-item .dh-chip,
  body:not(.admin-body) .dh-inspection-item .dh-chip{
    min-width:64px!important;
    height:40px!important;
    border-radius:14px!important;
    font-size:14px!important;
    padding:0 12px!important;
  }
}



/* v171 History test photos thumbnail view
   Requirement: รูปประกอบแอลกอฮอล์/แอมเฟตามีน ให้เป็นรูปย่อขนาดเดียวกับตรวจรถ */
body:not(.admin-body) .dh-test-photo-thumbs{
  display:flex!important;
  flex-wrap:wrap!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
  gap:8px!important;
  width:100%!important;
  height:auto!important;
  overflow:visible!important;
  margin-top:8px!important;
}

body:not(.admin-body) button.dh-test-thumb,
body:not(.admin-body) .dh-test-photo-thumbs button.dh-item-thumb,
body:not(.admin-body) .dh-test-photo-thumbs button.dh-render-thumb{
  width:96px!important;
  height:auto!important;
  min-height:72px!important;
  max-height:none!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  justify-content:flex-start!important;
  padding:0!important;
  overflow:visible!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
}

body:not(.admin-body) button.dh-test-thumb img,
body:not(.admin-body) .dh-test-photo-thumbs button.dh-item-thumb img,
body:not(.admin-body) .dh-test-photo-thumbs button.dh-render-thumb img{
  display:block!important;
  width:96px!important;
  height:auto!important;
  min-height:54px!important;
  max-height:120px!important;
  aspect-ratio:auto!important;
  object-fit:contain!important;
  object-position:center center!important;
  border:0!important;
  border-radius:8px!important;
  background:transparent!important;
  box-shadow:none!important;
}

body:not(.admin-body) button.dh-test-thumb span,
body:not(.admin-body) .dh-test-photo-thumbs button span{
  display:none!important;
}



/* v171 History detail signature fit
   Requirement: รูปลายเซ็นไม่ล้นกรอบ และแสดงเต็มกรอบตามสัดส่วนจริง */
body:not(.admin-body) .dh-signature-fit-v171,
body:not(.admin-body) .dh-signature-section{
  overflow:hidden!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) .dh-signature-grid{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:16px!important;
  width:100%!important;
  max-width:100%!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) .dh-signature-grid > div{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) button.dh-signature-photo,
body:not(.admin-body) button.dh-render-signature{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  display:block!important;
  overflow:hidden!important;
  padding:0!important;
  margin:8px 0 0 0!important;
  border:0!important;
  border-radius:12px!important;
  background:transparent!important;
  box-shadow:none!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) button.dh-signature-photo img,
body:not(.admin-body) button.dh-render-signature img,
body:not(.admin-body) .dh-signature-section img,
body:not(.admin-body) .dh-signature-grid img{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  aspect-ratio:auto!important;
  object-fit:contain!important;
  object-position:center center!important;
  margin:0!important;
  border:0!important;
  border-radius:12px!important;
  background:#fff!important;
  box-shadow:none!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) .dh-signature-grid b{
  display:block!important;
  margin:0 0 6px!important;
  color:#111827!important;
  font-size:16px!important;
  line-height:1.25!important;
  font-weight:950!important;
  text-align:left!important;
}

/* Prevent any old button/span layout from pushing signature outside */
body:not(.admin-body) button.dh-render-signature span,
body:not(.admin-body) button.dh-signature-photo span{
  display:none!important;
}

/* Mobile safe: never let signature content exceed viewport/card width */
@media(max-width:520px){
  body:not(.admin-body) .dh-signature-section,
  body:not(.admin-body) .dh-signature-fit-v171{
    padding-left:14px!important;
    padding-right:14px!important;
  }
  body:not(.admin-body) .dh-signature-grid,
  body:not(.admin-body) .dh-signature-grid > div,
  body:not(.admin-body) button.dh-signature-photo,
  body:not(.admin-body) button.dh-render-signature,
  body:not(.admin-body) .dh-signature-section img{
    width:100%!important;
    max-width:100%!important;
  }
}



/* v176 unified icon theme: MENU icons and CONTENT icons are separated */

/* MENU: bottom navigation only */
body:not(.admin-body) .bottom-nav.circular-bottom-nav-v176{
  position:fixed!important;
  left:0!important;
  right:0!important;
  bottom:0!important;
  width:100vw!important;
  max-width:none!important;
  transform:none!important;
  margin:0!important;
  display:grid!important;
  grid-template-columns:repeat(5,minmax(0,1fr))!important;
  gap:0!important;
  padding:8px 6px calc(8px + env(safe-area-inset-bottom,0px))!important;
  background:#fff!important;
  border:0!important;
  border-top:1px solid #dbe3ef!important;
  border-radius:0!important;
  box-shadow:0 -8px 26px rgba(15,23,42,.12)!important;
  z-index:9999!important;
  backdrop-filter:none!important;
  -webkit-backdrop-filter:none!important;
}
body:not(.admin-body) .bottom-nav.circular-bottom-nav-v176 .nav-btn{
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  min-height:58px!important;
  padding:6px 2px!important;
  border:0!important;
  border-radius:14px!important;
  background:transparent!important;
  color:#111827!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:center!important;
  justify-content:center!important;
  gap:3px!important;
  box-shadow:none!important;
  overflow:hidden!important;
}
body:not(.admin-body) .bottom-nav.circular-bottom-nav-v176 .nav-btn span{
  width:24px!important;
  height:24px!important;
  display:grid!important;
  place-items:center!important;
  font-size:0!important;
  line-height:1!important;
}
body:not(.admin-body) .bottom-nav.circular-bottom-nav-v176 .nav-btn svg{
  width:24px!important;
  height:24px!important;
  fill:none!important;
  stroke:currentColor!important;
  stroke-width:1.9!important;
  stroke-linecap:round!important;
  stroke-linejoin:round!important;
  display:block!important;
}
body:not(.admin-body) .bottom-nav.circular-bottom-nav-v176 .nav-btn b{
  display:block!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  font-size:11px!important;
  line-height:1.1!important;
  font-weight:850!important;
  color:currentColor!important;
}
body:not(.admin-body) .bottom-nav.circular-bottom-nav-v176 .nav-btn.active{
  background:#eaf2ff!important;
  color:#2563eb!important;
}

/* CONTENT: dashboard/form/history cards only */
body:not(.admin-body) .line-icon,
body:not(.admin-body) .dh-icon,
body:not(.admin-body) .form-card-icon,
body:not(.admin-body) .action-icon.line-icon{
  width:58px!important;
  height:58px!important;
  min-width:58px!important;
  border-radius:50%!important;
  display:grid!important;
  place-items:center!important;
  font-size:0!important;
  flex:0 0 auto!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
}
body:not(.admin-body) .line-icon svg,
body:not(.admin-body) .dh-icon svg,
body:not(.admin-body) .form-card-icon svg,
body:not(.admin-body) .action-icon.line-icon svg{
  width:34px!important;
  height:34px!important;
  fill:none!important;
  stroke:currentColor!important;
  stroke-width:2.4!important;
  stroke-linecap:round!important;
  stroke-linejoin:round!important;
  display:block!important;
}
body:not(.admin-body) .line-icon.truck,
body:not(.admin-body) .dh-icon-truck,
body:not(.admin-body) .form-card-icon.truck{
  color:#2563eb!important;
  background:#eff6ff!important;
  border:1px solid #dbeafe!important;
}
body:not(.admin-body) .line-icon.tube,
body:not(.admin-body) .dh-icon-tube,
body:not(.admin-body) .form-card-icon.tube{
  color:#059669!important;
  background:#ecfdf5!important;
  border:1px solid #bbf7d0!important;
}
body:not(.admin-body) .line-icon.microscope,
body:not(.admin-body) .dh-icon-microscope,
body:not(.admin-body) .form-card-icon.microscope{
  color:#e11d48!important;
  background:#fff1f2!important;
  border:1px solid #fecdd3!important;
}

/* Dashboard "งานหลักวันนี้" card buttons */
body:not(.admin-body) .dashboard-start-grid{
  display:flex!important;
  flex-direction:column!important;
  gap:12px!important;
}
body:not(.admin-body) .dashboard-start-btn{
  width:100%!important;
  display:grid!important;
  grid-template-columns:74px minmax(0,1fr) auto!important;
  align-items:center!important;
  gap:14px!important;
  min-height:82px!important;
  padding:12px 16px!important;
  border:1px solid #dbe3ef!important;
  border-radius:24px!important;
  background:#fff!important;
  color:#111827!important;
  text-align:left!important;
  box-shadow:0 8px 22px rgba(15,23,42,.06)!important;
}
body:not(.admin-body) .dashboard-start-btn .action-copy{
  min-width:0!important;
  display:block!important;
  text-align:left!important;
}
body:not(.admin-body) .dashboard-start-btn .action-copy b{
  display:block!important;
  font-size:18px!important;
  line-height:1.2!important;
  font-weight:950!important;
  color:#111827!important;
  white-space:normal!important;
  overflow:visible!important;
}
body:not(.admin-body) .dashboard-start-btn .action-copy small{
  display:block!important;
  margin-top:4px!important;
  color:#64748b!important;
  font-size:12px!important;
  line-height:1.25!important;
  font-weight:750!important;
}
body:not(.admin-body) .dashboard-start-btn em{
  justify-self:end!important;
  align-self:center!important;
  font-style:normal!important;
  color:#64748b!important;
  font-size:0!important;
}
body:not(.admin-body) .dashboard-start-btn em::after{
  content:'›';
  font-size:30px!important;
  line-height:1!important;
  font-weight:400!important;
  color:#111827!important;
}

/* Form menu cards */
body:not(.admin-body) .app-form-card{
  display:grid!important;
  grid-template-columns:74px minmax(0,1fr) auto!important;
  gap:14px!important;
  align-items:center!important;
  min-height:82px!important;
  padding:12px 16px!important;
  border-radius:24px!important;
}
body:not(.admin-body) .app-form-card .form-card-icon{
  width:58px!important;
  height:58px!important;
  min-width:58px!important;
  border-radius:50%!important;
}

/* History list cards */
body:not(.admin-body) .dh-card{
  display:grid!important;
  grid-template-columns:74px minmax(0,1fr) auto!important;
  gap:14px!important;
  align-items:center!important;
}
body:not(.admin-body) .dh-card .dh-icon{
  align-self:center!important;
}

/* Bottom spacing for edge-to-edge menu */
body:not(.admin-body) .has-bottom-nav,
.has-bottom-nav{
  padding-bottom:calc(94px + env(safe-area-inset-bottom,0px))!important;
}

@media(max-width:430px){
  body:not(.admin-body) .dashboard-start-btn,
  body:not(.admin-body) .app-form-card,
  body:not(.admin-body) .dh-card{
    grid-template-columns:66px minmax(0,1fr) auto!important;
    gap:12px!important;
  }
  body:not(.admin-body) .line-icon,
  body:not(.admin-body) .dh-icon,
  body:not(.admin-body) .form-card-icon,
  body:not(.admin-body) .action-icon.line-icon{
    width:54px!important;
    height:54px!important;
    min-width:54px!important;
  }
  body:not(.admin-body) .line-icon svg,
  body:not(.admin-body) .dh-icon svg,
  body:not(.admin-body) .form-card-icon svg,
  body:not(.admin-body) .action-icon.line-icon svg{
    width:31px!important;
    height:31px!important;
  }
}



/* v176 content icons REAL fix */
body:not(.admin-body) .content-icon,
body:not(.admin-body) .dashboard-start-btn .action-icon.content-icon,
body:not(.admin-body) .app-form-card .form-card-icon.content-icon,
body:not(.admin-body) .dh-card .dh-icon.content-icon,
body:not(.admin-body) .dh-detail-top .dh-icon.content-icon{
  width:58px!important;height:58px!important;min-width:58px!important;max-width:58px!important;
  border-radius:50%!important;display:grid!important;place-items:center!important;
  overflow:hidden!important;font-size:0!important;box-sizing:border-box!important;flex:0 0 58px!important;padding:0!important;
}
body:not(.admin-body) .content-icon svg,
body:not(.admin-body) .dashboard-start-btn .action-icon.content-icon svg,
body:not(.admin-body) .app-form-card .form-card-icon.content-icon svg,
body:not(.admin-body) .dh-card .dh-icon.content-icon svg,
body:not(.admin-body) .dh-detail-top .dh-icon.content-icon svg{
  width:34px!important;height:34px!important;fill:none!important;stroke:currentColor!important;
  stroke-width:2.35!important;stroke-linecap:round!important;stroke-linejoin:round!important;display:block!important;
}
body:not(.admin-body) .content-icon.truck,
body:not(.admin-body) .content-icon.dh-icon-truck,
body:not(.admin-body) .dh-icon-truck.content-icon,
body:not(.admin-body) .form-card-icon.truck,
body:not(.admin-body) .action-icon.truck{
  color:#2563eb!important;background:#eff6ff!important;border:1px solid #dbeafe!important;
}
body:not(.admin-body) .content-icon.tube,
body:not(.admin-body) .content-icon.dh-icon-tube,
body:not(.admin-body) .dh-icon-tube.content-icon,
body:not(.admin-body) .form-card-icon.tube,
body:not(.admin-body) .action-icon.tube{
  color:#059669!important;background:#ecfdf5!important;border:1px solid #bbf7d0!important;
}
body:not(.admin-body) .content-icon.microscope,
body:not(.admin-body) .content-icon.dh-icon-microscope,
body:not(.admin-body) .dh-icon-microscope.content-icon,
body:not(.admin-body) .form-card-icon.microscope,
body:not(.admin-body) .action-icon.microscope{
  color:#e11d48!important;background:#fff1f2!important;border:1px solid #fecdd3!important;
}
body:not(.admin-body) .app-form-list{display:flex!important;flex-direction:column!important;gap:12px!important;}
body:not(.admin-body) .dashboard-start-btn,
body:not(.admin-body) .app-form-card,
body:not(.admin-body) .dh-card{
  display:grid!important;grid-template-columns:72px minmax(0,1fr) auto!important;gap:14px!important;align-items:center!important;
}
body:not(.admin-body) .app-form-card,
body:not(.admin-body) .dashboard-start-btn{
  min-height:82px!important;padding:12px 16px!important;border-radius:24px!important;border:1px solid #dbe3ef!important;background:#fff!important;
}
body:not(.admin-body) .form-card-copy,
body:not(.admin-body) .dashboard-start-btn .action-copy{display:block!important;text-align:left!important;min-width:0!important;}
body:not(.admin-body) .form-card-copy b,
body:not(.admin-body) .dashboard-start-btn .action-copy b{display:block!important;font-size:18px!important;line-height:1.22!important;font-weight:950!important;color:#111827!important;white-space:normal!important;}
body:not(.admin-body) .form-card-copy small,
body:not(.admin-body) .dashboard-start-btn .action-copy small{display:block!important;margin-top:4px!important;color:#64748b!important;font-size:12px!important;line-height:1.25!important;font-weight:750!important;}
body:not(.admin-body) .app-form-card em,
body:not(.admin-body) .dashboard-start-btn em{justify-self:end!important;align-self:center!important;font-style:normal!important;font-size:30px!important;line-height:1!important;color:#111827!important;}
body:not(.admin-body) .bottom-nav .content-icon{width:24px!important;height:24px!important;min-width:24px!important;border-radius:0!important;background:transparent!important;border:0!important;}
@media(max-width:430px){
  body:not(.admin-body) .content-icon,
  body:not(.admin-body) .dashboard-start-btn .action-icon.content-icon,
  body:not(.admin-body) .app-form-card .form-card-icon.content-icon,
  body:not(.admin-body) .dh-card .dh-icon.content-icon{
    width:54px!important;height:54px!important;min-width:54px!important;max-width:54px!important;flex-basis:54px!important;
  }
  body:not(.admin-body) .content-icon svg,
  body:not(.admin-body) .dashboard-start-btn .action-icon.content-icon svg,
  body:not(.admin-body) .app-form-card .form-card-icon.content-icon svg,
  body:not(.admin-body) .dh-card .dh-icon.content-icon svg{width:31px!important;height:31px!important;}
  body:not(.admin-body) .dashboard-start-btn,
  body:not(.admin-body) .app-form-card,
  body:not(.admin-body) .dh-card{grid-template-columns:66px minmax(0,1fr) auto!important;gap:12px!important;}
}



/* v240 compact layout fix for uploaded icon set
   Goal: match Screen 1 proportions, avoid huge/overflow content cards. */

/* Global content icon size: compact and stable */
body:not(.admin-body) .circular-content-icon,
body:not(.admin-body) .content-icon,
body:not(.admin-body) .form-card-icon.circular-content-icon,
body:not(.admin-body) .action-icon.circular-content-icon,
body:not(.admin-body) .dh-icon.circular-content-icon{
  width:52px!important;
  height:52px!important;
  min-width:52px!important;
  max-width:52px!important;
  flex:0 0 52px!important;
  border-radius:18px!important;
  display:grid!important;
  place-items:center!important;
  padding:0!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) .circular-content-icon .circular-content-icon-img,
body:not(.admin-body) .content-icon .circular-content-icon-img,
body:not(.admin-body) .form-card-icon .circular-content-icon-img,
body:not(.admin-body) .action-icon .circular-content-icon-img,
body:not(.admin-body) .dh-icon .circular-content-icon-img,
body:not(.admin-body) .circular-content-icon-img{
  width:30px!important;
  height:30px!important;
  max-width:30px!important;
  max-height:30px!important;
  display:block!important;
  object-fit:contain!important;
}

/* Dashboard and form menu cards: no overflow to the right */
body:not(.admin-body) .dashboard-start-grid,
body:not(.admin-body) .app-form-list{
  display:flex!important;
  flex-direction:column!important;
  gap:10px!important;
  width:100%!important;
  max-width:100%!important;
  overflow:hidden!important;
}

body:not(.admin-body) .dashboard-start-btn,
body:not(.admin-body) .app-form-card{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  min-height:72px!important;
  height:auto!important;
  display:grid!important;
  grid-template-columns:60px minmax(0,1fr) auto!important;
  gap:12px!important;
  align-items:center!important;
  padding:10px 12px!important;
  border-radius:20px!important;
  border:1px solid #dbe3ef!important;
  background:#fff!important;
  box-shadow:0 6px 18px rgba(15,23,42,.055)!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
  text-align:left!important;
}

/* Text must stay inside card */
body:not(.admin-body) .dashboard-start-btn .action-copy,
body:not(.admin-body) .app-form-card .form-card-copy{
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-align:left!important;
  display:block!important;
}

body:not(.admin-body) .dashboard-start-btn .action-copy b,
body:not(.admin-body) .app-form-card .form-card-copy b{
  display:block!important;
  margin:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  font-size:17px!important;
  line-height:1.22!important;
  font-weight:950!important;
  color:#111827!important;
}

body:not(.admin-body) .dashboard-start-btn .action-copy small,
body:not(.admin-body) .app-form-card .form-card-copy small{
  display:block!important;
  margin-top:3px!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  font-size:11px!important;
  line-height:1.22!important;
  font-weight:750!important;
  color:#64748b!important;
}

/* Start pill / arrow: keep compact, not huge */
body:not(.admin-body) .dashboard-start-btn .start-pill,
body:not(.admin-body) .dashboard-start-btn em,
body:not(.admin-body) .app-form-card em{
  justify-self:end!important;
  align-self:center!important;
  min-width:42px!important;
  max-width:62px!important;
  height:36px!important;
  padding:0 11px!important;
  border-radius:999px!important;
  background:#eaf2ff!important;
  color:#2563eb!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  font-size:13px!important;
  line-height:1!important;
  font-weight:950!important;
  font-style:normal!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:clip!important;
  box-sizing:border-box!important;
}

/* If old CSS created a huge pseudo arrow, suppress it in dashboard/form cards */
body:not(.admin-body) .dashboard-start-btn em::after,
body:not(.admin-body) .app-form-card em::after{
  content:none!important;
  display:none!important;
}

/* If arrow-only is wanted on form menu, keep a small › from actual text */
body:not(.admin-body) .app-form-card em{
  background:transparent!important;
  color:#111827!important;
  min-width:20px!important;
  max-width:24px!important;
  width:24px!important;
  height:32px!important;
  padding:0!important;
  font-size:28px!important;
  font-weight:700!important;
}

/* History list cards like Screen 1: icon column compact */
body:not(.admin-body) .dh-card{
  width:100%!important;
  max-width:100%!important;
  display:grid!important;
  grid-template-columns:60px minmax(0,1fr) auto!important;
  gap:12px!important;
  align-items:center!important;
  overflow:hidden!important;
}

body:not(.admin-body) .dh-card .dh-icon.circular-content-icon{
  width:52px!important;
  height:52px!important;
  min-width:52px!important;
  max-width:52px!important;
  border-radius:18px!important;
}

/* Search/filter icons should remain UI icons, not big content cards */
body:not(.admin-body) .dh-search-icon,
body:not(.admin-body) .dh-filter-icon,
body:not(.admin-body) .search-icon,
body:not(.admin-body) .filter-icon{
  width:24px!important;
  height:24px!important;
}

/* Mobile exact tuning */
@media(max-width:430px){
  body:not(.admin-body) .circular-content-icon,
  body:not(.admin-body) .content-icon,
  body:not(.admin-body) .form-card-icon.circular-content-icon,
  body:not(.admin-body) .action-icon.circular-content-icon,
  body:not(.admin-body) .dh-icon.circular-content-icon{
    width:50px!important;
    height:50px!important;
    min-width:50px!important;
    max-width:50px!important;
    flex-basis:50px!important;
    border-radius:17px!important;
  }

  body:not(.admin-body) .circular-content-icon .circular-content-icon-img,
  body:not(.admin-body) .content-icon .circular-content-icon-img,
  body:not(.admin-body) .form-card-icon .circular-content-icon-img,
  body:not(.admin-body) .action-icon .circular-content-icon-img,
  body:not(.admin-body) .dh-icon .circular-content-icon-img,
  body:not(.admin-body) .circular-content-icon-img{
    width:28px!important;
    height:28px!important;
    max-width:28px!important;
    max-height:28px!important;
  }

  body:not(.admin-body) .dashboard-start-btn,
  body:not(.admin-body) .app-form-card{
    grid-template-columns:58px minmax(0,1fr) auto!important;
    gap:10px!important;
    min-height:70px!important;
    padding:9px 10px!important;
    border-radius:19px!important;
  }

  body:not(.admin-body) .dashboard-start-btn .action-copy b,
  body:not(.admin-body) .app-form-card .form-card-copy b{
    font-size:16px!important;
  }

  body:not(.admin-body) .dashboard-start-btn .action-copy small,
  body:not(.admin-body) .app-form-card .form-card-copy small{
    font-size:10.5px!important;
  }

  body:not(.admin-body) .dashboard-start-btn .start-pill,
  body:not(.admin-body) .dashboard-start-btn em{
    min-width:40px!important;
    max-width:54px!important;
    height:34px!important;
    padding:0 10px!important;
    font-size:12px!important;
  }
}

@media(max-width:360px){
  body:not(.admin-body) .dashboard-start-btn,
  body:not(.admin-body) .app-form-card{
    grid-template-columns:54px minmax(0,1fr) auto!important;
    gap:8px!important;
    padding:8px!important;
  }
  body:not(.admin-body) .dashboard-start-btn .action-copy b,
  body:not(.admin-body) .app-form-card .form-card-copy b{
    font-size:15px!important;
  }
}



/* v240 content icon no-frame + no-overflow
   Requirement:
   - Content icons: no circle / no frame
   - Show icon only
   - Dashboard word "เริ่ม" removed in JS
   - Text must fit card; same content group uses same font sizing
   - No overflow
*/

/* Content icon: icon only, no background, no border, no circle */
body:not(.admin-body) .circular-content-icon,
body:not(.admin-body) .content-icon,
body:not(.admin-body) .form-card-icon.circular-content-icon,
body:not(.admin-body) .action-icon.circular-content-icon,
body:not(.admin-body) .dh-icon.circular-content-icon{
  width:44px!important;
  height:44px!important;
  min-width:44px!important;
  max-width:44px!important;
  flex:0 0 44px!important;
  border-radius:0!important;
  display:grid!important;
  place-items:center!important;
  padding:0!important;
  margin:0!important;
  overflow:visible!important;
  box-sizing:border-box!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
}

body:not(.admin-body) .circular-content-icon .circular-content-icon-img,
body:not(.admin-body) .content-icon .circular-content-icon-img,
body:not(.admin-body) .form-card-icon .circular-content-icon-img,
body:not(.admin-body) .action-icon .circular-content-icon-img,
body:not(.admin-body) .dh-icon .circular-content-icon-img,
body:not(.admin-body) .circular-content-icon-img{
  width:34px!important;
  height:34px!important;
  max-width:34px!important;
  max-height:34px!important;
  display:block!important;
  object-fit:contain!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
}

/* Remove color backgrounds inherited from previous content icon theme */
body:not(.admin-body) .circular-content-icon.inspection,
body:not(.admin-body) .content-icon.inspection,
body:not(.admin-body) .circular-content-icon.truck,
body:not(.admin-body) .dh-icon-truck.circular-content-icon,
body:not(.admin-body) .circular-content-icon.alcohol,
body:not(.admin-body) .content-icon.alcohol,
body:not(.admin-body) .circular-content-icon.tube,
body:not(.admin-body) .dh-icon-tube.circular-content-icon,
body:not(.admin-body) .circular-content-icon.amphetamine,
body:not(.admin-body) .content-icon.amphetamine,
body:not(.admin-body) .circular-content-icon.microscope,
body:not(.admin-body) .dh-icon-microscope.circular-content-icon,
body:not(.admin-body) .circular-content-icon.search,
body:not(.admin-body) .circular-content-icon.filter{
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
}

/* Dashboard content cards: 2 columns only after removing "เริ่ม" */
body:not(.admin-body) .dashboard-start-grid{
  display:flex!important;
  flex-direction:column!important;
  gap:9px!important;
  width:100%!important;
  max-width:100%!important;
  overflow:hidden!important;
}

body:not(.admin-body) .dashboard-start-btn{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  min-height:68px!important;
  height:auto!important;
  display:grid!important;
  grid-template-columns:48px minmax(0,1fr)!important;
  gap:10px!important;
  align-items:center!important;
  padding:10px 12px!important;
  border-radius:19px!important;
  border:1px solid #dbe3ef!important;
  background:#fff!important;
  box-shadow:0 6px 18px rgba(15,23,42,.055)!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
  text-align:left!important;
}

/* Any remaining dashboard em/start must be hidden */
body:not(.admin-body) .dashboard-start-btn em,
body:not(.admin-body) .dashboard-start-btn .start-pill{
  display:none!important;
}

/* Form cards still have right arrow, but compact */
body:not(.admin-body) .app-form-list{
  display:flex!important;
  flex-direction:column!important;
  gap:10px!important;
  width:100%!important;
  max-width:100%!important;
  overflow:hidden!important;
}

body:not(.admin-body) .app-form-card{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  min-height:68px!important;
  height:auto!important;
  display:grid!important;
  grid-template-columns:48px minmax(0,1fr) 22px!important;
  gap:10px!important;
  align-items:center!important;
  padding:10px 12px!important;
  border-radius:19px!important;
  border:1px solid #dbe3ef!important;
  background:#fff!important;
  box-shadow:0 6px 18px rgba(15,23,42,.055)!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
  text-align:left!important;
}

body:not(.admin-body) .app-form-card em{
  justify-self:end!important;
  align-self:center!important;
  width:22px!important;
  min-width:22px!important;
  max-width:22px!important;
  height:28px!important;
  padding:0!important;
  margin:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  color:#111827!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  font-size:26px!important;
  line-height:1!important;
  font-weight:700!important;
  font-style:normal!important;
  overflow:hidden!important;
}

body:not(.admin-body) .app-form-card em::after{
  content:none!important;
  display:none!important;
}

/* Text sizing: same content group = same sizes; no overflow */
body:not(.admin-body) .dashboard-start-btn .action-copy,
body:not(.admin-body) .app-form-card .form-card-copy{
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-align:left!important;
  display:block!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) .dashboard-start-btn .action-copy b,
body:not(.admin-body) .app-form-card .form-card-copy b{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  margin:0!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  font-size:16px!important;
  line-height:1.22!important;
  font-weight:950!important;
  color:#111827!important;
}

body:not(.admin-body) .dashboard-start-btn .action-copy small,
body:not(.admin-body) .app-form-card .form-card-copy small{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  margin-top:3px!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  font-size:11px!important;
  line-height:1.22!important;
  font-weight:750!important;
  color:#64748b!important;
}

/* History cards content icons also no frame and no overflow */
body:not(.admin-body) .dh-card{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  display:grid!important;
  grid-template-columns:48px minmax(0,1fr) auto!important;
  gap:10px!important;
  align-items:center!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) .dh-card .dh-icon.circular-content-icon{
  width:44px!important;
  height:44px!important;
  min-width:44px!important;
  max-width:44px!important;
  flex-basis:44px!important;
  border-radius:0!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
}

body:not(.admin-body) .dh-card b,
body:not(.admin-body) .dh-card small,
body:not(.admin-body) .dh-card span{
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}

/* Compact mobile tuning */
@media(max-width:430px){
  body:not(.admin-body) .circular-content-icon,
  body:not(.admin-body) .content-icon,
  body:not(.admin-body) .form-card-icon.circular-content-icon,
  body:not(.admin-body) .action-icon.circular-content-icon,
  body:not(.admin-body) .dh-icon.circular-content-icon{
    width:42px!important;
    height:42px!important;
    min-width:42px!important;
    max-width:42px!important;
    flex-basis:42px!important;
  }

  body:not(.admin-body) .circular-content-icon .circular-content-icon-img,
  body:not(.admin-body) .content-icon .circular-content-icon-img,
  body:not(.admin-body) .form-card-icon .circular-content-icon-img,
  body:not(.admin-body) .action-icon .circular-content-icon-img,
  body:not(.admin-body) .dh-icon .circular-content-icon-img,
  body:not(.admin-body) .circular-content-icon-img{
    width:31px!important;
    height:31px!important;
    max-width:31px!important;
    max-height:31px!important;
  }

  body:not(.admin-body) .dashboard-start-btn{
    grid-template-columns:44px minmax(0,1fr)!important;
    gap:9px!important;
    min-height:64px!important;
    padding:9px 10px!important;
    border-radius:18px!important;
  }

  body:not(.admin-body) .app-form-card{
    grid-template-columns:44px minmax(0,1fr) 20px!important;
    gap:9px!important;
    min-height:64px!important;
    padding:9px 10px!important;
    border-radius:18px!important;
  }

  body:not(.admin-body) .dashboard-start-btn .action-copy b,
  body:not(.admin-body) .app-form-card .form-card-copy b{
    font-size:15px!important;
  }

  body:not(.admin-body) .dashboard-start-btn .action-copy small,
  body:not(.admin-body) .app-form-card .form-card-copy small{
    font-size:10.5px!important;
  }
}

@media(max-width:360px){
  body:not(.admin-body) .dashboard-start-btn .action-copy b,
  body:not(.admin-body) .app-form-card .form-card-copy b{
    font-size:14px!important;
  }

  body:not(.admin-body) .dashboard-start-btn .action-copy small,
  body:not(.admin-body) .app-form-card .form-card-copy small{
    font-size:10px!important;
  }
}



/* v240 Dashboard + History compact fix */

/* Dashboard: compact driver card with vehicle plate inside card */
body:not(.admin-body) .dashboard-hero-compact{
  padding:16px!important;
  border-radius:24px!important;
}

body:not(.admin-body) .dashboard-hero-compact .dashboard-kicker{
  font-size:14px!important;
  line-height:1.1!important;
  font-weight:900!important;
  color:#64748b!important;
  margin:0 0 10px!important;
  letter-spacing:.02em!important;
}

body:not(.admin-body) .dashboard-profile-card-v240{
  display:grid!important;
  grid-template-columns:64px minmax(0,1fr)!important;
  gap:14px!important;
  align-items:center!important;
  width:100%!important;
  max-width:100%!important;
  min-height:94px!important;
  padding:14px!important;
  border-radius:22px!important;
  border:1px solid #dbe3ef!important;
  background:#fff!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
}

body:not(.admin-body) .dashboard-profile-card-v240 .driver-card-info{
  min-width:0!important;
  width:100%!important;
  overflow:hidden!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:flex-start!important;
  gap:4px!important;
}

body:not(.admin-body) .dashboard-profile-card-v240 .driver-card-info b{
  display:block!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  font-size:21px!important;
  line-height:1.18!important;
  font-weight:950!important;
  color:#111827!important;
}

body:not(.admin-body) .dashboard-profile-card-v240 .driver-card-info span{
  display:block!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  font-size:13px!important;
  line-height:1.25!important;
  font-weight:800!important;
  color:#64748b!important;
}

body:not(.admin-body) .driver-card-plate{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  max-width:100%!important;
  margin-top:4px!important;
  padding:6px 12px!important;
  border-radius:999px!important;
  background:#eff6ff!important;
  border:1px solid #bfdbfe!important;
  color:#1d4ed8!important;
  font-size:14px!important;
  line-height:1!important;
  font-weight:950!important;
  font-style:normal!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}

/* Hide old dashboard title row if any remains */
body:not(.admin-body) .dashboard-title-row{
  display:none!important;
}

/* Dashboard start panel: remove text "เริ่มตรวจ", only show section label */
body:not(.admin-body) .dashboard-start-panel .dashboard-section-head b{
  display:none!important;
}

body:not(.admin-body) .dashboard-start-panel .dashboard-section-head span{
  font-size:13px!important;
  line-height:1.2!important;
  font-weight:900!important;
  color:#64748b!important;
}

/* Dashboard cards: font matches form menu selection cards, no overflow */
body:not(.admin-body) .dashboard-start-btn .action-copy b{
  font-size:18px!important;
  line-height:1.22!important;
  font-weight:950!important;
}

body:not(.admin-body) .dashboard-start-btn .action-copy small{
  font-size:12px!important;
  line-height:1.22!important;
  font-weight:800!important;
}

/* History list: compact cards, height fits content */
body:not(.admin-body) .driver-history-page .dh-card{
  min-height:0!important;
  height:auto!important;
  padding:12px!important;
  border-radius:20px!important;
  grid-template-columns:42px minmax(0,1fr) auto!important;
  gap:10px!important;
  align-items:center!important;
  overflow:hidden!important;
}

body:not(.admin-body) .driver-history-page .dh-card .dh-icon.circular-content-icon{
  width:38px!important;
  height:38px!important;
  min-width:38px!important;
  max-width:38px!important;
  flex-basis:38px!important;
}

body:not(.admin-body) .driver-history-page .dh-card .circular-content-icon-img{
  width:30px!important;
  height:30px!important;
  max-width:30px!important;
  max-height:30px!important;
}

body:not(.admin-body) .driver-history-page .dh-main{
  min-width:0!important;
  display:flex!important;
  flex-direction:column!important;
  gap:4px!important;
  overflow:hidden!important;
}

body:not(.admin-body) .driver-history-page .dh-date{
  display:flex!important;
  align-items:center!important;
  gap:6px!important;
  font-size:12px!important;
  line-height:1.2!important;
  color:#64748b!important;
  font-weight:750!important;
  min-width:0!important;
  overflow:hidden!important;
}

body:not(.admin-body) .driver-history-page .dh-date svg,
body:not(.admin-body) .driver-history-page .dh-date img{
  width:14px!important;
  height:14px!important;
  flex:0 0 14px!important;
}

body:not(.admin-body) .driver-history-page .dh-date span,
body:not(.admin-body) .driver-history-page .dh-type{
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

body:not(.admin-body) .driver-history-page .dh-type{
  font-size:16px!important;
  line-height:1.22!important;
  font-weight:950!important;
  color:#111827!important;
}

body:not(.admin-body) .driver-history-page .dh-status-line{
  display:flex!important;
  flex-wrap:nowrap!important;
  align-items:center!important;
  gap:6px!important;
  min-width:0!important;
  overflow:hidden!important;
}

body:not(.admin-body) .driver-history-page .dh-status-line .dh-label{
  font-size:11px!important;
  font-weight:800!important;
  color:#64748b!important;
  white-space:nowrap!important;
}

body:not(.admin-body) .driver-history-page .dh-status-line i{
  width:1px!important;
  height:16px!important;
  background:#e2e8f0!important;
  flex:0 0 1px!important;
}

body:not(.admin-body) .driver-history-page .dh-chip{
  min-height:26px!important;
  padding:5px 10px!important;
  border-radius:999px!important;
  font-size:12px!important;
  line-height:1!important;
  font-weight:950!important;
  white-space:nowrap!important;
}

body:not(.admin-body) .driver-history-page .dh-detail-btn{
  min-width:92px!important;
  max-width:108px!important;
  height:38px!important;
  padding:0 10px!important;
  border-radius:14px!important;
  font-size:13px!important;
  font-weight:950!important;
  white-space:nowrap!important;
}

@media(max-width:430px){
  body:not(.admin-body) .dashboard-profile-card-v240{
    grid-template-columns:58px minmax(0,1fr)!important;
    gap:12px!important;
    min-height:88px!important;
    padding:12px!important;
  }
  body:not(.admin-body) .dashboard-profile-card-v240 .driver-card-info b{
    font-size:19px!important;
  }
  body:not(.admin-body) .dashboard-profile-card-v240 .driver-card-info span{
    font-size:12px!important;
  }
  body:not(.admin-body) .driver-card-plate{
    font-size:13px!important;
    padding:5px 10px!important;
  }
  body:not(.admin-body) .dashboard-start-btn .action-copy b{
    font-size:17px!important;
  }
  body:not(.admin-body) .dashboard-start-btn .action-copy small{
    font-size:11.5px!important;
  }
  body:not(.admin-body) .driver-history-page .dh-card{
    grid-template-columns:40px minmax(0,1fr) auto!important;
    padding:10px!important;
    gap:9px!important;
    border-radius:18px!important;
  }
  body:not(.admin-body) .driver-history-page .dh-card .dh-icon.circular-content-icon{
    width:36px!important;
    height:36px!important;
    min-width:36px!important;
    max-width:36px!important;
  }
  body:not(.admin-body) .driver-history-page .dh-card .circular-content-icon-img{
    width:28px!important;
    height:28px!important;
  }
  body:not(.admin-body) .driver-history-page .dh-type{
    font-size:15px!important;
  }
  body:not(.admin-body) .driver-history-page .dh-detail-btn{
    min-width:82px!important;
    max-width:92px!important;
    height:36px!important;
    font-size:12px!important;
  }
}

@media(max-width:370px){
  body:not(.admin-body) .driver-history-page .dh-detail-btn span{
    display:none!important;
  }
  body:not(.admin-body) .driver-history-page .dh-detail-btn{
    min-width:38px!important;
    max-width:38px!important;
    width:38px!important;
    padding:0!important;
  }
}
