/* ==========================================================================
   Gother QA — Test Case Management System
   ธีมตามแบรนด์ Gother (อ้างอิงหน้า gother.com)
   ==========================================================================

   แนวทางดีไซน์ — ถอดจากหน้าเว็บจริงของ Gother:
   - แถบหัวสีครีมอุ่น, โลโก้แดงส้มสด, การ์ดขาวมุมโค้งใหญ่
   - ชิป/ปุ่มทรงแคปซูล: ตัวที่เลือกอยู่ = แดงทึบ, ที่เหลือ = ครีมจาง
   - "กรอบหกเหลี่ยม" (.hex) คือเอกลักษณ์ของแบรนด์ ใช้แค่ 2 ที่: stat tile กับหัวข้อการ์ด

   กติกาสีที่ห้ามพลาด:
   **สีแดงทึบ = ของที่กดได้เท่านั้น** (ปุ่มหลัก, ชิปที่เลือกอยู่, ลิงก์)
   ส่วนสถานะผลทดสอบเป็น "ป้ายสีจาง" เสมอ — ถ้าเอาแดงทึบไปใช้กับสถานะด้วย
   ทั้งหน้าจะเต็มไปด้วยแดงจนสแกนหาใบที่ fail ไม่เจอ ซึ่งเป็นงานหลักของหน้ารอบทดสอบ

   ประสิทธิภาพ/ความปลอดภัย: ฟอนต์ self-host ไว้ที่ /fonts (ดู public/fonts/README.txt)
   หน้าเว็บไม่ดึงอะไรจากอินเทอร์เน็ตภายนอกเลย (Intranet-Safe)
   ========================================================================== */

/* --------------------------------------------------------------------------
   ฟอนต์ (self-hosted — ห้ามเปลี่ยนไปลิงก์ Google Fonts ดูเหตุผลใน fonts/README.txt)
   unicode-range คัดลอกมาจาก CSS ที่ Google สร้างให้ ห้ามพิมพ์เอง
   -------------------------------------------------------------------------- */

/* Kanit — หัวข้อ/โลโก้/ตัวเลขสรุป */
@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/kanit-600-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/kanit-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/kanit-700-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/kanit-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

/* IBM Plex Sans Thai — เนื้อความ/ฟอร์ม/ตาราง */
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/plex-thai-400-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/plex-thai-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/plex-thai-500-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/plex-thai-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/plex-thai-600-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/plex-thai-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------------
   ตัวแปรสี/ระยะ (design tokens)
   -------------------------------------------------------------------------- */

:root {
  /* แบรนด์ Gother — แดงส้มสด สงวนไว้ให้ "ของที่กดได้" เท่านั้น
     แยกเป็น 2 ค่าโดยตั้งใจ:
     --brand       = สีจริงของแบรนด์ ใช้กับโลโก้ ไอคอน จุดนำสายตา แถบกราฟ (ไม่มีตัวหนังสือขาวทับ)
     --brand-solid = ใช้เฉพาะพื้นทึบที่มี**ตัวหนังสือสีขาว**ทับอยู่ (ปุ่ม, ชิปที่เลือกอยู่)
                     เข้มกว่านิดหน่อยเพราะขาวบน --brand ได้ contrast แค่ 4.04 ซึ่งตกเกณฑ์ WCAG AA
                     (ต้อง ≥ 4.5) ส่วน --brand-solid ได้ 4.72 ผ่าน — ตาเปล่าแทบแยกไม่ออก
                     แต่คนสายตาไม่ดีอ่านปุ่มออกจริง ห้ามเอา --brand มาใช้แทนเพราะ "สีตรงกว่า" */
  --brand: #e8402a;
  --brand-solid: #d8351d;
  --brand-deep: #c22f1b;
  --brand-wash: #fce9e4;

  /* ครีมอุ่น — แถบหัวเว็บและพื้นกรอบหกเหลี่ยม */
  --cream: #f6f3e5;
  --cream-deep: #ece7d2;

  /* พื้นและตัวหนังสือ */
  --paper: #fdfcf8;
  --surface: #ffffff;
  --ink: #22252a;
  --ink-soft: #5c6169;
  /* เข้มกว่าที่ตาอยากได้นิดหน่อยโดยตั้งใจ — ค่านี้ใช้กับหัวตารางและ label ตัวเล็กซึ่งเป็นข้อมูลจริง
     ไม่ใช่ของประดับ สีจางกว่านี้ (#949aa3) ได้ contrast แค่ 2.55 บนพื้นครีม = อ่านไม่ออกจริงๆ */
  --ink-muted: #666b74;
  --line: #eae6da;
  --line-strong: #ddd7c6;

  /* สถานะผลทดสอบ — คุมโทนอุ่นให้กลมกลืน แต่ยังแยกออกจากกันชัดในพริบตา */
  --pass: #12805a;
  --pass-dark: #0d6045;
  --pass-bg: #e7f4ee;
  --pass-line: #b9e0cd;

  --fail: #d5341c;
  --fail-dark: #a82614;
  --fail-bg: #fce9e4;
  --fail-line: #f6c6bb;

  --blocked: #b0700a;
  --blocked-dark: #8a5807;
  --blocked-bg: #fbf0da;
  --blocked-line: #efd8a6;

  --skipped: #6c6558;
  --skipped-dark: #524d43;
  --skipped-bg: #f1eee4;
  --skipped-line: #dcd6c6;

  /* ความโค้ง — การ์ดโค้งใหญ่, ปุ่ม/อินพุตทรงแคปซูล ตามหน้า Gother */
  --r-card: 20px;
  --r-tile: 16px;
  --r-pill: 999px;

  /* เงาอุ่น (ไม่ใช่เงาเทาเย็น) ให้การ์ดดูลอยเหนือพื้นครีม */
  --shadow: 0 2px 8px rgba(60, 50, 30, 0.06), 0 12px 28px -18px rgba(60, 50, 30, 0.28);
  --shadow-lift: 0 4px 12px rgba(60, 50, 30, 0.08), 0 18px 36px -20px rgba(60, 50, 30, 0.34);

  --font-display: 'Kanit', 'IBM Plex Sans Thai', 'Noto Sans Thai', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Thai', 'Noto Sans Thai', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Cascadia Mono', 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

/* --------------------------------------------------------------------------
   พื้นฐาน
   -------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

/*
 * หน้าสาธารณะดูผลการทดสอบ (FR-9 extension) ไม่มี topbar/nav มาช่วยกินพื้นที่แนวนอนเหมือนหน้าอื่น
 * ให้กว้างกว่า main ปกติ กันไม่ให้การ์ดดูจมอยู่กลางพื้นที่ว่างเปล่าบนจอกว้าง — ยังจำกัดความกว้าง
 * ไว้ (ไม่ full-bleed) เพื่อไม่ให้บรรทัด prose ยาวจนอ่านยาก
 */
main.main-public-result {
  max-width: 1440px;
}

a {
  color: var(--brand-deep);
  text-decoration-color: color-mix(in srgb, var(--brand-deep) 35%, transparent);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--brand);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--cream);
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-pill);
  border: 2px solid var(--cream);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-muted);
}

