/* ฟอนต์ไทยหลัก — Noto Sans Thai (อ่านง่าย x-height ใหญ่ ดูไม่เล็ก) · display=swap = โชว์ทันทีแล้วค่อยสลับ */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700;800&display=swap');

:root {
  /* ══ ธีม "ม่วงขาว" (Purple-White) — โทนหลักของทั้งแอป ══ */
  --bg: #ffffff;
  --bg2: #f6f4fb;          /* ขาวอมม่วงอ่อน */
  --bg3: #ece7f6;          /* ม่วงอ่อน */
  --t1: #1c1830;           /* หมึก (ม่วงดำ) */
  --t2: #56506b;
  --t3: #948da8;
  --bd: rgba(109, 40, 217, 0.10);
  --bd2: rgba(109, 40, 217, 0.20);
  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 2px 5px rgba(91,33,182,.07), 0 8px 24px rgba(91,33,182,.10);
  --shadow-h: 0 12px 30px rgba(124,58,237,.22);
  --shadow-modal: 0 20px 60px rgba(91,33,182,.28), 0 4px 12px rgba(91,33,182,.14);
  --ease: cubic-bezier(.22,.61,.36,1);
  --grad: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);

  /* primary = ม่วง (remap --blue ทั้งระบบ → ทุกที่ที่ใช้ var(--blue) กลายเป็นม่วง) */
  --blue: #7c3aed;
  --blue-bg: #f2ecfd;
  --blue-dk: #5b21b6;

  --green: #15803d;
  --green-bg: #e7f5ec;
  --green-mid: #16a34a;

  --red: #b91c1c;
  --red-bg: #fdebeb;
  --red-mid: #ef4444;

  --amber: #92500a;
  --amber-bg: #fcf2e1;
  --amber-mid: #f59e0b;

  --purple: #6d28d9;
  --purple-bg: #f2ecfd;
  --purple-mid: #8b5cf6;

  --tA: #7c3aed;           /* ทีม A — ม่วง */
  --tB: #0d9488;           /* ทีม B — เขียวน้ำทะเล */
  --tC: #db2777;           /* ทีม C — ชมพู */

  color-scheme: light;
}

/* ══ โหมดกลางคืน (ม่วงเข้ม) — ตั้งผ่าน html[data-theme="dark"] (JS toggle + จำค่า) ══ */
html[data-theme="dark"] {
  --bg: #15121e;           /* ม่วงดำลึก */
  --bg2: #1e1a2c;
  --bg3: #2a2440;
  --t1: #efeafb;
  --t2: #aaa0c4;
  --t3: #6f6789;
  --bd: rgba(255, 255, 255, 0.09);
  --bd2: rgba(255, 255, 255, 0.17);

  --blue: #a78bfa;         /* ม่วงสว่าง (primary) */
  --blue-bg: #2c2147;
  --blue-dk: #c4b5fd;

  --green: #4ade80;
  --green-bg: #16331f;
  --green-mid: #34d399;

  --red: #f87171;
  --red-bg: #3a1414;
  --red-mid: #ef4444;

  --amber: #fbbf24;
  --amber-bg: #34230a;
  --amber-mid: #f59e0b;

  --purple: #c4b5fd;
  --purple-bg: #2e1d52;
  --purple-mid: #a78bfa;

  --tA: #a78bfa;
  --tB: #2dd4bf;
  --tC: #f472b6;

  --shadow: 0 2px 10px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.25);
  --shadow-h: 0 12px 32px rgba(0,0,0,.55);
  --shadow-modal: 0 24px 70px rgba(0,0,0,.6), 0 4px 14px rgba(0,0,0,.4);
  --grad: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);

  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans Thai', -apple-system, "Helvetica Neue", sans-serif;
  background: linear-gradient(180deg, var(--bg2) 0%, var(--bg) 40%);
  background-attachment: fixed;
  color: var(--t1);
  font-size: 15px;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app { max-width: 1100px; margin: 0 auto; padding: 14px; }
