    [x-cloak] { display: none !important; }

    body {
      font-family: 'Sarabun', sans-serif;
      color: #26262B;
      background-color: #FFF1F6;
      -webkit-font-smoothing: antialiased;
    }

    /* กรอบหลักของหน้า: เส้นบางสีชมพูอ่อน แทนกรอบลูกไม้เดิม */
    .lace-border {
      border: 1px solid #EBD3DD;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    }

    .cute-card {
      background: #FFFFFF;
      border: 1px solid #E7E2E5;
      border-radius: 16px;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    }

    .cute-btn {
      background-color: #C7DD9D;
      color: #2F4A14;
      border-radius: 10px;
      border: 1px solid #A9C56F;
      transition: all 0.2s;
    }
    .cute-btn:hover {
      background-color: #B5CF80;
      transform: translateY(-2px);
      box-shadow: 0 6px 16px rgba(63, 95, 26, 0.15);
    }
    .cute-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    /* เอฟเฟกต์เข้าหน้า / ยกตัวเมื่อเอาเมาส์ชี้ (ปิดเมื่อผู้ใช้ตั้งค่าลดการเคลื่อนไหว) */
    @media (prefers-reduced-motion: no-preference) {
      .fade-up { opacity: 0; animation: fadeUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
      .delay-1 { animation-delay: 60ms; }
      .delay-2 { animation-delay: 120ms; }
      .delay-3 { animation-delay: 180ms; }
      .delay-4 { animation-delay: 240ms; }
      .hover-lift { transition: transform 0.2s ease, box-shadow 0.2s ease; }
      .hover-lift:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06); }
    }
    @keyframes fadeUp {
      from { opacity: 0; transform: translateY(12px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* ลูกเล่นดุ๊กดิ๊ก: เนื้อหากระดอนเข้ามาเบาๆ ทุกครั้งที่สลับแท็บ/เปิดหัวข้อ (คนละแบบกับ fade-up ที่ใช้ตอนเปิดหน้าแรก) */
    @keyframes popIn {
      0%   { opacity: 0; transform: translateY(10px) scale(0.95); }
      55%  { opacity: 1; transform: translateY(-3px) scale(1.015); }
      100% { opacity: 1; transform: translateY(0) scale(1); }
    }
    @media (prefers-reduced-motion: no-preference) {
      .pop-in { animation: popIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
    }
    /* กดปุ่มแล้วยุบตัวนิดๆ ให้รู้สึกตอบสนอง (ดุ๊กดิ๊ก) */
    .cute-btn, .tab-pill, .icon-btn, .doc-chip {
      transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s, color 0.2s, box-shadow 0.2s;
    }
    .cute-btn:active, .tab-pill:active, .icon-btn:active, .doc-chip:active { transform: scale(0.9); }

    /* แท็บเมนูแบบแคปซูล */
    .tab-pill {
      display: inline-flex; align-items: center; gap: 0.5rem;
      padding: 0.5rem 1rem; border-radius: 9999px;
      font-size: 0.875rem; font-weight: 600;
      color: #5E5A60; background: transparent;
    }
    .tab-pill:hover { background: #FFF7FA; color: #26262B; }
    .tab-pill.is-active { background: #C7DD9D; color: #2F4A14; box-shadow: 0 1px 3px rgba(63, 95, 26, 0.25); }
    @media (prefers-reduced-motion: no-preference) {
      .tab-pill:hover iconify-icon { display: inline-block; animation: wiggle 0.4s ease; }
    }
    @keyframes wiggle {
      0%, 100% { transform: rotate(0deg); }
      25% { transform: rotate(-14deg); }
      75% { transform: rotate(14deg); }
    }

    /* D5: ตารางแปลงเป็นการ์ดบนมือถือ — แต่ละ td แสดงเป็นแถวพร้อมป้ายชื่อคอลัมน์ (data-label) แทนหัวตาราง */
    @media (max-width: 640px) {
      .responsive-table thead { display: none; }
      .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
      .responsive-table tr { margin-bottom: 0.75rem; border: 1px solid #E7E2E5; border-radius: 12px; overflow: hidden; }
      .responsive-table tr:last-child { margin-bottom: 0; }
      .responsive-table td { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
                              padding: 0.5rem 0.75rem; text-align: right; border-bottom: 1px solid #F3F4F6; }
      .responsive-table td:last-child { border-bottom: none; }
      .responsive-table td::before { content: attr(data-label); font-weight: 600; color: #5E5A60; text-align: left; white-space: nowrap; }
      .responsive-table td:not([data-label])::before,
      .responsive-table td[data-label=""]::before { content: none; }
      .responsive-table td:not([data-label]),
      .responsive-table td[data-label=""] { justify-content: flex-end; }
    }

    /* ปุ่มเล็กในตาราง */
    .icon-btn {
      border-radius: 9999px;
      font-size: 0.7rem;
      padding: 0.25rem 0.6rem;
      border: 1px solid transparent;
      transition: all 0.15s;
      white-space: nowrap;
    }
    .icon-btn-edit { background-color: #F8F0DE; color: #6E5625; border-color: #DFC788; }
    .icon-btn-edit:hover { background-color: #EEDFB8; }
    .icon-btn-del { background-color: #FBDADA; color: #9B1C1C; border-color: #F2B8B8; }
    .icon-btn-del:hover { background-color: #F5C4C4; }

    /* ป้ายเอกสารในตาราง (กดเพื่อเปิด popup) */
    .doc-chip {
      font-size: 0.68rem;
      padding: 0.2rem 0.55rem;
      border-radius: 9999px;
      border: 1px solid transparent;
      white-space: nowrap;
      transition: all 0.15s;
      cursor: pointer;
    }
    .doc-chip:hover { transform: translateY(-1px); filter: brightness(0.96); }
    .doc-accept  { background: #EDF4DC; color: #2F4A14; border-color: #C7DD9D; }
    .doc-receipt { background: #DCEFC0; color: #2F5A12; border-color: #C7DD9D; }
    .doc-rev     { background: #EEDFB8; color: #6E5625; border-color: #DFC788; }
    .doc-plain   { background: #EDF4DC; color: #2F4A14; border-color: #C7DD9D; }

    /* รายการไฟล์ใน popup */
    .doc-row {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      padding: 0.5rem 0.65rem;
      border: 1px solid #EDF4DC;
      border-radius: 12px;
      background: #fff;
    }
    .doc-row + .doc-row { margin-top: 0.4rem; }

    /* ป้ายไฟล์แนบในฟอร์ม */
    .file-chip {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      max-width: 100%;
      background: #EDF4DC;
      border: 1px solid #C7DD9D;
      color: #2F4A14;
      border-radius: 9999px;
      padding: 0.15rem 0.5rem;
      font-size: 0.68rem;
    }
    .file-chip a {
      max-width: 11rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      text-decoration: underline;
    }
    .file-chip button {
      color: #3F5F1A;
      font-weight: 700;
      line-height: 1;
    }
    .file-chip button:hover { color: #2F4A14; }

    /* ฟอร์ม */
    .frm-label { font-size: 0.7rem; font-weight: 600; color: #3F5F1A; display: block; margin-bottom: 0.15rem; }
    .frm-input {
      width: 100%;
      border: 1px solid #C7DD9D;
      border-radius: 12px;
      padding: 0.4rem 0.7rem;
      font-size: 0.8rem;
      background: #fff;
    }
    .frm-input:focus { outline: none; border-color: #7E9E4A; box-shadow: 0 0 0 3px #EDF4DC; }
    .frm-input:focus-within { outline: none; border-color: #7E9E4A; box-shadow: 0 0 0 3px #EDF4DC; }

    /* ช่องกรอกวันที่แบบ วว/ดด/ปี พ.ศ. — เลี่ยงปัญหา <input type="date"> ที่โชว์ปี ค.ศ. ตามภาษาเครื่อง */
    .date-input-group { display: flex; align-items: center; gap: 0.2rem; }
    .date-part-input {
      border: none;
      background: transparent;
      text-align: center;
      font-size: 0.8rem;
      padding: 0;
      outline: none;
      -moz-appearance: textfield;
    }
    .date-part-input::-webkit-outer-spin-button,
    .date-part-input::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }
    .date-part-input.dpi-dm { width: 1.6rem; }
    .date-part-input.dpi-y { width: 2.8rem; }
    .date-sep { color: #9DB77A; }
    .date-pick-btn { margin-left: auto; padding: 0 0.1rem; color: #5F7F32; font-size: 0.85rem; line-height: 1; }
    .date-pick-btn:hover { color: #3F5F1A; }

    /* ปฏิทินเลือกวันที่แบบกดเลือก (คู่กับช่องพิมพ์ วว/ดด/ปี พ.ศ. ด้านบน) */
    .date-picker-wrap { position: relative; }
    .date-picker-pop {
      position: absolute;
      top: calc(100% + 4px);
      left: 0;
      z-index: 30;
      width: 15.5rem;
      background: #fff;
      border: 2px solid #C7DD9D;
      border-radius: 14px;
      padding: 0.6rem;
      box-shadow: 0 10px 24px rgba(63, 95, 26, 0.18);
    }
    .date-picker-nav { color: #7E9E4A; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 8px; }
    .date-picker-nav:hover { background: #EDF4DC; }
    .day-cell {
      width: 1.85rem; height: 1.85rem;
      border-radius: 9999px;
      font-size: 0.68rem;
      display: flex; align-items: center; justify-content: center;
      color: #3F4F2A;
    }
    .day-cell:hover:not(:disabled) { background: #EDF4DC; }
    .day-cell:disabled { visibility: hidden; }
    .day-cell.is-today { border: 1px solid #5F7F32; font-weight: 700; }
    .day-cell.is-selected { background: #5F7F32; color: #fff; }
    .frm-section {
      border: 1px solid #C7DD9D;
      border-radius: 14px;
      padding: 0.85rem;
      background: #F7FAEF;
    }
    .frm-section-title { font-size: 0.75rem; font-weight: 700; color: #2F4A14; margin-bottom: 0.5rem; }

    .modal-box {
      max-height: 88vh;
      overflow-y: auto;
    }

    /* ช่องสถานะ: กว้างพอดีข้อความ ไม่ตัดบรรทัด */
    .status-cell {
      width: 1%;
      white-space: nowrap;
    }
    .status-badge {
      display: inline-block;
      white-space: nowrap;
      padding: 0.25rem 0.6rem;
      border-radius: 9999px;
      font-size: 0.75rem;
      font-weight: 600;
      line-height: 1.25rem;
    }

    /* Status Badge Styles */
    .status-online { background-color: #E1EACB; color: #33461B; border: 1px solid #C9D9A8; }
    .status-progress { background-color: #F8F0DE; color: #6E5625; border: 1px solid #DFC788; }

    .status-intake { background-color: #E1EACB; color: #33461B; border: 1px solid #C9D9A8; }
    .status-pass { background-color: #F8F0DE; color: #6E5625; border: 1px solid #DFC788; }
    .status-revise { background-color: #F5D0BE; color: #7A4030; border: 1px solid #E8C0AC; }
    .status-ec { background-color: #EDF4DC; color: #2F4A14; border: 1px solid #C7DD9D; }
    .status-ec-pass { background-color: #C9D9A8; color: #223010; border: 1px solid #AEC781; }
    .status-cancel { background-color: #f3f4f6; color: #4b5563; border: 1px solid #d1d5db; }
    /* สถานะ workflow ส่งโครงการวิจัย/คณะกรรมการ */
    .status-pending { background-color: #FBEFC2; color: #7A5B00; border: 1px solid #E8D8A0; }
    .status-review  { background-color: #DCEEFB; color: #1E5A86; border: 1px solid #B8D9F0; }
    .status-fail    { background-color: #FBDADA; color: #9B1C1C; border: 1px solid #F0B8B8; }