/* --------------------------------------------------------------------------
   ตัวหนังสือ
   -------------------------------------------------------------------------- */

h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.75rem;
}

h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.5rem;
}

.subtitle {
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}

.subheading {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.muted {
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.9em;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.4em;
}

.prose {
  line-height: 1.7;
  color: var(--ink);
  margin: 0;
  white-space: pre-wrap;
}

.hint,
.field-hint {
  font-size: 0.85rem;
  color: var(--brand-solid);
  margin: 0.35rem 0 0;
}

.field-hint {
  margin: 0.35rem 0 1rem 0;
}

/* --------------------------------------------------------------------------
   กรอบหกเหลี่ยม (.hex) — เอกลักษณ์ของแบรนด์ Gother
   ไอคอนอยู่ใน CSS ที่เดียวทั้งหมด EJS เขียนแค่ <span class="hex hex-run"></span>
   เพิ่มไอคอนใหม่ = เพิ่ม .hex-<ชื่อ>::before อีกบล็อกด้านล่าง ไม่ต้องแตะ template
   -------------------------------------------------------------------------- */

.hex {
  --hex-size: 40px;
  width: var(--hex-size);
  height: calc(var(--hex-size) * 1.08);
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  background: var(--cream);
  clip-path: polygon(50% 0%, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%);
}

.hex::before {
  content: '';
  width: 55%;
  height: 55%;
  background: var(--brand);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* ไอคอนแบบเส้น 24×24 — เลือกแบบเส้นแทนแบบทึบเพราะอ่านง่ายกว่าที่ขนาดเล็กในหน้าที่ข้อมูลแน่น */
.hex-case::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='m9 14 2 2 4-4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='m9 14 2 2 4-4'/%3E%3C/svg%3E");
}

.hex-archive::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='4' rx='1'/%3E%3Cpath d='M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8'/%3E%3Cpath d='M10 13h4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='4' rx='1'/%3E%3Cpath d='M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8'/%3E%3Cpath d='M10 13h4'/%3E%3C/svg%3E");
}

.hex-area::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3 9 5-9 5-9-5z'/%3E%3Cpath d='m3 13 9 5 9-5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3 9 5-9 5-9-5z'/%3E%3Cpath d='m3 13 9 5 9-5'/%3E%3C/svg%3E");
}

.hex-gap::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 4.3 2.6 18a1.5 1.5 0 0 0 1.3 2.2h16.2a1.5 1.5 0 0 0 1.3-2.2L13.7 4.3a1.5 1.5 0 0 0-2.6 0z'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 4.3 2.6 18a1.5 1.5 0 0 0 1.3 2.2h16.2a1.5 1.5 0 0 0 1.3-2.2L13.7 4.3a1.5 1.5 0 0 0-2.6 0z'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
}

.hex-run::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m10 8.5 5.5 3.5L10 15.5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m10 8.5 5.5 3.5L10 15.5z'/%3E%3C/svg%3E");
}

.hex-chart::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 20V11'/%3E%3Cpath d='M12 20V4'/%3E%3Cpath d='M19 20v-6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 20V11'/%3E%3Cpath d='M12 20V4'/%3E%3Cpath d='M19 20v-6'/%3E%3C/svg%3E");
}

.hex-jira::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.1 0l2.4-2.4a5 5 0 0 0-7.1-7.1L11 4.9'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.1 0l-2.4 2.4a5 5 0 0 0 7.1 7.1l1.4-1.4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.1 0l2.4-2.4a5 5 0 0 0-7.1-7.1L11 4.9'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.1 0l-2.4 2.4a5 5 0 0 0 7.1 7.1l1.4-1.4'/%3E%3C/svg%3E");
}

.hex-info::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E");
}

.hex-steps::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6h11'/%3E%3Cpath d='M9 12h11'/%3E%3Cpath d='M9 18h11'/%3E%3Cpath d='M4.5 6h.01'/%3E%3Cpath d='M4.5 12h.01'/%3E%3Cpath d='M4.5 18h.01'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6h11'/%3E%3Cpath d='M9 12h11'/%3E%3Cpath d='M9 18h11'/%3E%3Cpath d='M4.5 6h.01'/%3E%3Cpath d='M4.5 12h.01'/%3E%3Cpath d='M4.5 18h.01'/%3E%3C/svg%3E");
}

.hex-check::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12 2.5 2.5 4.5-5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12 2.5 2.5 4.5-5'/%3E%3C/svg%3E");
}

