:root {
  --main-font: 'Inter', sans-serif;

  --color-black: #000000;
  --color-white: #ffffff;
  --color-light-gray: #f4f4f4;

  --color-red: #ff002e;
  --color-green: #00AF2C;
  --color-blue: #0099ff;
  --color-purple: #a932d8;
  --color-gray: #888888;

  --text-header-color: #090909;
  --text-subheader-color: #888888;

  --body-color: #f2f2f6;
  --navbar-color: #ffffff;
  --not-active-color: #888888;

  --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}






body {
  background-color: var(--body-color);
  min-height: 100vh;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--main-font);
}

.navbar {
  height: 54px;
  display: flex;
  align-items: center;
  background-color: var(--navbar-color);
  padding: 0px 16px;
}

.nav-menu {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  gap: 20px;
  
}

.logo {
  color: var(--color-black);
  font-size: 20px;
  font-weight: bold;
  text-decoration: none;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 16px;
  align-items: center;
}

.auth-email {
  color: var(--text-subheader-color);
  font-size: 13px;
}

.auth-btn {
  min-height: 36px;
  padding: 8px 16px;
  border: none;
  border-radius: 50px;
  background: var(--color-blue);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.hamburger-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--navbar-color);
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px; /* ระยะห่างระหว่างขีด */
  transition: background-color 0.2s;
}

.hamburger-btn:hover {
  background-color: var(--navbar-hover-color); /* สีเข้มขึ้นเมื่อเอาเมาส์ชี้ */
}

/* ลักษณะของขีดทั้ง 3 เส้น */
.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--color-black);
  border-radius: 2px; /* ทำให้ปลายขีดมนเล็กน้อย */
}

/* ตัวครอบเนื้อหาหลักให้อยู่ตรงกลางพอดีเหมือนในภาพ */
.container {
  max-width: 1240px;
  margin: 16px auto;
  padding: 0 8px;
}

/* จัดกล่องสถานะกับปุ่ม + Add ให้อยู่ซ้าย-ขวาในแถวเดียวกัน */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 8px; /* เพิ่มระยะห่างระหว่างกล่องสถานะกับปุ่ม + Add */
}

/* Dashboard Status */
.dashboard-status {
  flex: 1;
  max-width: 400px;
  height: 56px;
  display: flex;
  align-items: center;
  background-color: var(--color-white);
  padding: 8px;
  border-radius: 99px; /* ทำให้ขอบมนโค้งเป็นทรงแคปซูลเหมือนในรูป */
}

.dashboard-status-item {
  flex: 1;
  display: flex;              /* จัดข้างในด้วย Flex */
  flex-direction: column;     /* เรียงหัวข้อกับตัวเลขบน-ล่าง */
  justify-content: center;    /* ดันให้อยู่กึ่งกลางแนวตั้งเท่ากันทุกช่อง */
  min-width: 70px;            /* กำหนดความกว้างต่ำสุดของแต่ละช่อง */
  align-items: center;
  height: 100%;               /* ยืดความสูงเต็มกล่อง 54px */
  padding: 0 16px;
}

/* เส้นคั่นแนวตั้งระหว่างช่อง (เว้นช่องสุดท้าย) */
.dashboard-status-item:not(:last-child) {
  height: 32px; /* ปรับความสูงของเส้นคั่นตามต้องการ */
  border-right: 1px solid var(--color-light-gray); /* สีเส้นคั่น */
}

/* หัวข้อ h3 */
.dashboard-status-item h3 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap; /* ป้องกันการตัดคำ */
}

/* กำหนดสีหัวข้อแยกตามลำดับช่อง */
.dashboard-status-item:nth-child(1) h3 {
  color: var(--color-blue); /* สีฟ้า: In progress */
}

.dashboard-status-item:nth-child(2) h3 {
  color: var(--color-red); /* สีแดง: (≤ 3 days) */
}

.dashboard-status-item:nth-child(3) h3 {
  color: var(--color-green); /* สีเขียว: Finish */
}

