@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;600;700&display=swap');

:root {
  --bg: #0a0f1a;
  --panel: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --brand: #0b4aa2;
  --brand-700: #083a80;
  --line: #e2e8f0;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: 'Noto Sans Thai', 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f7fb;
  color: var(--text);
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #0d2c66, #0b4aa2 60%, #0d2c66);
  color: #fff;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.user-chip {
  width: fit-content !important;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

/* ซ่อน quickbar บนเดสก์ท็อป */
.mobile-quickbar {
  display: none;
}

/* แสดงเฉพาะมือถือ */
@media (max-width: 768px) {
  .mobile-quickbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    z-index: 9999;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 12px rgba(17, 12, 46, 0.08);
    height: 64px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-quickbar .mq-scroll {
    display: flex;
    justify-content: space-around;
    width: 100%;
    padding: 0;
  }

  .mobile-quickbar .mq-item {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: #374151;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    position: relative;
    transition: all .2s ease;
  }

  .mobile-quickbar .mq-item.active {
    color: #4f46e5;
  }

  .mobile-quickbar .mq-item.primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-radius: 12px;
    padding: 6px 8px;
    margin: 0 4px;
  }

  .mobile-quickbar .mq-icon {
    font-size: 20px;
    line-height: 1;
    margin-bottom: 4px;
  }

  .mobile-quickbar .mq-badge {
    position: absolute;
    top: 4px;
    right: 20px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    border-radius: 999px;
    padding: 2px 5px;
    line-height: 1;
  }

  /* ซ่อน sidebar */
  .sidebar {
    display: none;
  }

  /* ให้ main/content เต็มจอ และกันโดนทับ */
  .main,
  .content {
    margin: 0 !important;
    padding-bottom: 80px !important;
    /* เผื่อพื้นที่ quickbar */
  }
}

/* --- แสดงโลโก้เฉพาะมือถือ --- */
.mobile-logo {
  display: none;
  /* ซ่อนโลโก้บน Desktop */
  align-items: center;
  gap: 8px;
}

.mobile-logo img {
  width: 100%;
  height: 50px;
  object-fit: contain;
}

/* แสดงโลโก้เมื่อเป็นมือถือ */
@media (max-width: 768px) {
  .mobile-logo {
    display: flex;
  }

  /* ปรับโครงสร้าง Header ให้โลโก้อยู่ซ้ายสุด */
  .topbar {
    /* flex-wrap: wrap; */
    gap: 6px;
    align-items: flex-start;
  }

  /* จัดปุ่มไปด้านขวาในบรรทัดถัดไป */
  .actions {
    width: 100%;
    justify-content: flex-end;
  }
}



.brand {
  gap: 10px;
  align-items: center;
  padding: 8px 4px;
}

.brand img {
  width: 100%;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

.company .title {
  font-weight: 700;
}

.company .sub {
  font-size: 12px;
  opacity: .8
}

.nav {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #dbeafe;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .08)
}

.nav-item.active {
  background: #fff;
  color: var(--brand);
}

.nav-item .icon {
  width: 40px;
  text-align: center
}

.bg-lab {
  background-image: url("assets/img/science-lab-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.bg-lab::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  /* เงามืดบางๆ เพื่อให้ข้อความอ่านง่าย */
  backdrop-filter: blur(2px);
}

.bg-lab * {
  position: relative;
  z-index: 1;
}

.nav-bottom {
  margin-top: auto
}

.nav-item.muted {
  color: #c7d2fe
}

.badge {
  background: #e0e7ff;
  color: #1e3a8a;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 8px
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .spacer {
  flex: 1
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px
}

.btn {
  /* background: #e2e8f0; */
  color: #0f172a;
  padding: 5px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid #cbd5e1
}

.btn:hover {
  filter: brightness(.98)
}

.btn.primary {
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8
}

.btn.ghost {
  background: transparent;
  border-color: #cbd5e1
}

.card {
  position: relative;
  overflow: hidden;
}

.card canvas {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  width: 100%;
  height: 70px;
  opacity: .75;
  pointer-events: none;
}


.icon {
  background: transparent;
  /* border: 1px solid #cbd5e1; */
  /* border-radius: 10px; */
  padding: 8px 10px;
  font-size: 16px
}

button.btn.btn-delete {
  background-color: red !important;
  color: wheat;
}

button.btn.btn-delete:hover {
  background: #eef2ff !important;
  color: black;

}

button.btn.btn-download {
  background: #509cdb !important;
  border: 1px solid #e5e7eb;
  color: #fff !important;

}


button.btn.btn-download:hover {
  background: #fff !important;
  border: 1px solid #e5e7eb;
  color: #000 !important;
}

.logout {
  color: #ef4444;
  font-weight: 600;
  margin-left: 4px;
  text-decoration: none
}

.content {
  padding: 20px 20px 80px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px
}

.input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 220px;
  background: #fff
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.table th,
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px !important
}

.table th {
  color: #334155;
  background: #f8fafc
}

.table tr:nth-child(even) {
  background: #fafafa
}

.status.btn {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: none;
  cursor: pointer
}

.status.warn {
  background: #fef3c7;
  color: #a16207
}

.status.danger {
  background: #fee2e2;
  color: #991b1b
}

/* .status.info {
  background: #f5f00b;
  color: #1d4ed8;
  color: #ffffff;
  border-radius: 5px;
  border-color: #f5f00b;
} */



.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #1d4ed8;
  color: #fff;
  border: none;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  font-size: 28px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15)
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px
}

.detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px
}

.detail img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line)
}

.muted {
  color: var(--muted)
}

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
  font-size: 14px
}

.progress {
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden
}

.progress>span {
  display: block;
  height: 100%;
  background: #10b981
}

.empty {
  display: grid;
  place-items: center;
  height: 420px;
  color: #64748b
}

.login-wrap {
  display: grid;
  place-items: center;
  height: 100vh
}

.login {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  width: 360px
}

.login h1 {
  margin: 8px 0 16px
}

.login .input {
  width: 100%
}

.login .btn {
  width: 100%;
  margin-top: 10px;
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8
}

.small {
  font-size: 12px
}

.status.danger {
  background: #ff0000;
  color: #ffffff;
  border-radius: 5px;
  /* padding: 2px; */
  border-color: red;
}

button.status.info {
  background: #509CDB;
  color: #fff;
  border-radius: 5px;
  border-color: #509CDB;
}

.btn-download {
  background: #509CDB;
  color: #fff;
  border-radius: 5px;
  border-color: #509CDB;
}

.btn-delete {
  background: #ff0000 !important;
  color: #ffffff;
  border-radius: 5px;
  /* padding: 2px; */
}

.form.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 800px;
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}

.input,
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.col-span-2 {
  grid-column: span 2;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  border: none;
}

.btn.primary {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
}

.btn:hover {
  opacity: 0.9;
}

.small {
  font-size: 12px;
  color: #6b7280;
}

.nav-item.active {
  background: #fff;
  color: #0b4aa2;
  font-weight: 600;
  border-radius: 8px;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  width: 400px;
  max-width: 90%;
}


.progress-bar {
  background: #e5e7eb;
  /* เทาอ่อน */
  border-radius: 6px;
  overflow: hidden;
  width: 120px;
  /* กำหนดความกว้าง bar */
  height: 20px;
}

.progress-fill {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  /* น้ำเงิน gradient */
  height: 100%;
  color: #fff;
  font-size: 12px;
  text-align: center;
  line-height: 20px;
  transition: width 0.3s ease;
}

.user-chip {
  width: 100% !important;
  display: flex;
  align-items: center;
  gap: 8px
}

.user-chip {
  /* width: 28px !important; */
  height: 28px;
  border-radius: 50%;
  object-fit: cover
}

.report-head {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px
}

.report-head .back {
  text-decoration: none;
  color: #0b4aa2
}

.report-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 2px
}

.report-date {
  color: #6b7280;
  font-size: 12px
}

.report-wrap {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 28px;
  margin-top: 12px
}

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.hero {
  width: 100%;
  aspect-ratio: 16/9;
  background: #f3f4f6;
  border-radius: 10px;
  object-fit: cover
}

.thumbs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap
}

.thumbs img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent
}

.thumbs img.active {
  border-color: #2563eb
}

.section-title {
  font-weight: 700;
  margin: 0 0 10px
}

.desc {
  color: #374151;
  line-height: 1.7;
  white-space: pre-wrap
}

.meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px
}

.meta-item {
  background: #f9fafb;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: 12px
}

.meta-item .label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px
}

.meta-item .value {
  font-weight: 600
}