.hex-tester::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M3 20a6 6 0 0 1 12 0'/%3E%3Cpath d='M17 8.5a3 3 0 0 1 0 5.5'/%3E%3Cpath d='M18.5 20a5.5 5.5 0 0 0-2-4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M3 20a6 6 0 0 1 12 0'/%3E%3Cpath d='M17 8.5a3 3 0 0 1 0 5.5'/%3E%3Cpath d='M18.5 20a5.5 5.5 0 0 0-2-4'/%3E%3C/svg%3E");
}

.hex-priority::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 21V4'/%3E%3Cpath d='M5 4h11l-2 3.5L16 11H5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 21V4'/%3E%3Cpath d='M5 4h11l-2 3.5L16 11H5z'/%3E%3C/svg%3E");
}

.hex-reason::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9.5a2.6 2.6 0 0 1 5 .9c0 1.7-2.5 2.1-2.5 3.6'/%3E%3Cpath d='M12 17.5h.01'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9.5a2.6 2.6 0 0 1 5 .9c0 1.7-2.5 2.1-2.5 3.6'/%3E%3Cpath d='M12 17.5h.01'/%3E%3C/svg%3E");
}

.hex-import::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V3'/%3E%3Cpath d='m7 8 5-5 5 5'/%3E%3Cpath d='M4 17v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V3'/%3E%3Cpath d='m7 8 5-5 5 5'/%3E%3Cpath d='M4 17v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   แถบหัวเว็บ — แถบครีมแถวเดียว โลโก้ซ้าย เมนูเป็นชิป
   -------------------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.5rem;
  min-height: 64px;
  background: var(--cream);
  border-bottom: 1px solid var(--cream-deep);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  text-decoration: none;
  flex: 0 0 auto;
}

.topbar-brand:hover {
  text-decoration: none;
}

/* wordmark — จัดด้วยฟอนต์ Kanit ไม่ได้ใช้ไฟล์โลโก้ตัวจริง
   ถ้าทีมมีไฟล์ SVG โลโก้ Gother อยู่แล้ว เอามาวางแทน .brand-mark ได้เลย */
.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--brand);
}

.brand-sub {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--cream-deep);
  border-radius: var(--r-pill);
  padding: 0.15rem 0.5rem;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar-nav::-webkit-scrollbar {
  display: none;
}

.topbar-nav a {
  display: inline-block;
  white-space: nowrap;
  padding: 0.42rem 0.9rem;
  border-radius: var(--r-pill);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.topbar-nav a:hover {
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

/* ชิปที่เลือกอยู่ = แดงทึบ เหมือนแถบตัวกรองในหน้า Gother */
.topbar-nav a.is-current {
  background: var(--brand-solid);
  color: #fff;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.topbar-user span {
  font-size: 0.85rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.topbar-user form {
  margin: 0;
}

/* --------------------------------------------------------------------------
   หัวหน้าเพจ / การ์ด
   -------------------------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.page-head h1 {
  margin-bottom: 0.35rem;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.4rem;
}

.eyebrow a {
  color: var(--ink-muted);
  text-decoration: none;
}

.eyebrow a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.head-actions form {
  margin: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.card-narrow {
  max-width: 460px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

/* หัวข้อการ์ดใช้หกเหลี่ยมขนาดเล็ก — จุดที่ 2 (จาก 2 จุด) ที่ลวดลายนี้ปรากฏ */
.card-title .hex {
  --hex-size: 30px;
}

.card-expected {
  border-color: var(--pass-line);
  background: linear-gradient(var(--pass-bg), var(--pass-bg)) padding-box;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

/**
 * การ์ดขนาดเท่ากันแถวละ 2 ใบ (dashboard ของรอบทดสอบ) — ต่างจาก .detail-grid ตรงที่
 * ที่นี่การ์ดเป็น grid item ตรงๆ ไม่ได้ซ้อนอยู่ใน wrapper ของแต่ละคอลัมน์
 *
 * `align-items: start` ห้ามเปลี่ยนเป็น stretch — ความสูงกราฟคิดจากจำนวนกลุ่ม
 * (ดู _breakdown.ejs) การ์ด Module ที่มี 16 module สูงกว่าการ์ดความสำคัญที่มี 3 กลุ่ม
 * หลายเท่า ถ้ายืดให้เท่ากันจะได้การ์ดที่ว่างเปล่าครึ่งใบ
 */
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: start;
}

/* .card มี margin-bottom ติดมาอยู่แล้ว ถ้าไม่ล้างจะบวกกับ gap เป็น 2.5rem
   ทำให้ระยะห่างแนวตั้งไม่เท่าแนวนอน */
.breakdown-grid > .card {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   ปุ่มและลิงก์ที่ทำหน้าที่เป็นปุ่ม — ทรงแคปซูลทั้งหมด
   -------------------------------------------------------------------------- */

/**
 * ปุ่มหลัก (สีแดงทึบ) — ปกติควรมีแค่ปุ่มเดียวต่อหน้า
 *
 * ⚠️ ต้องเขียน :not() ไล่ยกเว้นให้ครบทุกคลาสย่อย เพราะ `button[type='submit']` มีความจำเพาะ
 * (0,1,1) สูงกว่าคลาสเปล่าอย่าง `.btn-quiet` (0,1,0) — ถ้าไม่ยกเว้น ปุ่มพวกนั้นจะกลายเป็น
 * ปุ่มแดงทึบหมด (เคยพลาดมาแล้วตอนทำธีมนี้: ปุ่ม "ออกจากระบบ" บนหัวเว็บ และปุ่ม "เก็บเข้าคลัง"
 * ที่ดันเด่นเท่าปุ่ม "แก้ไข" ทั้งที่เป็นการกระทำที่ควรกดยากกว่า)
 *
 * **เพิ่มคลาสปุ่มแบบใหม่เมื่อไหร่ ต้องมาเติมใน :not() ตรงนี้ด้วยเสมอ**
 * ตอนนี้มี 3 ตัว: .link-button (ปุ่มหน้าตาเหมือนลิงก์), .result-btn (ปุ่มผลทดสอบ 4 ปุ่ม),
 * .btn-quiet (ปุ่มรอง)
 */
button[type='submit']:not(.link-button):not(.result-btn):not(.btn-quiet),
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.6rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--brand-solid);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

button[type='submit']:not(.link-button):not(.result-btn):not(.btn-quiet):hover,
.btn:hover {
  background: var(--brand-deep);
  color: #fff;
  text-decoration: none;
}

button[type='submit']:not(.link-button):not(.result-btn):not(.btn-quiet):active,
.btn:active {
  transform: translateY(1px);
}

.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-quiet:hover {
  background: var(--cream);
  border-color: var(--ink-muted);
  color: var(--ink);
  text-decoration: none;
}

/* ปุ่มที่หน้าตาเหมือนลิงก์ — ใช้ในฟอร์มเล็กๆ ที่ปุ่มจริงจะหนักเกินไป */
.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brand-deep);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-button:hover {
  color: var(--brand);
}

/* --------------------------------------------------------------------------
   ฟอร์ม
   -------------------------------------------------------------------------- */

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='search'],
input[type='number'],
input[type='date'],
select,
textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 0.55rem 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  border-radius: var(--r-tile);
  line-height: 1.6;
  resize: vertical;
  min-height: 6rem;
}