.mut { color: var(--t3); }   /* ข้อความรอง (ใช้ในแท็บสถานะรถ ฯลฯ) */

/* topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-icon { width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-name { font-size: 24px; font-weight: 700; letter-spacing: 0.2px; line-height: 1.15; }
.brand-sub { font-size: 13px; color: var(--t3); margin-top: 3px; }

.nav { display: flex; gap: 2px; background: var(--bg2); padding: 3px; border-radius: 24px; border: 0.5px solid var(--bd); box-shadow: var(--shadow); }
.ntab { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; padding: 6px 13px; font-size: 12px; border-radius: 20px; border: none; background: transparent; cursor: pointer; color: var(--t2); font-family: inherit; white-space: nowrap; transition: background .18s ease, color .18s ease; }
.ntab:hover { color: var(--t1); }
.ntab.on { background: var(--grad); color: #fff; font-weight: 600; box-shadow: 0 3px 10px rgba(124,58,237,.35); }

/* slide nav — แคปซูล gradient เลื่อนนุ่มระหว่างแท็บ (container id=nav-slide + .nav-ind)
   ⚠️ สไตล์ฐาน (แถบนอน) ต้องอยู่ในคลาสนี้ ห้ามเขียน inline บน element ใน index.html —
   ไม่งั้น media query sidebar ข้างล่าง override ไม่ได้ (inline style ชนะ CSS เสมอ) */
.nav-slide { position: relative; scrollbar-width: none; display: flex; gap: 2px; background: var(--bg2); padding: 3px; border-radius: 24px; border: .5px solid var(--bd); margin-bottom: 6px; overflow-x: auto; }
.nav-slide::-webkit-scrollbar { display: none; }
.nav-slide .ntab { position: relative; z-index: 1; transition: color .2s var(--ease); }
.nav-slide .ntab.on { background: transparent; box-shadow: none; }
.nav-ind { position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; background: var(--grad); border-radius: 20px; box-shadow: 0 3px 10px rgba(124,58,237,.35); transition: left .25s var(--ease), width .25s var(--ease), top .25s var(--ease), height .25s var(--ease); z-index: 0; pointer-events: none; opacity: 0; }

/* ★ ส.ค.69 — เมนูสามขีด (hamburger drawer): ซ่อนแถบแท็บไว้ กดปุ่ม ☰ แล้วเลื่อนออกมาจากซ้าย + ฉากหลังมืด
   ใช้ทุกขนาดจอ (มือถือ/คอมเหมือนกัน) · drawer ลอยทับ ไม่กินพื้นที่ → เนื้อหาได้ความกว้างเต็มตลอด
   ⚠️ บทเรียนจากรอบ sidebar (อย่าให้กลับมา):
     1) container ของ index.html คือ #dashboard-root (ไม่ใช่ #root ซึ่งเป็นของ seller.html และไม่มี nav-slide)
     2) JS ต้องใช้ root.style.display='' (ล้าง inline) ห้าม ='block' — inline style ชนะ CSS เสมอ
     3) สไตล์ฐานของ #nav-slide อยู่ในคลาส .nav-slide เท่านั้น ห้าม inline บน element ใน render() */

/* ปุ่มสามขีดในหัวเว็บ */
.nav-burger { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; border: .5px solid var(--bd2); background: var(--bg2); color: var(--t1); cursor: pointer; transition: background .18s ease, color .18s ease, transform .12s ease; }
.nav-burger:hover { background: var(--purple-bg); color: var(--purple); }
.nav-burger:active { transform: scale(.94); }

/* ฉากหลังมืด — กดที่ไหนก็ปิด drawer */
.nav-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .48); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); z-index: 1250; }
body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

