    
    body {
      margin: 0;
      padding: 20px;
      font-family: 'Segoe UI', sans-serif;
      background: #f5f8fc;
      color: #333;
    }

    h1 {
      text-align: center;
      font-size: 32px;
      color: #1f3b8c;
      margin-bottom: 10px;
    }

    .button-row {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 10px;
      margin-bottom: 15px;
    }

    .btn {
      padding: 12px 16px;
      border-radius: 8px;
      font-size: 16px;
      color: white;
      border: none;
      min-width: 120px;
      box-shadow: 0 3px 10px rgba(0,0,0,0.15);
      cursor: pointer;
      transition: all 0.3s ease;
    }

    .btn:hover {
      transform: scale(1.05);
    }

    .btn:active {
      transform: scale(0.98);
    }

    .blue   { background: #007BFF; }
    .red    { background: #DC3545; }
    .green  { background: #28A745; }
    .gray   { background: #6C757D; }
    .orange { background: #fd7e14; }
    .purple { background: #6f42c1; }
    .dark   { background: #343a40; }
    .teal   { background: #20c997; }
    .pink   { background: #e83e8c; }
    .cyan   { background: #17a2b8; }
    .indigo { background: #6610f2; }
    .yellow { background: #b09f21; }
    .sky      { background: #87CEEB; }  /* ฟ้าสดใส */
    .peach    { background: #edad75; }  /* พีชพาสเทล */
    .olive    { background: #708238; }  /* เขียวมะกอก */
    .sand     { background: #f4e1b6; }  /* สีทรายอบอุ่น */
    .mint     { background: #98FF98; }  /* เขียวมิ้นต์ */
    .lavender { background: #E6E6FA; }  /* ม่วงลาเวนเดอร์ */
    .coral    { background: #FF7F50; }  /* ส้มโครอล */
    .wine     { background: #722F37; }  /* ไวน์เข้ม */
    .navy     { background: #001f3f; }  /* น้ำเงินเข้ม */
    .rose     { background: #FFC0CB; }  /* ชมพูโรสพาสเทล */


    .timers-row {
      display: flex;
      justify-content: space-between;
      gap: 15px;
      margin: 20px 0;
      width: 100%;
    }

.epi-timer-row {
  display: flex;
  align-items: center;      /* จัดให้ทุก element อยู่ตรงกลางแนวตั้ง */
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 4px;
  height: 36px;             /* กำหนดความสูงเท่ากับปุ่ม */
}

.timer-btn {
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  aspect-ratio: 1/1;         /* ✅ ให้เป็นวงกลมเสมอ */
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 1px 4px #0001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.timer-btn:hover {
  background: #1565c0;
}
.timer-btn:disabled {
  background: #bdbdbd !important;
  color: #888 !important;
  cursor: not-allowed;
  box-shadow: none;
  border: none;
}
.timer-value {
  font-size: 24px;
  font-weight: bold;
  min-width: 60px;
  text-align: center;
  color: #000000;
  letter-spacing: 1px;
  line-height: 36px;        /* กำหนด line-height เท่ากับความสูงปุ่ม */
  display: inline-block;    /* ให้จัดตำแหน่งได้ดีขึ้น */
  padding-bottom: 10px;
  vertical-align: middle;
}
.timer-label {
  text-align: center;
  font-size: 13px;
  color: #666;
}


    .card {
      flex: 1;
      min-width: 0;
      background: rgb(237, 212, 212);
      border-radius: 12px;
      padding: 20px;
      text-align: center;
      box-shadow: 0 2px 10px rgba(0,0,0,0.1);
      font-size: 18px;
    }

    .card span {
      font-size: 28px;
      font-weight: bold;
      display: block;
      margin-top: 5px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .cardCount {
      flex: 1;
      min-width: 0;
      background: rgb(235, 237, 212);
      border-radius: 12px;
      padding: 20px;
      text-align: center;
      box-shadow: 0 2px 10px rgba(0,0,0,0.1);
      font-size: 18px;
    }
    .cardCount span {
      font-size: 28px;
      font-weight: bold;
      display: block;
      margin-top: 5px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .log-box {
      background: #1d1f21;
      color: #b4f2ff;
      padding: 15px;
      border-radius: 10px;
      height: 750px;
      overflow-y: auto;
      font-family: monospace;
      font-size: 14px;
      white-space: pre-wrap;
      border: 1px solid #2a2d2e;
    }
    .log-box[contenteditable="true"] {
  background-color: #5e5b55; /* สีพื้นหลังเปลี่ยนเมื่อแก้ไข */
  border: 2px dashed #ffa500; /* เส้นประสีส้ม */
  padding: 12px;
}

    /* Tab styles */
    .tab-container {
      margin-top: 30px;
    }
    
    .tab-buttons {
      display: flex;
      border-bottom: 1px solid #ddd;
      justify-content: space-evenly;
    }
    
    .tab-btn {
      padding: 10px 20px;
      background: none;
      border: none;
      cursor: pointer;
      font-size: 16px;
      border-bottom: 3px solid transparent;
      transition: all 0.3s ease;
      flex: 1;
    }
    
    .tab-btn:hover {
      background: #f0f0f0;
    }
    
    .tab-btn.active {
      border-bottom: 3px solid #007BFF;
      font-weight: bold;
      color: #007BFF;
    }

    
    .alc-btn {
      padding: 10px 20px;
      background: none;
      color: #900;
      border: none;
      cursor: pointer;
      font-size: 16px;
      border-bottom: 3px solid transparent;
      transition: all 0.3s ease;
      flex: 1;
    }
    
    .alc-btn:hover {
      background: #FFB3B3;;
    }
    
    .alc-btn.active {
      border-bottom: 3px solid #FF6B6B;
      font-weight: bold;
      color: #FF6B6B;
    }
    
    
    .tab-content {
      display: none;
      padding: 15px 0;
    }
    
    .tab-content.active {
      display: block;
    }
    
    .algorithm-img {
      max-width: 100%;
      height: auto;
      border: 1px solid #ddd;
      border-radius: 8px;
      box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }

    .sub-tabs {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  margin-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
  padding-top: 5px;
}

.sub-tab-btn {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  color: #555;
}

.sub-tab-btn.active {
  border-bottom: 3px solid #007BFF;
  color: #007BFF;
  font-weight: bold;
}

  
  .sub-tab-content {
    display: none;
    padding: 10px 0;
  }
  
  .sub-tab-content.active {
    display: block;
  }
  
  /* Modal Labs */
  .lab-checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
  }
  
  .lab-checkbox-group label {
    display: flex;
    align-items: center;
    padding: 5px;
  }

    /* Modal styles */
    .modal {
      display: none;
      position: fixed;
      z-index: 1000;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0,0,0,0.5);
    }
    
    .modal-content {
      background-color: white;
      margin: 5% auto; /* ปรับให้อยู่กลางหน้าจอ */
      padding: 20px;
      border-radius: 10px;
      width: 90%;
      max-width: 600px;
      max-height: 90vh; /* จำกัดความสูงสูงสุด */
      overflow-y: auto; /* ให้สามารถ scroll ได้เมื่อเนื้อหาเกิน */
      box-shadow: 0 5px 15px rgba(0,0,0,0.3);
      position: relative;
    }
    
    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 15px;
    }
    
    .close {
      font-size: 24px;
      font-weight: bold;
      cursor: pointer;
    }
    
    .form-group {
      margin-bottom: 5px;
    }

    .form-group label {
      display: block;
      margin-bottom: 5px;
      font-weight: bold;
      color: #333;
    }

    .form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 0.5rem;
    background-color: #f9f9f9;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color 0.3s, box-shadow 0.3s;
  }

  .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
    background-color: #fff;
  }

    textarea.form-control {
      min-height: 80px;
      resize: vertical;
    }
    
    .form-group input {
      width: 100%;
      padding: 8px;
      border: 1px solid #ddd;
      border-radius: 4px;
      box-sizing: border-box;
    }
    
    .modal-footer {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      margin-top: 0px;
      margin-bottom: 40px;
      padding-top: 15px;
      border-top: 1px solid #eee;
    }
    
    .modal-btn {
      padding: 8px 16px;
      border-radius: 4px;
      border: none;
      cursor: pointer;
    }
    

    /* Alert modal styles */
    .alert-modal {
      display: none;
      position: fixed;
      z-index: 1001;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0,0,0,0.7);
    }
    
    .alert-content {
      background-color: #fff;
      margin: 10% auto;
      padding: 25px;
      border-radius: 10px;
      width: 80%;
      max-width: 500px;
      text-align: center;
      box-shadow: 0 5px 25px rgba(0,0,0,0.3);
      animation: pulse 1.5s infinite;
    }
    
    .alert-title {
      font-size: 24px;
      color: #dc3545;
      margin-bottom: 20px;
      font-weight: bold;
    }
    
    .alert-message {
      font-size: 20px;
      margin-bottom: 25px;
    }
    
    .alert-btn {
      padding: 10px 25px;
      font-size: 18px;
      border-radius: 8px;
      border: none;
      background-color: #28a745;
      color: white;
      cursor: pointer;
      transition: all 0.3s;
    }
    
    .alert-btn:hover {
      background-color: #218838;
      transform: scale(1.05);
    }
    
    @keyframes pulse {
      0% { transform: scale(1); }
      50% { transform: scale(1.03); }
      100% { transform: scale(1); }
    }

    /* Highlight CPR timer when complete */
    .cpr-complete {
      color: #dc3545;
      animation: blink 1s infinite;
    }
    .epi-complete {
      color: #e91e63;
      animation: blink 1s infinite;
    }
    
    @keyframes blink {
      0% { opacity: 1; }
      50% { opacity: 0.7; }
      100% { opacity: 1; }
    }

/* Enhanced CPR Alert Modal */
    .cpr-alert-options {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-top: 20px;
    }
    
    .cpr-option-btn {
      padding: 12px;
      border-radius: 8px;
      border: none;
      font-size: 16px;
      font-weight: bold;
      cursor: pointer;
      transition: all 0.3s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }
    
    .cpr-option-btn:hover {
      transform: scale(1.02);
    }
      
    .summary-box {
      background: #e8f4f8;
      padding: 15px;
      border-radius: 8px;
      border-left: 4px solid #17a2b8;
      margin-top: 15px;
    }
    .summary-title {
      font-weight: bold;
      color: #17a2b8;
      margin-bottom: 10px;
    }
    .summary-item {
      margin-bottom: 5px;
    }
    
    /* Container styles */
    .button-container {
      background: #fff;
      border-radius: 10px;
      padding: 0.5px;
      margin-bottom: 5px;
      box-shadow: 0 2px 10px rgba(0,0,0,0.1);
      
    }
    .container-title {
      font-weight: bold;
      margin-bottom: 10px;
      color: #1f3b8c;
      display: flex;
      align-items: center;
    }
    .container-title span {
      margin-right: 8px;
      font-size: 18px;
    }


    .flex-container {
    display: flex;
    width: 100%;
    height: 200vh;
    overflow: hidden;
}

.flex-left, .flex-right {
    height: 100%;
    overflow: auto;
}

.flex-left {
    width: 50%;
    background-color: #f0f0f0;
    
    padding-right: 10px;
}

.flex-right {
    flex: 1;
    padding-left: 10px;
    background-color: #e0e0e0;
}

.resizer {
    width:5px;
    background: #aaa;
    cursor: col-resize;
    height: 100%;
}

/* Custom Input Container */

.custom-input-field {
  width: 80%;
  padding: 12px;
  border: 2px solid #ccc;
  border-radius: 10px;
  font-family: 'Segoe UI', sans-serif;
  font-size: 16px;
  resize: vertical;
  min-height: 40px;
  background-color: #f9f9f9;
  transition: all 0.3s ease-in-out;
}

/* เพิ่มเอฟเฟกต์โฟกัสเพื่อให้ดูเป็นมืออาชีพ */
.custom-input-field:focus {
  border-color: #007bff;
  background-color: #fff;
  outline: none;
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.2);
}

.form-control {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.metronome-btn {
    padding: 8px 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 16px;
    margin-left: 5px;
    transition: all 0.3s;
  }
  .metronome-btn.active {
    background-color: #ff5722;
    color: white;
  }

  @media print {
    body {
      font-family: 'TH Sarabun New', sans-serif;
      font-size: 16pt;
    }
    table {
      width: 100%;
      border-collapse: collapse;
    }
    td, th {
      border: 1px solid #000;
      padding: 5px;
    }
  }

  
    /* Collapsible Section Styles */
.collapsible {
  cursor: pointer;
}

.collapse-icon {
  margin-left: auto;
  font-size: 14px;
  transition: transform 0.3s ease;
}

.collapsible.active .collapse-icon {
  transform: rotate(180deg);
}

.additional-interventions {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.collapsible.active .additional-interventions {
  max-height: 500px; /* Adjust based on your content */
  transition: max-height 0.5s ease-in;
}



.interventions-content {
  padding-top: 10px;
}

/* เพิ่มใน CSS */
.additional-conditions {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.collapsible.active .additional-conditions {
  max-height: 500px;
  transition: max-height 0.5s ease-in;
}

.rhythm-content {
  padding-top: 10px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

  /* เพิ่มในไฟล์ CSS ของคุณ */
@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0.3; }
  100% { opacity: 1; }
}

.blinking {
  animation: blink 1s linear infinite;
}

.hidden {
  display: none !important;
}

/* เพิ่ม style สำหรับส่วนหัว */
.header-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 0px; /* ลดระยะห่างกับแถวถัดลงมา */
  position: relative;
}

.header-content {
  display: flex;
  align-items: center;
  max-width: 1200px;
  width: 100%;
}

.panel-title {
  flex: 1;
  text-align: center;
}

.patient-weight-container {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px; /* ลดระยะห่างระหว่างองค์ประกอบ */
  background-color: #e7f3fe;
  padding: 5px 10px; /* ปรับ padding ให้กะทัดรัดขึ้น */
  border-radius: 8px;
  border: 1px solid #b8daff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.patient-weight-label {
  font-weight: bold;
  color: #1f3b8c;
  font-size: 18px; /* ขนาดเท่ากับหัวข้อหลัก */
  white-space: nowrap;
}

.patient-weight-input {
  width: 65px;
  padding: 8px;
  border: 1px solid #a0c4ff;
  border-radius: 4px;
  text-align: center;
  font-size: 20px; /* ขนาด font ใหญ่ขึ้น */
  background-color: white;
  height: 20px; /* ความสูงเพิ่มขึ้น */
}


@media (max-width: 480px) {
  body {
      margin: 0;
      padding: 5px;
      font-family: 'Segoe UI', sans-serif;
      background: #f5f8fc;
      color: #333;
    }

    h1 {
      text-align: center;
      font-size:32px;
      color: #1f3b8c;
      margin-bottom: 0px;
    }
    
  .flex-container {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow: visible; 
    height: auto; /* ปรับความสูงให้เหมาะสม */
    padding-bottom: 20px; /* เพิ่มพื้นที่ด้านล่าง */
  }

  .flex-left {
    flex: 0 0 180px; /* แต่ละ column กว้าง 320px */
    width: 180px;
    height: auto; /* ปรับความสูงให้เหมาะสม */
    margin-left: 0px;
    padding-top: 5px; /* เพิ่มพื้นที่ห่างจากขอบบน */
    padding-left: 5px; /* เพิ่มพื้นที่ห่างจากขอบซ้าย */
    padding-bottom: 200px;
  }

   .flex-right {
    padding-right: 5px; /* เพิ่มพื้นที่ห่างจากขอบขวา */
    padding-left: 5px;
    padding-top: 5px;
    padding-bottom: 200px;
  }
  .button-container {
    width: 100%;
    margin-right: 10px;
  }

  .resizer {
    display: none;
  }

  /* ปุ่มเล็กลง */
  .btn {
    flex: 1 1 auto;
    min-width: 30px;
    font-size: 13px;
    padding: 8px 6px;
    margin: 2px;
  }

  .button-row {
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-start;
  }
    .epi-timer-row {
    gap: 6px;         /* ลดระยะห่างปุ่มกับ value */
  }
  .timer-btn {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }
  .timer-value {
    font-size: 20px;
    min-width: 48px;
    line-height: 28px;
    padding-bottom: 10px; /* เพิ่มพื้นที่ด้านล่างเพื่อให้ตรงกับปุ่ม */
  }

  /* การ์ดเล็กลง */
  .card,
  .cardCount {
    font-size: 14px;
    padding: 10px;
    margin-bottom: 6px;
    padding-top: 0px;
  }

  .card span,
  .cardCount span {
    font-size: 20px;
  }

  .timers-row {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0px;
    padding-bottom: 0px;
  }

  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 15px;
  }

  .alert-content {
    width: 95%;
    margin: 20% auto;
    padding: 15px;
  }

  /* Header */
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-title {
    font-size: 20px;
    margin-bottom: 0px;
  }

  .patient-weight-container {
  position: static;
  margin: 5px auto;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px; /* ระยะห่าง label กับ input */
  
}


  .patient-weight-label,
  .patient-weight-input {
    font-size: 15px;
  }

  /* Log Box */
  .log-box {
    font-size: 12px;
    height: 800px;
    max-width: auto; /* ปรับความกว้างให้เหมาะสม */
    margin-right: 0px; /* เพิ่มระยะห่างจากขอบ */  
  }

  /* Tab Buttons */
  .tab-buttons {
    flex-wrap: wrap;
  }

  .tab-btn {
    flex: 1 1 45%;
    font-size: 14px;
    padding: 8px;
  }
}


.algorithm-link {
  display: inline-block;
  padding: 10px 16px;
  margin-top: 10px;
  border-radius: 999px;
  background: #f5f5f5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  text-decoration: none;
  font-size: 14px;
  color: #333;
}

.algorithm-link:hover {
  background: #e0e0e0;
}