textarea.mono {
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

input[type='text']:focus,
input[type='email']:focus,
input[type='password']:focus,
input[type='search']:focus,
input[type='number']:focus,
input[type='date']:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-wash);
}

/**
 * checkbox/radio แบบเดี่ยวๆ นอก .pick-list (เช่นหน้า /settings/alerts) — label ครอบ input
 * ไว้ในตัวเดียวกัน ต่างจาก label ปกติที่เป็น block อยู่คนละบรรทัดกับ input ของมัน
 * ใช้ flex ให้กล่องกับข้อความอยู่บรรทัดเดียวกัน แนวเดียวกับ .pick-list label ด้านล่าง
 */
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 400;
  cursor: pointer;
}

input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ช่องตัวเลขสั้นๆ ที่วางแทรกกลางประโยค เช่น "จำนวนตายตัว [__] ใบ" ในหน้า /settings/alerts */
.input-number-inline {
  width: 5rem;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%235c6169' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 11px;
  padding-right: 2.2rem;
  cursor: pointer;
}

select:hover {
  border-color: var(--ink-muted);
}

select:disabled {
  background-color: var(--cream);
  color: var(--ink-muted);
  cursor: not-allowed;
}

input[type='file'] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 0.6rem 0;
}

input[type='file']::file-selector-button {
  font: inherit;
  font-weight: 600;
  margin-right: 0.75rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
}

input[type='file']::file-selector-button:hover {
  background: var(--cream-deep);
}

.form-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.form-actions button {
  flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   แถบตัวกรอง
   -------------------------------------------------------------------------- */

.filter-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 1.25rem 1.35rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
}

.filter-field {
  flex: 1 1 165px;
  min-width: 0;
}

.filter-field label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}

.filter-field select,
.filter-field input {
  margin-bottom: 0;
}

.filter-grow {
  flex: 2 1 260px;
}

.filter-area {
  margin: 1.1rem 0 0;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  background: var(--paper);
}

.filter-area legend {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0 0.4rem;
}

.filter-area .field-hint {
  margin: 0 0 0.85rem;
}

.filter-area .trail {
  margin-top: 0.85rem;
}

.filter-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}

.filter-actions button {
  flex: 0 0 auto;
}

/**
 * ตัวกรอง Module แบบติ๊กได้หลายค่า (หน้า /test-runs/new) — ต่างจาก .pick-list ตรงที่รายการนี้
 * สั้นและคงที่ (จำนวน module ในระบบ) จึงจัดเป็นแถวห่อบรรทัด (wrap) แทนลิสต์แนวตั้งยาว
 * มี max-height กันไว้เผื่อวันหนึ่ง module เยอะขึ้นมาก จะได้ไม่ดันเลย์เอาต์ทั้งหน้า
 */
.module-check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  max-height: 11rem;
  overflow-y: auto;
  padding: 0.2rem 0;
}

.filter-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: var(--brand-wash);
  border: 1px solid var(--fail-line);
  border-radius: var(--r-pill);
  padding: 0.6rem 1.1rem;
  font-size: 0.875rem;
  margin: 0 0 1.1rem;
}

.filter-note a {
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   ชิป/แท็บ — ตัวที่เลือกอยู่แดงทึบ ที่เหลือครีมจาง (ตามแถบตัวกรองหน้า Gother)
   -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tab:hover {
  background: var(--cream);
  border-color: var(--line-strong);
  color: var(--ink);
  text-decoration: none;
}

.tab.is-active {
  background: var(--brand-solid);
  border-color: var(--brand-solid);
  color: #fff;
}

.tab-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--cream);
  color: var(--ink-soft);
  border-radius: var(--r-pill);
  padding: 0.05rem 0.45rem;
}