/* ตัว drawer = #nav-slide เดิม (แถบแท็บ) แค่เปลี่ยนเป็นแผงลอยด้านซ้าย */
#nav-slide { position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; width: 244px; z-index: 1260;
  transform: translateX(-104%); transition: transform .3s var(--ease);
  flex-direction: column; align-items: stretch; gap: 4px;
  margin: 0; padding: 14px 10px; border-radius: 0 18px 18px 0; border-left: none;
  overflow-x: visible; overflow-y: auto; box-shadow: 6px 0 28px rgba(0, 0, 0, .18); }
body.nav-open #nav-slide { transform: translateX(0); }
/* คืน scrollbar ให้ drawer — .nav-slide ฐานซ่อนไว้ (เขียนตอนยังเป็นแถบนอน) แต่แนวตั้งรายการยาวเกินจอ
   ถ้าซ่อนต่อ ผู้ใช้จะไม่รู้ว่ามีเมนูอยู่ข้างล่างอีก */
#nav-slide { scrollbar-width: thin; scrollbar-color: var(--bd2) transparent; }
#nav-slide::-webkit-scrollbar { display: block; width: 6px; }
#nav-slide::-webkit-scrollbar-thumb { background: var(--bd2); border-radius: 3px; }
#nav-slide::-webkit-scrollbar-track { background: transparent; }
#nav-slide .ntab { justify-content: flex-start; padding: 11px 14px; font-size: 13.5px; border-radius: 12px; }
#nav-slide .nav-ind { border-radius: 12px; }
/* หัวข้อหมวดใน drawer (หน้าหลัก / ทีม & สิทธิ์ / ตั้งค่าระบบ / ตรวจสอบ & Log) */
.nav-sec { margin: 12px 0 3px; padding: 9px 12px 4px; font-size: 10px; font-weight: 800; letter-spacing: .6px; color: var(--t3); border-top: .5px solid var(--bd); position: relative; z-index: 1; }
.nav-sec:first-of-type { margin-top: 2px; border-top: none; }
/* รายการเมนูจัดการใน drawer (กดแล้วเปิด modal — ไม่ใช่แท็บ จึงไม่มีแคปซูล gradient) */
.nav-act { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; flex-shrink: 0; padding: 9px 14px; font-size: 12.5px; border-radius: 10px; border: none; background: transparent; color: var(--t1); font-family: inherit; cursor: pointer; white-space: nowrap; position: relative; z-index: 1; transition: background .16s ease, color .16s ease; }
.nav-act:hover { background: var(--purple-bg); color: var(--purple); }

/* หัว drawer (โลโก้/ชื่อ + ปุ่มปิด) — ไม่ให้แคปซูล gradient ไปวางทับ */
.nav-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 6px 12px; margin-bottom: 6px; border-bottom: .5px solid var(--bd); position: relative; z-index: 1; }
.nav-head-t { font-size: 13px; font-weight: 800; color: var(--t1); letter-spacing: -.2px; }
.nav-close { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; border: .5px solid var(--bd2); background: var(--bg2); color: var(--t2); cursor: pointer; flex-shrink: 0; }
.nav-close:hover { background: var(--red-bg); color: var(--red); }
@media (prefers-reduced-motion: reduce) { #nav-slide, .nav-backdrop { transition: none; } }

.btn-sm { font-size: 11px; padding: 4px 10px; border-radius: 7px; border: 0.5px solid var(--bd2); background: var(--bg2); color: var(--t2); cursor: pointer; font-family: inherit; transition: background .15s ease, border-color .15s ease, transform .12s ease; }
.btn-sm:hover { background: var(--bg3); border-color: var(--blue); color: var(--t1); }
.btn-sm:active { transform: scale(.96); }

/* loading/error */
.loading-container { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260px; gap: 12px; color: var(--t3); }
.spin { width: 28px; height: 28px; border: 2.5px solid var(--bd2); border-top-color: var(--blue); border-radius: 50%; animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.err-bar { position: sticky; top: 0; z-index: 99; background: var(--red-bg); border: 0.5px solid var(--red-mid); border-radius: var(--r); padding: 9px 12px; color: var(--red); font-size: 12px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.err-bar button { margin-left: auto; background: transparent; border: none; cursor: pointer; color: var(--red); font-size: 15px; }

/* cards */
.card { background: var(--bg); border: 0.5px solid var(--bd); border-radius: var(--r); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.card-title { font-size: 13px; font-weight: 700; margin-bottom: 11px; display: flex; align-items: center; gap: 7px; letter-spacing: -0.2px; }
.card-title::before { content: ""; width: 4px; height: 16px; border-radius: 3px; background: var(--grad); flex-shrink: 0; box-shadow: 0 1px 4px rgba(124,58,237,.4); }

/* kpi */
.kgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 8px; margin-bottom: 10px; }
.kpi { position: relative; overflow: hidden; background: var(--bg); border: 0.5px solid var(--bd); border-radius: var(--r-sm); padding: 12px 12px 11px; box-shadow: var(--shadow); transition: transform .16s ease, box-shadow .16s ease; }
.kpi::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad); opacity: .85; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-h); }
.kl { font-size: 11px; color: var(--t2); margin-bottom: 3px; }
.kv { font-size: 24px; font-weight: 800; line-height: 1; letter-spacing: -0.3px; }
.ks { font-size: 10px; color: var(--t3); margin-top: 2px; }

