/* จัดวางหน้าจัดการกิจกรรมใหม่ (23 ต.ค. 2569 · taste-skill สำหรับหน้าทำงาน)
   เจ้าของระบบ: ใช้สีและเนื้อหาเดิม ปรับเฉพาะการจัดวาง
   - จอกว้าง: แผงเลือกกิจกรรมเป็นคอลัมน์ซ้ายติดอยู่กับที่ · ตารางเช็คชื่อคอลัมน์ขวา (เห็นรายชื่อได้ตั้งแต่จอแรก)
   - ปุ่มของกิจกรรม: ไอคอนกับข้อความบรรทัดเดียว · แก้ไข · QR · A4 แถวเดียว · e-Certificate ทีมงาน และผู้จัดกิจกรรม เต็มแถว (ชื่อไม่ถูกตัด)
   - มือถือ: ปุ่มสร้างกิจกรรม / อัปเดต อยู่แถวเดียวกัน */

.healthy-formal #adminApp .admin-event-row { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px !important; }
.healthy-formal #adminApp .admin-event-row > .event-search,
.healthy-formal #adminApp .admin-event-row > #certBtn,
.healthy-formal #adminApp .admin-event-row > #teamBtn,
.healthy-formal #adminApp .admin-event-row > #organizersBtn,
.healthy-formal #adminApp .admin-event-row > #shirtBtn,
.healthy-formal #adminApp .admin-event-row > .admin-role-badge { grid-column: 1 / -1 !important; }
.healthy-formal #adminApp .admin-event-row > .button:not(.hidden) {
  display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: center !important;
  gap: 8px !important; width: 100% !important; min-width: 0 !important; min-height: 52px !important; padding: 8px 12px !important; white-space: nowrap;
}
.healthy-formal #adminApp .admin-event-row > .button > span:last-child { overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 700px) {
  .healthy-formal .admin-panel:not(.roster-panel) .admin-panel-head { flex-direction: column; }
  .healthy-formal .admin-panel:not(.roster-panel) .admin-panel-actions { display: grid !important; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; width: 100%; }
  .healthy-formal .admin-panel-actions > #createEventBtn, .healthy-formal .admin-panel-actions > #refreshAdminBtn { width: 100% !important; min-height: 52px !important; }
}

@media (min-width: 1100px) {
  .healthy-formal .admin-shell { max-width: 1400px !important; margin-inline: auto; padding-inline: 24px !important; }
  .healthy-formal #adminApp:not(.hidden) { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }
  .healthy-formal #adminApp > .admin-panel { margin: 0 !important; }
  .healthy-formal #adminApp > .admin-panel:not(.roster-panel) { position: sticky; top: calc(72px + var(--safe-top, 0px) + 16px); }
  .healthy-formal #adminApp > .admin-panel:not(.roster-panel) .admin-panel-head { flex-direction: column; align-items: stretch !important; gap: 12px; }
  .healthy-formal #adminApp > .admin-panel:not(.roster-panel) .admin-panel-actions { display: grid !important; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; }
  .healthy-formal #adminApp > .admin-panel:not(.roster-panel) .admin-panel-actions > .button { width: 100%; }
}

/* แท็บเล็ต (760–1099px): ตารางเช็คชื่อใช้แถวสองบรรทัดแบบมือถือ ปุ่มเช็คชื่อไม่ถูกตัดคำ */
@media (min-width: 760px) and (max-width: 1099px) {
  .roster-panel .roster-table tr { grid-template-columns: 72px minmax(0, 1fr) auto; grid-template-areas: "bib name status" "act act act"; }
  .roster-panel .roster-table thead tr { grid-template-columns: 72px minmax(0, 1fr) auto; grid-template-areas: "bib name status"; }
  .roster-panel .roster-table th.col-actions { display: none; }
}
/* หัวตารางเช็คชื่อ: กิจกรรมที่เลือก แบบเดียวกับแถวในช่องเลือกกิจกรรม (27 ต.ค. 2569) */
.healthy-formal .roster-event { display: flex; align-items: center; gap: 12px; margin: 10px 0 6px; min-width: 0; }
.healthy-formal .roster-event[hidden] { display: none; }
.healthy-formal .roster-event strong { color: var(--health-ink); font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.healthy-formal .roster-event small { color: var(--health-muted); font-size: .85rem; }
/* ไซส์เสื้อใต้ป้ายสถานะในตารางเช็คชื่อ (27 ต.ค. 2569) */
.healthy-formal .roster-table .col-status .roster-shirt { display: block; margin-top: 4px; color: var(--health-ink); font-size: .82rem; font-weight: 700; }

/* แผงเลือกกิจกรรมกระชับ (เจ้าของระบบ 28 ต.ค. 2569 · Taste Skill)
   ช่องค้นหาเต็มแถว · เครื่องมือ 7 ปุ่มเป็นตารางไอคอนบน/ชื่อล่าง (เดิมปุ่มเต็มแถวทีละอัน สูง ~300px) · ไม่มีป้ายบทบาท (แถบเมนูบอกแล้ว) */
.healthy-formal #adminApp .admin-event-row { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)) !important; gap: 6px !important; }
.healthy-formal #adminApp .admin-event-row > #certBtn,
.healthy-formal #adminApp .admin-event-row > #teamBtn,
.healthy-formal #adminApp .admin-event-row > #organizersBtn,
.healthy-formal #adminApp .admin-event-row > #shirtBtn { grid-column: auto !important; }
.healthy-formal #adminApp .admin-event-row > .button:not(.hidden) {
  flex-direction: column !important; gap: 2px !important; min-height: 60px !important; padding: 6px 4px !important;
  border-radius: 14px !important; font-size: .84rem !important; line-height: 1.2 !important; white-space: normal; text-align: center;
}
.healthy-formal #adminApp .admin-event-row > .button > span:last-child { overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.healthy-formal #adminApp .admin-event-row > .button .material-symbols-rounded { font-size: 22px !important; }