.tab.is-active .tab-count {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

/* --------------------------------------------------------------------------
   ตาราง — ความหนาแน่นเท่าเดิม ไม่ให้ธีมที่โปร่งขึ้นทำให้สแกนข้อมูลช้าลง
   -------------------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
}

td {
  vertical-align: top;
}

.data-table {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 0.9rem;
}

.data-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--cream);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--cream-deep);
  white-space: nowrap;
}

.data-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.data-table tbody tr {
  transition: background-color 0.12s ease;
}

.data-table tbody tr:hover {
  background: var(--paper);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.col-narrow {
  width: 1%;
  white-space: nowrap;
}

.cell-alert {
  color: var(--fail);
  font-weight: 700;
}

.row-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
}

.row-title:hover {
  color: var(--brand);
  text-decoration: underline;
}

.list-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0 0.35rem;
}

.pager {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
}

/* --------------------------------------------------------------------------
   เส้นทาง taxonomy (.trail)
   -------------------------------------------------------------------------- */

.trail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
}

.trail-inline {
  margin-top: 0.3rem;
}

.trail-seg {
  background: var(--cream);
  border: 1px solid var(--cream-deep);
  border-radius: var(--r-pill);
  padding: 0.1rem 0.55rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ช่องที่ยังไม่ได้เลือก — ต้องอ่านออกว่าเป็น "ช่องว่างที่รอเลือก" ไม่ใช่จุดเล็กๆ ที่ดูเหมือนขยะ */
.trail-seg.is-empty {
  background: transparent;
  border-style: dashed;
  border-color: var(--line-strong);
  color: var(--ink-muted);
  min-width: 3.25rem;
  text-align: center;
}

.trail-sep {
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.taxonomy-note {
  background: var(--cream);
  border: 1px solid var(--cream-deep);
  border-radius: var(--r-tile);
  padding: 0.8rem 1.1rem;
  font-size: 0.875rem;
  color: var(--ink-soft);
  margin: 0 0 1.25rem;
}

/* --------------------------------------------------------------------------
   ป้ายสถานะ / แท็ก / ความสำคัญ
   -------------------------------------------------------------------------- */

/* ป้ายผลทดสอบเป็น "สีจาง" เสมอ ไม่ใช่สีทึบ — ดูกติกาสีด้านบนสุดของไฟล์ */
.result-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--r-pill);
  padding: 0.2rem 0.7rem;
  border: 1px solid transparent;
  white-space: nowrap;
}

.result-badge.seg-pass {
  background: var(--pass-bg);
  border-color: var(--pass-line);
  color: var(--pass-dark);
}
.result-badge.seg-fail {
  background: var(--fail-bg);
  border-color: var(--fail-line);
  color: var(--fail-dark);
}
.result-badge.seg-blocked {
  background: var(--blocked-bg);
  border-color: var(--blocked-line);
  color: var(--blocked-dark);
}
.result-badge.seg-skipped {
  background: var(--skipped-bg);
  border-color: var(--skipped-line);
  color: var(--skipped-dark);
}
.result-badge.seg-pending {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-muted);
}

/* สีทึบของแต่ละสถานะ — ใช้กับแถบความคืบหน้าและจุดนำสายตาเท่านั้น */
.seg-pass {
  background: var(--pass);
}
.seg-fail {
  background: var(--fail);
}
.seg-blocked {
  background: var(--blocked);
}
.seg-skipped {
  background: var(--skipped);
}

.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: var(--r-pill);
  padding: 0.18rem 0.65rem;
  border: 1px solid transparent;
}

.status-done {
  background: var(--pass-bg);
  border-color: var(--pass-line);
  color: var(--pass-dark);
}
.status-indeterminate {
  background: var(--blocked-bg);
  border-color: var(--blocked-line);
  color: var(--blocked-dark);
}
.status-new {
  background: var(--cream);
  border-color: var(--cream-deep);
  color: var(--ink-soft);
}

.badge-archived {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--skipped-bg);
  border: 1px solid var(--skipped-line);
  color: var(--skipped-dark);
  border-radius: var(--r-pill);
  padding: 0.12rem 0.6rem;
  margin-left: 0.5rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

/* tag เป็นข้อมูลกลางๆ ไม่ได้บอกสถานะอะไร จึงต้องไม่ใช้โทนแดง
   ไม่งั้นแถวที่มี tag เยอะจะดูเหมือนมีอะไรผิดปกติ และไปแย่งสายตากับป้าย "ไม่ผ่าน" */
.tag {
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--cream);
  border: 1px solid var(--cream-deep);
  color: var(--ink-soft);
  border-radius: var(--r-pill);
  padding: 0.08rem 0.55rem;
}

.prio {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--r-pill);
  padding: 0.12rem 0.6rem;
  border: 1px solid transparent;
  white-space: nowrap;
}

.prio-high {
  background: var(--fail-bg);
  border-color: var(--fail-line);
  color: var(--fail-dark);
}
.prio-medium {
  background: var(--blocked-bg);
  border-color: var(--blocked-line);
  color: var(--blocked-dark);
}
.prio-low {
  background: var(--cream);
  border-color: var(--cream-deep);
  color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   ความคืบหน้ารอบทดสอบ
   -------------------------------------------------------------------------- */

.progress-card {
  padding-bottom: 1.1rem;
}

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

/* หมายเหตุสำหรับคนแก้ทีหลัง: ชื่อคลาสนี้และตัวเลขที่ติดกับ > มี test จับอยู่
   (dashboard.test.js) ห้ามเปลี่ยนชื่อคลาส และห้ามแทรกช่องว่างคั่นตัวเลขใน template */
.progress-percent {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  margin-right: 0.55rem;
}

.progress-bar {
  display: flex;
  height: 10px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--cream-deep);
  margin-bottom: 0.9rem;
}

.progress-seg {
  display: block;
  height: 100%;
}

.result-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 0.28rem 0.75rem;
}