.progress-bar {
  background: #e5e7eb;
  border-radius: 999px;
  height: 20px;
  overflow: hidden
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  width: 0;
  transition: width .35s
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px
}

.user-box img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover
}

.user-box .name {
  font-weight: 600
}

.small-muted {
  color: #6b7280;
  font-size: 12px;
  padding-top: 10px !important;

}

@media (max-width: 980px) {
  .report-wrap {
    grid-template-columns: 1fr;
    gap: 16px
  }
}

/* ============== MOBILE FIRST ============== */
@media (max-width: 768px) {

  /* 1) การ์ดสรุป — เรียง 1 คอลัมน์ (อ่านง่าย) */
  .summary {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .summary .card {
    padding: 14px !important;
    border-radius: 14px !important;
  }

  .summary .card .metric {
    font-size: 22px !important;
  }

  /* mini chart ในการ์ดให้เตี้ยลงนิดนึง */
  #mini1,
  #mini2,
  #mini3,
  #mini4 {
    height: 50px !important;
  }

  /* 2) กราฟ — เรียงซ้อนเป็น 1 คอลัมน์ และเพิ่มพื้นที่สัมผัส */
  .charts {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .panel {
    padding: 12px !important;
    border-radius: 12px !important;
  }

  /* ความสูงกราฟให้พอดีจอ */
  #lineMonthly {
    height: 200px !important;
  }

  #pieCat {
    height: fit-content !important;
  }

  /* เลเจนด์โดนัทให้ขึ้นบรรทัดใหม่และเว้นระยะ */
  .donut-legend {
    gap: 16px !important;
    margin-top: 8px !important;
  }

  .legend-item .val strong {
    font-size: 18px !important;
  }

  /* 3) ตาราง — ทำให้พอดีกับจอโดย “ซ่อนคอลัมน์ที่กว้าง” */
  /* โครงสร้างคอลัมน์ปัจจุบัน:
     1 ชื่อโครงการ | 2 บริษัท | 3 ผู้ติดต่อ | 4 หมวดหมู่ | 5 ความคืบหน้า
     6 เริ่ม-สิ้นสุดโครงการ | 7 ไฟล์/รูปภาพ | 8 วันที่
     -> บนมือถือซ่อน (2,3,7) เพื่อลดความกว้าง แต่ยังคงคอลัมน์สำคัญไว้
  */
  .table thead th:nth-child(2),
  .table thead th:nth-child(3),
  .table thead th:nth-child(7),
  .table tbody td:nth-child(2),
  .table tbody td:nth-child(3),
  .table tbody td:nth-child(7) {
    /* display: none !important; */
  }

  /* ขยายระยะห่างระหว่างแถวให้อ่านง่ายขึ้น */
  .table td {
    padding: 10px 8px !important;
  }

  /* ถ้าตารางยังล้น ให้ตัดคำยาว (เช่น ชื่อโครงการยาวๆ) */
  .table td:nth-child(1) a {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }



}

/* ============== VERY SMALL PHONES (<= 480px) ============== */
@media (max-width: 480px) {
  .summary .card .metric {
    font-size: 20px !important;
  }

  .styled-table thead th,
  .styled-table td {
    padding: 10px 12px !important;
  }

  #lineMonthly,
  #pieCat {
    height: 180px !important;
  }
}


.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px
}

.card {
  border-radius: 16px;
  padding: 16px;
  color: #fff;
  box-shadow: 0 10px 30px rgba(17, 12, 46, .08)
}

.card h4 {
  margin: 0 0 6px;
  font-weight: 600;
  opacity: .9
}

.card .metric {
  font-size: 28px;
  font-weight: 800;
  margin: 2px 0 4px
}

.muted {
  color: #fff !important;
}


.card .muted {
  opacity: .85
}