/* pipe */
.pipe-row { display: flex; gap: 7px; flex-wrap: wrap; }
.pipe-item { background: var(--bg2); border-radius: var(--r-sm); padding: 7px 11px; flex: 1; min-width: 65px; text-align: center; }
.pipe-num { font-size: 20px; font-weight: 600; }
.pipe-lbl { font-size: 10px; color: var(--t2); margin-top: 2px; }

/* grids */
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 9px; margin-bottom: 10px; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 10px; }

/* team card */
.team-card { border-radius: var(--r); padding: 12px; margin-bottom: 8px; }
.team-card.A { background: rgba(124, 58, 237, 0.08); border: 0.5px solid rgba(124, 58, 237, 0.25); }
.team-card.B { background: rgba(13, 148, 136, 0.08); border: 0.5px solid rgba(13, 148, 136, 0.25); }
.team-card.C { background: rgba(219, 39, 119, 0.08); border: 0.5px solid rgba(219, 39, 119, 0.25); }

/* seller table */
.shdr, .srow { display: grid; grid-template-columns: 82px 38px 44px 40px 44px 50px 46px 1fr; gap: 5px; align-items: center; padding: 7px 8px; font-size: 12px; }
.shdr { font-size: 10px; color: var(--t3); font-weight: 500; border-bottom: 0.5px solid var(--bd); padding-bottom: 5px; }
.srow { border-radius: 7px; cursor: pointer; }
.srow:hover { background: var(--bg2); }

/* bars */
.pbr { height: 4px; border-radius: 2px; background: var(--bg3); overflow: hidden; margin-top: 2px; }
.pbf { height: 100%; border-radius: 2px; }
.sbdg { font-size: 10px; padding: 2px 6px; border-radius: 20px; font-weight: 500; }

/* panel rows */
.prow { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 0.5px solid var(--bd); cursor: pointer; font-size: 12px; }
.prow:last-child { border-bottom: none; }

/* hot cases */
.hlhdr, .hlrow { display: grid; grid-template-columns: 106px 62px 1fr 54px 44px; gap: 5px; align-items: center; padding: 6px 5px; font-size: 11px; }
.hlhdr { font-size: 10px; color: var(--t3); font-weight: 500; border-bottom: 0.5px solid var(--bd); }
.hlrow { border-bottom: 0.5px solid var(--bd); cursor: pointer; }
.hlrow:last-child { border-bottom: none; }
.hlrow:hover { background: var(--bg2); border-radius: 6px; }

/* diligence */
.dilrow { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 0.5px solid var(--bd); }
.dilrow:last-child { border-bottom: none; }
.dilbar { flex: 1; height: 5px; border-radius: 3px; background: var(--bg3); overflow: hidden; }
.dilfill { height: 100%; border-radius: 3px; }