.result-legend a.legend-item {
  border-color: var(--line);
  background: var(--surface);
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.result-legend a.legend-item:hover {
  background: var(--cream);
  border-color: var(--line-strong);
  color: var(--ink);
  text-decoration: none;
}

.result-legend a.legend-item.is-active {
  background: var(--brand-solid);
  border-color: var(--brand-solid);
  color: #fff;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.legend-dot.seg-pending {
  background: var(--line-strong);
}

/* --------------------------------------------------------------------------
   กราฟ (FR-13 + การ์ดแยกมิติ) — วาดด้วย Chart.js บน <canvas>
   ไลบรารีอยู่ที่ public/js/vendor/ ไม่ดึงจาก CDN (ดู vendor/README.txt)
   -------------------------------------------------------------------------- */

/**
 * Chart.js แบบ responsive ต้องการกล่องครอบที่ "มีความสูงแน่นอน"
 * ถ้าไม่กำหนด กราฟจะสูงเป็น 0 (มองไม่เห็นอะไรเลย) หรือยืดไม่หยุดจนหน้าเว็บพัง
 * — position: relative จำเป็นเพราะ Chart.js วาง canvas แบบ absolute ข้างใน
 */
.chart-box {
  position: relative;
  width: 100%;
  height: 260px;
}

.chart-box-trend {
  height: 300px;
}

.chart-box canvas {
  display: block;
}

/* ตาราง/รายการตัวเลขใต้กราฟ — fallback ที่ต้องมีเสมอ (canvas อ่านด้วย screen reader ไม่ได้
   และถ้าปิด JavaScript กราฟจะไม่ขึ้นเลย) */
.trend-data,
.chart-data {
  margin-top: 0.9rem;
  font-size: 0.875rem;
}

.trend-data summary,
.chart-data summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-weight: 500;
  user-select: none;
}

.trend-data summary:hover,
.chart-data summary:hover {
  color: var(--brand);
}

.trend-data .data-table {
  margin-top: 0.75rem;
}

.chart-data-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.chart-data-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
}

.chart-data-list li:last-child {
  border-bottom: none;
}

.chart-data-label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
}