.grad1 {
  background: linear-gradient(135deg, #4f46e5, #9333ea)
}

.grad2 {
  background: linear-gradient(135deg, #06b6d4, #0ea5e9)
}

.grad3 {
  background: linear-gradient(135deg, #22c55e, #16a34a)
}

.grad4 {
  background: linear-gradient(135deg, #f59e0b, #ef4444)
}

.charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  margin-bottom: 16px
}

canvas#pieCat {
  justify-self: center;
}

.panel {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 28px rgba(17, 12, 46, .06)
}

.panel h3 {
  margin: 0 0 10px
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  overflow: hidden
}

.table-wrap thead th {
  background: #f8fafc;
  text-align: left;
  padding: 10px;
  font-weight: 700
}

.table-wrap td {
  padding: 10px;
  border-top: 1px solid #f1f5f9
}

@media (max-width:1024px) {
  .summary {
    grid-template-columns: 1fr 1fr
  }

  .charts {
    grid-template-columns: 1fr
  }
}

.donut-legend {
  display: flex;
  gap: 28px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
}

.legend-item .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.legend-item .val strong {
  font-size: 20px;
  color: #0f172a;
  margin-right: 4px;
}

.legend-item .val small {
  font-size: 13px;
  color: #94a3b8;
}

/* การ์ด/พาเนลโทนสว่าง นุ่มๆ */
.panel {
  background: #fff;
  border: 0;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 6px 28px rgba(17, 12, 46, .08);
}

.summary .card {
  border: 0;
  color: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(17, 12, 46, .08);
}

.grad1 {
  background: linear-gradient(135deg, #f472b6, #fb7185)
}

.grad2 {
  background: linear-gradient(135deg, #a78bfa, #7c3aed)
}

.grad3 {
  background: linear-gradient(135deg, #60a5fa, #22d3ee)
}

.grad4 {
  background: linear-gradient(135deg, #f59e0b, #ef4444)
}


.styled-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(17, 12, 46, .06);
  font-family: 'Inter', sans-serif;
}

.styled-table thead th {
  background: #1e293b;
  color: #fff;
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.styled-table td {
  padding: 12px 16px;
  border-top: 1px solid #f1f5f9;
  color: #334155;
}

.styled-table tbody tr:hover {
  background: #f9fafb;
}

.status {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  min-width: 70px;
}

.status.green {
  background: #22c55e;
}

/* Open */
.status.orange {
  background: #f59e0b;
}

/* Process */
.status.blue {
  background: #3b82f6;
}

/* ✅ Layout หลัก */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ส่วน sidebar + main */
.layout .main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* การ์ดสรุป */
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

/* กราฟ */
.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ตาราง */
.table-wrap {
  overflow-x: auto;
  /* ✅ ป้องกันตารางล้นบนมือถือ */
}

/* ✅ ปรับสำหรับมือถือ */
@media (max-width: 1024px) {
  .summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .summary {
    grid-template-columns: 1fr;
  }

  h2 {
    font-size: 1.4rem;
  }

  .card h4 {
    font-size: 1rem;
  }

  .metric {
    font-size: 1.6rem;
  }

  .charts .panel {
    padding: 10px;
  }

  table.styled-table th,
  table.styled-table td {
    padding: 8px 10px;
    font-size: 0.9rem;
  }
}

/* ✅ ปรับ sidebar ซ่อนไว้บนมือถือ */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    display: none;
    /* ซ่อน sidebar บนมือถือ */
  }

  .main {
    width: 100%;
  }
}

.progress-bar {
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  width: 120px;
  height: 20px;
}

.progress-fill {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  height: 100%;
  color: #fff;
  font-size: 12px;
  text-align: center;
  line-height: 20px;
  transition: width .3s ease;
}

.muted {
  color: #6b7280;
}

.table-responsive {
  overflow-x: auto
}

.chip-link {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #374151;
  text-decoration: none;
  font-weight: 600
}

.user-chip {
  width: 100% !important;

}

.user-chip .u-ava {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px
}

@media (max-width:768px) {
  #reportTable thead {
    display: none
  }

  #reportTable,
  #reportTable tbody,
  #reportTable tr,
  #reportTable td {
    display: block;
    width: 100%;
  }

  a.btn.primary {
    font-size: 10px;
    /* padding: 5px; */
  }

  #reportTable tr {
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    padding: 12px 12px 8px;
    margin: 10px 0;
    box-shadow: 0 8px 24px rgba(17, 12, 46, .06);
  }

  #reportTable td {
    border: none;
    padding: 6px 0;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 28px;
  }

  #reportTable td::before {
    content: attr(data-label);
    flex: 0 0 110px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
  }

  #reportTable td[data-label="ความคืบหน้า"] .progress-bar {
    width: 100%;
    max-width: 260px;
    height: 18px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
  }

  #reportTable td[data-label="ความคืบหน้า"] .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
    color: #fff;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
  }

  #reportTable td.actions-td {
    display: flex;
    gap: 8px;
    margin-top: 6px;
  }

  #reportTable td.actions-td::before {
    content: '';
    display: none;
  }

  .btn.btn-download {
    background: #e0e7ff;
    color: #1f3eed;
    border: 1px solid #c7d2fe;
    position: relative;
    margin-inline-start: auto;
    margin-right: 10px;
  }

  .btn.btn-delete {
    background: #fee2e2;
    color: #ffffff;
    border: 1px solid #fecaca;
  }
}