/* รายการกิจกรรมในแถบด้านข้าง (เจ้าของระบบ 6 พ.ย. 2569)
   แทนช่องค้นหาแบบ dropdown: ช่องค้นหาอยู่บน · รายการเรียงวันที่ใหม่→เก่า เลื่อนในกล่อง · กิจกรรมที่จบแล้วจางลง 50% (opacity .5) */
.healthy-formal #adminApp .admin-event-row > .admin-event-list { grid-column: 1 / -1 !important; }
.healthy-formal .admin-event-list { margin: 0 0 6px; padding: 4px; list-style: none; display: grid; gap: 2px; max-height: 320px; overflow-y: auto; overscroll-behavior: contain; border-radius: 16px; background: var(--health-background); }
.healthy-formal .admin-event-list > li { margin: 0; }
.healthy-formal .admin-event-list > li.empty { padding: 14px 12px; color: var(--health-muted); text-align: center; }
.healthy-formal .admin-event-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.healthy-formal .admin-event-item strong { color: var(--health-ink); font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.healthy-formal .admin-event-item small { color: var(--health-muted); font-size: .82rem; line-height: 1.35; }
.healthy-formal .admin-event-item:hover { background: var(--health-soft); }
.healthy-formal .admin-event-item:focus-visible { outline: 3px solid rgba(37,110,69,.45); outline-offset: -3px; }
.healthy-formal .admin-event-item[aria-pressed="true"] { background: var(--health-soft); box-shadow: inset 0 0 0 2px var(--health-primary-dark); }
.healthy-formal .admin-event-item[aria-pressed="true"] strong { color: var(--health-primary-dark); }
.healthy-formal .admin-event-item.is-past { opacity: .5; }
@media (min-width: 1100px) {
  .healthy-formal .admin-event-list { max-height: max(220px, calc(100dvh - 600px)); }
}

/* จอแคบ (มือถือ/แท็บเล็ต <1100px · เจ้าของระบบ 6 พ.ย. 2569) แบ่งเป็น 2 หน้า
   หน้าแรก: หัวแผง (สร้างกิจกรรม/อัปเดต) + ช่องค้นหา + รายการกิจกรรม (ยาวตามเนื้อหา ไม่เลื่อนในกล่อง)
   กดกิจกรรม → .is-event-detail: ปุ่มเลือกกิจกรรมอื่น + เครื่องมือของกิจกรรม + ตารางเช็คชื่อ */
.healthy-formal .admin-event-back { display: none; }
@media (max-width: 1099px) {
  .healthy-formal #adminApp:not(.is-event-detail) > .roster-panel,
  .healthy-formal #adminApp:not(.is-event-detail) .admin-event-row > .button { display: none !important; }
  .healthy-formal #adminApp:not(.is-event-detail) .admin-event-list { max-height: none; overflow: visible; margin-bottom: 0; }
  .healthy-formal #adminApp.is-event-detail > .admin-panel:not(.roster-panel) .admin-panel-head,
  .healthy-formal #adminApp.is-event-detail .admin-event-row > .event-search,
  .healthy-formal #adminApp.is-event-detail .admin-event-row > .admin-event-list { display: none !important; }
  .healthy-formal #adminApp.is-event-detail .admin-event-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0 0 12px; padding: 8px 16px 8px 10px; border: 0; border-radius: 999px; background: var(--health-soft); color: var(--health-primary-dark); font: inherit; font-weight: 800; cursor: pointer; }
  .healthy-formal #adminApp.is-event-detail .admin-event-back:focus-visible { outline: 3px solid rgba(37,110,69,.45); outline-offset: 2px; }
}