.trend-notes {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.trend-notes .field-hint + .field-hint {
  margin-top: 0.5rem;
}

/* หัวการ์ดที่มีปุ่มอยู่ขวาสุด (เช่นการ์ดแนวโน้มบนหน้าแรก) */
.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.card-head-row .card-title {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   แถวสรุปรายกลุ่มบนหน้า dashboard ของรอบ (src/views/test-runs/_breakdown.ejs)
   -------------------------------------------------------------------------- */

.breakdown {
  list-style: none;
  margin: 0;
  padding: 0;
}

.breakdown li + li {
  margin-top: 0.85rem;
}

.breakdown-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}

.breakdown-label {
  font-size: 0.88rem;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breakdown-count {
  flex: 0 0 auto;
}

/* แถบในแถวสรุปเตี้ยกว่าแถบรวมด้านบน เพื่อให้ลำดับความสำคัญทางสายตาถูกต้อง
   (แถบรวมของทั้งรอบต้องเด่นที่สุดในหน้า) */
.breakdown .progress-bar {
  height: 8px;
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   แถวบันทึกผลการรัน
   -------------------------------------------------------------------------- */

.run-row {
  padding: 1.1rem 1.35rem;
}

.run-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.run-row-status {
  text-align: right;
  flex: 0 0 auto;
}

/*
 * .run-note/.history-note เก็บ HTML จาก WYSIWYG editor (Quill, FR-4 extension) ตั้งแต่
 * 2026-08-24 — sanitize แล้วเสมอตอนบันทึก (ดู src/lib/richNotes.js) จึง render แบบ <%- %> ได้
 * ตรงๆ ไม่ต้อง white-space: pre-wrap อีกต่อไป เพราะ <p>/<br>/<li> จัดการขึ้นบรรทัดให้เองแล้ว
 */
.run-note {
  background: var(--paper);
  border-left: 3px solid var(--line-strong);
  border-radius: 0 var(--r-tile) var(--r-tile) 0;
  padding: 0.55rem 0.9rem;
  margin: 0.85rem 0 0.4rem;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.run-note > :first-child,
.history-note > :first-child {
  margin-top: 0;
}

.run-note > :last-child,
.history-note > :last-child {
  margin-bottom: 0;
}

.run-note ul,
.run-note ol,
.history-note ul,
.history-note ol {
  margin: 0.3rem 0;
  padding-left: 1.3rem;
}

.run-note blockquote,
.history-note blockquote {
  margin: 0.3rem 0;
  padding-left: 0.75rem;
  border-left: 2px solid var(--line-strong);
  color: var(--ink-soft);
}

.run-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* ต้อง wrap ได้ เพราะ execution-reason.js แทรก dropdown เหตุผลกับข้อความเตือนเข้ามาในแถวนี้
   ตอนกด "ติดปัญหา"/"ข้าม" — ถ้าไม่ให้ wrap ทุกอย่างจะเบียดกันจนอ่าน dropdown ไม่ออก */
.run-form-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1 1 320px;
  min-width: 0;
}

.run-form-fields input {
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
  margin-bottom: 0;
}

/*
 * notes เป็น WYSIWYG แล้ว (Quill, FR-4 extension) — กว้างเต็มแถวเสมอ (flex-basis 100%) ไม่ใช่
 * ช่องแคบเรียงข้าง BUG/dropdown อีกต่อไป เพราะเป็น editor หลายบรรทัดที่ต้องการพื้นที่พอสมควร
 * `.notes-textarea` = fallback ตอน JS ปิด/พัง, `.notes-editor` = container ที่ Quill mount แทนที่
 */
.run-form-fields .notes-textarea,
.run-form-fields .notes-editor {
  flex: 1 1 100%;
  min-width: 0;
}

.run-form-fields textarea.notes-textarea {
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
  margin-bottom: 0;
  min-height: 4.5rem;
}

.notes-editor {
  background: var(--surface);
  border-radius: var(--r-tile);
  overflow: hidden;
}

.notes-editor .ql-toolbar.ql-snow {
  border-color: var(--line-strong);
  border-radius: var(--r-tile) var(--r-tile) 0 0;
}

.notes-editor .ql-container.ql-snow {
  border-color: var(--line-strong);
  border-radius: 0 0 var(--r-tile) var(--r-tile);
  font-family: var(--font-body);
  font-size: 0.92rem;
  min-height: 5rem;
}

.run-form-fields input[name='bugJiraKey'] {
  width: 8.5rem;
  flex: 0 0 auto;
}

/* dropdown เหตุผลของ "ติดปัญหา"/"ข้าม" (FR-4)
   ซ่อน/แสดงจริงทำที่ public/js/execution-reason.js — ค่าเริ่มต้นจาก server ต้องมองเห็นเสมอ
   เผื่อ JS ปิดอยู่ ห้ามใส่ display:none ตายตัวไว้ที่นี่ */
.reason-select {
  flex: 1 1 240px;
  min-width: 200px;
  margin-bottom: 0;
  padding: 0.45rem 2.2rem 0.45rem 0.9rem;
  font-size: 0.88rem;
}

.reason-hint {
  flex: 1 1 100%;
  margin: 0;
}

.run-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

/* ปุ่มผลทดสอบ 4 ปุ่ม — ปกติเป็นเส้นขอบจางๆ แล้วค่อยติดสีของตัวเองตอน hover
   ทำแบบนี้เพื่อไม่ให้มีปุ่มสีทึบ 4 สีเรียงกันในทุกแถว ซึ่งจะกลบสถานะจริงของแถวนั้น */
.result-btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.42rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.result-btn:hover {
  border-color: var(--ink-muted);
  color: var(--ink);
}

.btn-pass:hover {
  background: var(--pass-bg);
  border-color: var(--pass);
  color: var(--pass-dark);
}
.btn-fail:hover {
  background: var(--fail-bg);
  border-color: var(--fail);
  color: var(--fail-dark);
}
.btn-blocked:hover {
  background: var(--blocked-bg);
  border-color: var(--blocked);
  color: var(--blocked-dark);
}
.btn-skipped:hover {
  background: var(--skipped-bg);
  border-color: var(--skipped);
  color: var(--skipped-dark);
}

.run-history {
  margin-top: 0.9rem;
  font-size: 0.875rem;
}

.run-history summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-weight: 500;
  user-select: none;
}

.run-history summary:hover {
  color: var(--brand);
}

.history-list {
  list-style: none;
  margin: 0.7rem 0 0;
  padding: 0;
}

.history-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.history-list li:last-child {
  border-bottom: none;
}

.history-note {
  color: var(--ink-soft);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
  /* เนื้อหาอาจเป็น HTML หลายบรรทัด (list/blockquote) — ให้ขึ้นบรรทัดใหม่แยกจากแถวป้าย/วันที่ */
  flex-basis: 100%;
}

.export-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.export-links a {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.32rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-soft);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.export-links a:hover {
  background: var(--cream);
  border-color: var(--ink-muted);
  color: var(--ink);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   ไฟล์แนบผลการรัน (FR-4)
   -------------------------------------------------------------------------- */

.attachment-upload {
  flex: 1 1 100%;
  font-size: 0.85rem;
}

.attachment-upload summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-weight: 500;
  user-select: none;
}

.attachment-upload summary:hover {
  color: var(--brand);
}

.attachment-upload input[type='file'] {
  display: block;
  margin: 0.5rem 0 0.25rem;
  font-size: 0.85rem;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.attachment-thumb-link {
  display: block;
  line-height: 0;
  border-radius: var(--r-tile);
  overflow: hidden;
  border: 1px solid var(--line);
  transition: border-color 0.15s ease;
}

.attachment-thumb-link:hover {
  border-color: var(--brand);
}

.attachment-thumb {
  display: block;
  width: 108px;
  height: 76px;
  object-fit: cover;
}

.attachment-video {
  width: 220px;
  border-radius: var(--r-tile);
  border: 1px solid var(--line);
  background: #000;
}

.attachment-expired {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* --------------------------------------------------------------------------
   แผง Jira
   -------------------------------------------------------------------------- */

.jira-summary {
  font-weight: 600;
  margin: 0 0 0.6rem;
  line-height: 1.5;
}

.jira-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.jira-foot form {
  margin: 0;
}

.jira-link-state,
.jira-comment-state {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.jira-comment-state p {
  margin: 0 0 0.5rem;
}

.jira-comment-state form {
  margin: 0;
}

/* --------------------------------------------------------------------------
   ข้อความสถานะ / กล่องแจ้งเตือน
   -------------------------------------------------------------------------- */

.field-status {
  font-size: 0.86rem;
  font-weight: 600;
  margin: 0.5rem 0 0.7rem;
}

.field-status.is-ok {
  color: var(--pass-dark);
}

.field-status.is-warn {
  color: var(--blocked-dark);
}

.error-box,
.ok-box {
  border-radius: var(--r-card);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.error-box {
  background: var(--fail-bg);
  border: 1px solid var(--fail-line);
  color: var(--fail-dark);
}

.error-title {
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.error-box ul {
  margin: 0;
  padding-left: 1.2rem;
}

.ok-box {
  background: var(--pass-bg);
  border: 1px solid var(--pass-line);
  color: var(--pass-dark);
}

.ok-box a {
  color: var(--pass-dark);
  font-weight: 600;
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-card);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--ink-soft);
}

.empty p {
  margin: 0 0 0.6rem;
}

.empty p:last-child {
  margin-bottom: 0;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   รายละเอียด Test Case — ขั้นตอน / ข้อมูล
   -------------------------------------------------------------------------- */

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 0.85rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}

.steps li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* เลขลำดับขั้นตอนมีความหมายจริง (ต้องทำตามลำดับ) จึงแสดงเป็นตัวเลขไม่ใช่จุด */
.steps li::before {
  content: counter(step);
  flex: 0 0 auto;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cream);
  border: 1px solid var(--cream-deep);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.step-text {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.65;
  white-space: pre-wrap;
}

.meta {
  margin: 0;
  font-size: 0.9rem;
}

.meta dt {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.2rem;
}

.meta dd {
  margin: 0 0 0.95rem;
}

.meta dd:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   แดชบอร์ด
   -------------------------------------------------------------------------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stat-tile .hex {
  margin-bottom: 0.5rem;
}

a.stat-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--line-strong);
  text-decoration: none;
  color: inherit;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}

.stat-value.is-alert {
  color: var(--fail);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.latest-run-name {
  margin: 0 0 0.2rem;
  font-size: 1.02rem;
}

.mini-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  font-size: 0.9rem;
}

.mini-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.mini-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.mini-list li a {
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.mini-list li a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.module-bars {
  list-style: none;
  margin: 0;
  padding: 0;
}

.module-bars li {
  display: grid;
  grid-template-columns: minmax(0, 42%) 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
}

/* ชื่อ module ตัดคำน้อยที่สุดเท่าที่ทำได้ — "module ไหนยังว่าง" คือข้อมูลที่คนเปิดหน้านี้มาหา
   ถ้าชื่อโดนตัดจนอ่านไม่ออกก็ตอบคำถามนั้นไม่ได้ (ชื่อยาวจริงๆ ค่อยพึ่ง title tooltip) */
.module-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-name:hover {
  color: var(--brand);
  text-decoration: underline;
}

.module-bar-track {
  display: block;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--cream-deep);
  overflow: hidden;
}

.module-bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--brand);
}

/* module ที่ยังไม่มี test case เลย — ต้องมองเห็นว่า "ว่าง" ไม่ใช่แถบบางๆ ที่ดูเหมือนมีนิดหน่อย */
.module-bar-fill.is-empty {
  background: transparent;
}

.module-count {
  font-size: 0.85rem;
  color: var(--ink-soft);
  min-width: 2ch;
  text-align: right;
}

.module-count.is-alert {
  color: var(--fail);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   เลือก Test Case เข้ารอบ
   -------------------------------------------------------------------------- */

.pick-actions {
  margin: 0 0 0.6rem;
}

.pick-actions label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  margin: 0;
  cursor: pointer;
}

.pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 27rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
}