.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.report-head .back {
  text-decoration: none;
  color: #0b4aa2;
}

.report-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 2px;
}

.report-date {
  color: #6b7280;
  font-size: 12px;
}

.report-wrap {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 28px;
  margin-top: 12px;
}

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.hero {
  width: 100%;
  aspect-ratio: 16/9;
  background: #f3f4f6;
  border-radius: 10px;
  object-fit: cover;
}

.thumbs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.thumbs img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
}

.thumbs img.active {
  border-color: #2563eb;
}

.section-title {
  font-weight: 700;
  margin: 0 0 10px;
}

.desc {
  color: #374151;
  line-height: 1.7;
  white-space: pre-wrap;
  font-size: 14px;
}

.meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.meta-item {
  background: #f9fafb;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: 12px;
}

.meta-item .label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}

.meta-item .value {
  font-weight: 600;
}

/* .progress-bar {
  background: #e5e7eb;
  border-radius: 999px;
  height: 20px !important;
  overflow: hidden;
} */

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  width: 0;
  transition: width .35s;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.user-box img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.user-box .name {
  font-weight: 600;
}

.small-muted {
  color: #6b7280;
  font-size: 12px;
  padding-top: 10px !important;
}

@media(max-width:980px) {
  .report-wrap {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Desktop ปกติ */
.sidebar {
  display: block;
}

.mobile-quickbar {
  display: none;
}

/* มือถือ */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .mobile-quickbar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid #ddd;
    z-index: 999;
  }

  .mq-scroll {
    display: flex;
    flex: 1;
    overflow-x: auto;
  }

  .mq-item {
    flex: 1 0 auto;
    text-align: center;
    padding: 5px;
    font-size: 12px;
    color: #333;
    text-decoration: none;
  }

  .mq-item.primary {
    color: #fff;
    background: #f59e0b;
    border-radius: 6px;
  }

  .mq-item.active {
    font-weight: bold;
    color: #f59e0b;
  }

  .mq-badge {
    background: red;
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    padding: 0 4px;
    position: absolute;
    top: 2px;
    right: 10px;
  }
}

  .dynamic-group { margin-bottom:10px; }
  .add-btn {
    background:#4caf50; color:#fff; border:none; padding:6px 10px;
    border-radius:5px; cursor:pointer;
  }
  .remove-btn {
    background:#f44336; color:#fff; border:none; padding:6px 10px;
    border-radius:5px; cursor:pointer;
  }
  textarea, input, select {
    width:100%;
    resize:vertical;
    padding:8px;
    border:1px solid #ccc;
    border-radius:5px;
    font-size:14px;
    box-sizing:border-box;
  }

  .section-title {
    font-weight:bold; margin-top:15px; font-size:1.1em;
    border-bottom:2px solid #ddd; padding-bottom:5px;
    display:flex; align-items:center; justify-content:space-between;
  }

  .preview-img {
    width: 120px;
    height: auto;
    border-radius: 6px;
    margin: 5px;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
  }

  /* ✅ Layout ปกติแบบสองคอลัมน์ */
  .form.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }

  .col-span-2 {
    grid-column: span 2;
  }

  .btn {
    display: inline-block;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    /* background: #777; */
    color: white;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
  }

  .btn.primary {
    background: #007bff;
  }

  /* ✅ Responsive สำหรับมือถือ */
  @media (max-width: 768px) {
    .form.grid2 {
      grid-template-columns: 1fr; /* เหลือ 1 คอลัมน์ */
    }

    .col-span-2 {
      grid-column: span 1;
    }

    h2 {
      font-size: 1.3em;
      text-align: center;
    }

    .section-title {
      flex-direction: column;
      align-items: flex-start;
      gap: 8px;
    }

    .btn, .add-btn, .remove-btn {
      width: 100%;
      text-align: center;
      margin-top: 5px;
    }

    .preview-img {
      width: 100%;
      max-width: 300px;
    }

    .layout {
      flex-direction: column;
    }

    .main {
      width: 100%;
    }
  }