/* follow list */
.lfhdr, .lfrow { display: grid; grid-template-columns: 110px 1fr 56px; gap: 6px; align-items: start; padding: 8px 0; font-size: 12px; }
.lfhdr { font-size: 10px; color: var(--t3); font-weight: 500; border-bottom: 0.5px solid var(--bd); padding-bottom: 5px; }
.lfrow { border-bottom: 0.5px solid var(--bd); cursor: pointer; }
.lfrow:last-child { border-bottom: none; }
.lfrow:hover { background: var(--bg2); }
.hr { border-left: 2px solid var(--red-mid); padding-left: 7px; margin-left: -7px; background: rgba(226, 75, 74, 0.04); border-radius: 0 5px 5px 0; }
.ha { border-left: 2px solid var(--amber-mid); padding-left: 7px; margin-left: -7px; background: rgba(239, 159, 39, 0.04); border-radius: 0 5px 5px 0; }
.hb { border-left: 2px solid var(--blue); padding-left: 7px; margin-left: -7px; background: rgba(24, 95, 165, 0.04); border-radius: 0 5px 5px 0; }

/* booking cards */
.booking-card { border: 0.5px solid var(--bd); border-radius: var(--r); overflow: hidden; margin-bottom: 10px; }
.booking-head { padding: 11px 13px; }
.booking-body { padding: 11px 13px; }
.brow { display: flex; gap: 8px; padding: 4px 0; border-bottom: 0.5px solid var(--bd); font-size: 12px; }
.brow:last-child { border-bottom: none; }
.blbl { color: var(--t3); min-width: 72px; flex-shrink: 0; font-size: 11px; }
.bval { color: var(--t1); flex: 1; }

/* case detail */
.cd-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 12px; }
.cd-kpi { background: var(--bg2); border-radius: var(--r-sm); padding: 9px 10px; }
.cd-kl { font-size: 10px; color: var(--t3); margin-bottom: 3px; }
.cd-kv { font-size: 13px; font-weight: 600; line-height: 1.3; }
.irow { display: flex; gap: 8px; padding: 6px 0; border-bottom: 0.5px solid var(--bd); font-size: 12px; }
.irow:last-child { border-bottom: none; }
.ilbl { color: var(--t3); min-width: 70px; flex-shrink: 0; font-size: 11px; }
.ival { color: var(--t1); flex: 1; line-height: 1.5; }
.upd-item { display: flex; gap: 8px; padding: 6px 0; border-bottom: 0.5px solid var(--bd); font-size: 11px; }
.upd-item:last-child { border-bottom: none; }
.upd-n { color: var(--t3); min-width: 22px; font-size: 10px; padding-top: 1px; }

/* activity */
.act-hdr { display: grid; grid-template-columns: 70px 1fr 55px; gap: 5px; font-size: 10px; color: var(--t3); padding-bottom: 5px; border-bottom: 0.5px solid var(--bd); }
.act-row { display: grid; grid-template-columns: 70px 1fr 55px; gap: 5px; align-items: center; padding: 6px 0; border-bottom: 0.5px solid var(--bd); font-size: 12px; cursor: pointer; }
.act-row:last-child { border-bottom: none; }
.act-row:hover { background: var(--bg2); }

/* chips */
.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; font-size: 12px; border-radius: 20px; border: 0.5px solid var(--bd2); background: transparent; cursor: pointer; color: var(--t2); font-family: inherit; white-space: nowrap; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.chip:hover { border-color: var(--blue); color: var(--t1); }
.chip.on { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 3px 10px rgba(124,58,237,.32); }
.cpill { font-size: 10px; padding: 1px 4px; border-radius: 8px; background: var(--bg2); color: var(--t2); }
.chip.on .cpill { background: rgba(255, 255, 255, 0.2); color: inherit; }
.bdg { font-size: 10px; font-weight: 500; padding: 2px 6px; border-radius: 9px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 2px; }