.pick-list li {
  border-bottom: 1px solid var(--line);
  transition: background-color 0.12s ease;
}

.pick-list li:last-child {
  border-bottom: none;
}

.pick-list li:hover {
  background: var(--paper);
}

.pick-list label {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0;
  padding: 0.6rem 0.9rem;
  font-weight: 400;
  cursor: pointer;
}

.pick-list input[type='checkbox'] {
  margin-top: 0.25rem;
  flex: 0 0 auto;
  accent-color: var(--brand);
  width: 15px;
  height: 15px;
}

.pick-title {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   หน้าจัดการ Test Area (Admin)
   -------------------------------------------------------------------------- */

.row-action {
  margin: 0;
}

.row-action button[type='submit'] {
  padding: 0;
}

/* --------------------------------------------------------------------------
   หน้าล็อกอิน — จัดกลางจอ, การ์ดแคบ

   ใช้ class `.login-page` บน body ตรงๆ (ตั้งค่าที่ res.render('login', { bodyClass: ... })
   ใน src/routes/auth.js) ไม่ใช่ selector แบบ `body:not(:has(.topbar))` เหมือนเดิม — เพราะ
   ตอนนั้นสมมติไว้ผิดว่ามีแค่หน้าล็อกอินหน้าเดียวที่ไม่มี .topbar ไม่มี currentUser พอเพิ่มหน้า
   สาธารณะดูผลการทดสอบ (`/public/results/:token`, ไม่มี currentUser เหมือนกัน) เข้ามา หน้านั้น
   ก็โดนบีบเป็นการ์ดแคบ 460px ตามไปด้วยแบบเงียบๆ (ตัดสินใจแล้ว 2026-08-24)
   -------------------------------------------------------------------------- */

body.login-page {
  background: var(--cream);
}

body.login-page main {
  max-width: 460px;
  padding-top: 4.5rem;
}

body.login-page h1 {
  text-align: center;
}

body.login-page .subtitle {
  text-align: center;
}

.login-brand {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.login-brand .brand-mark {
  font-size: 2.4rem;
}

/* --------------------------------------------------------------------------
   จอเล็ก
   -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .detail-grid,
  .breakdown-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  main {
    padding: 1.5rem 1rem 4rem;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    padding: 0.7rem 1rem;
  }

  .topbar-nav {
    order: 3;
    flex-basis: 100%;
    margin: 0 -1rem;
    padding: 0 1rem 0.2rem;
  }

  .topbar-user {
    margin-left: auto;
  }

  h1 {
    font-size: 1.4rem;
  }

  .page-head {
    margin-bottom: 1.25rem;
  }

  .card,
  .filter-bar {
    padding: 1.1rem 1rem;
  }

  .stat-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
  }

  .stat-value {
    font-size: 1.6rem;
  }

  /* ตารางกว้างเกินจอเล็ก — ให้เลื่อนแนวนอนในกรอบตัวเอง ไม่ให้ทั้งหน้าเลื่อนตาม */
  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .run-form-fields {
    flex-basis: 100%;
  }

  .run-form-fields input[name='bugJiraKey'] {
    width: 7rem;
  }

  .empty {
    padding: 2rem 1.25rem;
  }
}

/* --------------------------------------------------------------------------
   เคารพการตั้งค่าลดการเคลื่อนไหวของผู้ใช้
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  a.stat-tile:hover {
    transform: none;
  }
}