/* ตัวเลข p */
.dashboard-status-item p {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-black);
}

/* ปุ่ม + Add สีฟ้า */
.btn-add {
  background-color: var(--color-blue);
  color: var(--color-white);
  border: none;
  min-height: 44px  ;
  padding: 10px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap; /* ป้องกันการตัดคำ */
}

/* กล่องที่ 3: แถบสลับสถานะและช่องค้นหา */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 8px;
}

/* แถบปุ่มสลับซ้าย */
.status-tabs {
  display: flex;
  background-color: #ffffff;
  min-width: 400px;
  border-radius: 50px;
  padding: 4px;
  box-shadow: var(--box-shadow);
}

.tab-btn {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  background: transparent;
  min-width: 190px;
  min-height: 44px;
  padding: 8px 36px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  color: var(--not-active-color);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background-color: var(--color-blue);
  color: var(--color-white);
}

/* กลุ่มช่องค้นหาขวา */
.search-group {
  flex: 0 1 400px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background-color: #ffffff;
  height: 44px;
  padding: 0 18px;
  border-radius: 50px;
  gap: 8px;
  box-shadow: var(--box-shadow);
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  color: #111827;
}

.search-box input::placeholder {
  color: var(--not-active-color);
}

.sort-btn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #ffffff;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: var(--box-shadow);
  transition: background-color 0.2s;
}

.sort-btn:hover {
  background-color: #f3f4f6;
}

/* กล่องที่ 4: แถบปุ่มหมวดหมู่ */
.category-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap; /* รองรับการขึ้นบรรทัดใหม่อัตโนมัติเมื่อเปิดบนจอมือถือ */
}

.tag-btn {
  height: 32px;
  display: inline-flex;
  align-items: center;          /* จัดข้อความอยู่กึ่งกลางแนวตั้งเสมอ */
  justify-content: center;
  padding: 0 16px;              /* คุมเฉพาะความกว้างซ้าย-ขวา */
  border-radius: 50px;
  border: none;
  background-color: #ffffff;
  color: var(--not-active-color);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;          /* ป้องกันคำว่า ≤ 3 days ตกบรรทัด */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.2s;
}

.tag-btn:hover {
  background-color: #f3f4f6;
}

/* สถานะปุ่มที่ถูกเลือก (สีฟ้าเหมือนในดีไซน์) */
.tag-btn.active {
  background-color: var(--color-blue);
  color: #ffffff;
}

/* กล่องหลักครอบรายการทั้งหมด */
.task-list {
  background-color: #ffffff;
  border-radius: 24px;
  box-shadow: var(--box-shadow);
  overflow: hidden;
}

/* แต่ละรายการงาน */
.task-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 12px 24px 12px;
  gap: 16px;
}

.task-item:hover {
  background-color: #f9f9f9;
  border-radius: 24px;
}

/* เส้นคั่นแนวนอนระหว่างรายการ (เว้นรายการสุดท้าย) */
.task-item:not(:last-child) {
  padding-bottom: 0;
}

/* 1. ฝั่งซ้าย: กล่องบอกจำนวนวัน */
.days-badge {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-shrink: 0; /* ป้องกันกล่องโดนบีบเมื่อข้อความยาว */
}

.days-num {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
}

.days-text {
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
}

/* สีสถานะวันคงเหลือ 3 ระดับ */
.days-badge.urgent {
  background-color: var(--color-red);
  color: #fff;
}

.days-badge.warning {
  background-color: var(--color-purple);
  color: #fff;
}

.days-badge.normal {
  background-color: var(--color-blue);
  color: #fff;
}

/* 2. ตรงกลาง: เนื้อหางาน */
.task-content {
  flex: 1; /* ขยายเต็มพื้นที่ว่างตรงกลาง */
  min-width: 0;
}

.task-item:not(:last-child) .task-content {
  padding-bottom: 24px;
  border-bottom: 1px solid #f1f5f9;
}

.task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  margin-bottom: 12px;
}