/* sort/search */
.sbtn { font-size: 11px; padding: 3px 9px; border-radius: 6px; border: 0.5px solid var(--bd2); background: transparent; color: var(--t2); cursor: pointer; font-family: inherit; }
.sbtn.on { background: var(--bg2); color: var(--t1); font-weight: 500; }
input[type="text"], input[type="date"], input[type="month"], input[type="number"], select, textarea { background: var(--bg2); border: 0.5px solid var(--bd2); border-radius: 8px; padding: 6px 9px; font-size: 12px; color: var(--t1); font-family: inherit; outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
select { border-radius: 20px; cursor: pointer; }
.bbtn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--t2); cursor: pointer; padding: 4px 10px; border-radius: 7px; border: 0.5px solid var(--bd); background: var(--bg2); font-family: inherit; }
.av { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-bg); color: var(--blue-dk); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }

/* pagination */
.pg-btn { font-size: 12px; padding: 6px 14px; border-radius: 8px; border: 0.5px solid var(--bd2); background: var(--bg2); color: var(--t2); cursor: pointer; font-family: inherit; }
.pg-btn.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 3px 10px rgba(124,58,237,.32); }

/* date filter bar */
.df-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--bg); border: 0.5px solid var(--bd); border-radius: var(--r-sm); padding: 8px 11px; margin-bottom: 9px; box-shadow: var(--shadow); }
.df-btn { font-size: 11px; padding: 4px 10px; border-radius: 6px; border: 0.5px solid var(--bd2); background: transparent; color: var(--t2); cursor: pointer; font-family: inherit; white-space: nowrap; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.df-btn:hover { border-color: var(--blue); color: var(--t1); }
.df-btn.on { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 500; }

/* lead type bar */
.lt-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 11px; }
.lt-bar { height: 5px; border-radius: 3px; min-width: 2px; }

/* ── ความนุ่มนวลรวม (polish) ── */
.srow, .hlrow, .lfrow, .act-row, .prow, .pg-btn, .sbtn, .bbtn, .av { transition: background .15s ease, transform .12s ease, box-shadow .15s ease, border-color .15s ease; }
.pg-btn:hover { border-color: var(--blue); color: var(--t1); }
.pg-btn:active, .sbtn:active { transform: scale(.97); }
.team-card { transition: transform .18s ease, box-shadow .18s ease; }
.team-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-h); }
.pbf, .dilfill, .lt-bar { transition: width .5s cubic-bezier(.22,.61,.36,1); }
.av { box-shadow: var(--shadow); }

/* progress bars — ไล่สีนุ่มขึ้น */
.pbf { background-image: linear-gradient(90deg, rgba(255,255,255,.18), rgba(255,255,255,0)); }

/* scrollbar บางๆ ให้เข้าธีม */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bd2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--t3); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ลด motion สำหรับคนตั้งค่า reduce-motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: .01ms !important; }
}

@media (max-width: 640px) {
  .g3 { grid-template-columns: 1fr; }
  .g2 { grid-template-columns: 1fr; }
  .shdr, .srow { grid-template-columns: 78px 34px 42px 1fr; }
  .shdr span:nth-child(n + 5), .srow span:nth-child(n + 5), .srow div:nth-child(n + 5) { display: none; }
  /* ตารางที่เลื่อนแนวนอนได้ (ห่อด้วย .hscroll เช่น ตารางคะแนน 12 คอลัมน์) — ไม่ยุบ/ไม่ซ่อนคอลัมน์ ให้เลื่อนดูครบแทน */
  .hscroll .shdr, .hscroll .srow { grid-template-columns: unset; }
  .hscroll .shdr span:nth-child(n + 5), .hscroll .srow span:nth-child(n + 5), .hscroll .srow div:nth-child(n + 5) { display: revert; }
  .cd-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .act-hdr, .act-row { grid-template-columns: 64px 1fr 42px; }
}