.task-tag-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.task-tag {
  display: inline-flex;
  align-items: center;
  background-color: #f2f2f6;
  color: #323232;
  font-size: 12px;
  font-weight: 500;
  height: 24px;
  padding: 0 8px;
  border-radius: 50px;
  white-space: nowrap;
}

.task-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-header-color);
  margin-bottom: 2px;
}

.task-subtitle {
  font-size: 13px;
  color: var(--text-subheader-color);
}

/* รายการความคืบหน้าย่อย */
.task-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.task-progress-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-header-color);
}

.task-progress-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-feedback,
.task-empty {
  padding: 12px;
  color: var(--text-subheader-color);
}

.task-dialog,
.auth-dialog {
  width: min(440px, calc(100% - 32px));
  margin: auto;
  padding: 20px;
  border: 0;
  border-radius: 12px;
}

.task-dialog::backdrop,
.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.task-dialog form,
.task-dialog label,
.auth-dialog form,
.auth-dialog label {
  display: grid;
  gap: 8px;
}

.task-dialog form,
.auth-dialog form {
  gap: 12px;
}

.task-dialog input,
.task-dialog textarea,
.task-dialog select,
.task-dialog button,
.auth-dialog input,
.auth-dialog button {
  padding: 8px;
  font: inherit;
}

.auth-feedback {
  min-height: 18px;
  color: var(--color-red);
  font-size: 13px;
}

.auth-switch {
  border: none;
  background: transparent;
  color: var(--color-blue);
  cursor: pointer;
  text-align: left;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 20px;
  padding: 24px;
  border-radius: 24px;
  background: var(--color-white);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
}

.auth-logo {
  justify-self: start;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 50px;
  background: var(--body-color);
}

.auth-tab {
  min-height: 44px;
  border: none;
  border-radius: 50px;
  background: transparent;
  color: var(--text-subheader-color);
  cursor: pointer;
  font-weight: 600;
}

.auth-tab.active {
  background: var(--color-blue);
  color: var(--color-white);
}

.auth-card form {
  display: grid;
  gap: 12px;
}

.auth-card label {
  display: grid;
  gap: 6px;
  color: var(--text-header-color);
  font-size: 14px;
  font-weight: 600;
}

.auth-card input {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #dfe3ea;
  border-radius: 10px;
  font: inherit;
}

.auth-submit {
  min-height: 44px;
  border: none;
  border-radius: 50px;
  background: var(--color-blue);
  color: var(--color-white);
  cursor: pointer;
  font-weight: 600;
}

.task-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.sub-progress-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-subheader-color);
  cursor: pointer;
}

.sub-progress-item input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 1.5px solid #cbd5e1;
  border-radius: 24px;
  background-color: #ffffff;
  cursor: pointer;
  position: relative;
}

.sub-progress-item input[type="checkbox"]:checked {
  background-color: var(--color-blue);
  border-color: var(--color-blue);
}

.sub-progress-item input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.sub-progress-item input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 2px;
}

/* 3. ฝั่งขวา: ปุ่มจุดไข่ปลา 3 จุด */
.more-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--not-active-color);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.task-menu {
  position: relative;
}

.task-menu summary {
  list-style: none;
}

.task-menu summary::-webkit-details-marker {
  display: none;
}

.task-menu-items {
  position: absolute;
  z-index: 1;
  top: 100%;
  right: 0;
  display: grid;
  min-width: 120px;
  padding: 4px;
  background: var(--color-white);
  box-shadow: var(--box-shadow);
}

.task-menu-items button {
  padding: 8px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.more-btn:hover {
  background-color: #f2f2f6;
  color: #000000;
}

@media screen and (max-width: 768px) {

  .dashboard-status {
    max-width: 100%;
  }
  .dashboard-status-item {
    min-width: 0;
    padding: 0 8px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .status-tabs {
    justify-content: center;
    min-width: 0;
  }

  .tab-btn {
    min-width: 0px;
    padding: 8px 16px;
  }

  .search-group {
    flex: 0 1 auto;
  }
    
}