/* ============================================================
   CGH HEALTH CHECK+ GUIDE | styles.css (Clean Edition)
   ใช้แทน public/styles.css เดิมทั้งไฟล์

   รองรับ: หน้าเว็บ / แอดมิน / บทความและรูปภาพหลายรูป /
   ค้นหาแบบไอคอน / Dark & Light Mode / มือถือและแท็บเล็ต

   แก้ขนาดโทรศัพท์: ค้นหา --iphone-width
   แก้สีธีม: ค้นหา :root และ html[data-theme="light"]
   ============================================================ */

:root {
  --green: #087c55;
  --dark: #064b39;
  --mint: #dcf8e8;
  --text: #233d36;
  --muted: #728780;
  --line: #e6efeb;
  --bg: #f8fbf9;
  --shadow: 0 18px 50px rgba(12,75,52,.075);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Sarabun",sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  text-decoration: none;
  color: inherit;
}

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #f9b54c;
  outline-offset: 3px;
}

.topbar {
  height: 84px;
  padding: 0 max(5%,calc((100% - 1320px)/2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 20px #123e2410;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-logo {
  font-size: 30px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -2px;
}

.brand-logo span, .plus {
  color: #ed9c2a;
}

.brand-copy {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
  line-height: 1.2;
}

.brand-copy small {
  display: block;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.topnav {
  display: flex;
  gap: 32px;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
}

.topnav a:hover {
  color: var(--green);
}

.admin-link {
  border: 1px solid var(--line);
  padding: 10px 15px;
  border-radius: 50px;
}

.menu-toggle {
  display: none;
  background: none;
  border: 0;
  font-size: 25px;
}

.hero {
  min-height: 555px;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.18fr .82fr;
  padding: 65px max(6%,calc((100% - 1280px)/2));
  background: linear-gradient(116deg,#e9fbf2 0%,#d5f4e4 38%,#73cba5 76%,#16865d 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -70% 30%;
  height: 560px;
  border-radius: 50%;
  background: #fff2;
  filter: blur(30px);
}

.hero-content {
  z-index: 2;
  max-width: 700px;
}

.eyebrow, .kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #27845e;
}

.eyebrow {
  color: #227b56;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f3ad39;
  margin-right: 8px;
}

.hero h1 {
  font-size: clamp(37px,4.3vw,65px);
  letter-spacing: -2px;
  line-height: 1.21;
  margin: 22px 0;
  font-weight: 800;
  color: #299f39;
}

.hero h1 em {
  font-style: normal;
  color: #039666;
}

.hero p {
  line-height: 1.95;
  max-width: 610px;
  font-size: 16px;
  color: #42695b;
}

.primary {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(120deg,#029a65,#08714f);
  color: white;
  font-weight: 700;
  padding: 13px 22px;
}

.hero-info {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 12px;
  font-weight: 600;
  color: #527967;
}

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

.orb {
  position: absolute;
  border-radius: 100%;
  border: 1px solid #fff7;
}

.orb-1 {
  width: 480px;
  height: 480px;
  background: #fff2;
}

.orb-2 {
  width: 350px;
  height: 350px;
  background: #fff3;
}

.float-chip {
  position: absolute;
  z-index: 3;
  background: white;
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 12px;
  color: #176748;
  font-weight: 800;
}

.chip-one {
  top: 90px;
  right: -2%;
}

.chip-two {
  bottom: 60px;
  left: 0;
}

.section {
  max-width: 1320px;
  margin: auto;
  padding: 83px 5% 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 25px;
}

.section-head h2, .help-block h2 {
  font-size: 32px;
  color: #184e3b;
  margin: 9px 0 7px;
}

.section-head p, .help-block p {
  color: var(--muted);
  margin: 0;
  line-height: 1.7;
}

.subtle-button {
  border: 0;
  background: none;
  color: #087e55;
  font-weight: 800;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(5,1fr);
  gap: 17px;
}

.category-card {
  border: 1px solid #e4eee8;
  background: #fff;
  border-radius: 21px;
  padding: 24px 16px;
  text-align: left;
  box-shadow: var(--shadow);
  transition: .2s;
  min-height: 174px;
}

.category-card:hover, .category-card.selected {
  transform: translateY(-4px);
  border-color: #65c6a1;
  background: #f3fff8;
}

.category-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 29px;
  width: 59px;
  height: 59px;
  background: linear-gradient(130deg,#e5fae9,#c9f4e1);
  border-radius: 17px;
  margin-bottom: 18px;
}

.category-card strong {
  display: block;
  font-size: 15px;
}

.category-card small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  border: 1px solid #dcece2;
  border-radius: 30px;
  background: #fff;
  padding: 9px 13px;
  color: #47705e;
  font-size: 12px;
}

.chip.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 22px;
}

.article {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 23px;
  overflow: hidden;
  box-shadow: var(--shadow);
  text-align: left;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.article:hover {
  transform: translateY(-3px);
  transition: .2s;
  box-shadow: 0 22px 45px #064d3521;
}

.cover {
  height: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(130deg,#def7e8,#90d7b3);
  position: relative;
  overflow: hidden;
}

.cover img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.cover-icon {
  font-size: 77px;
  color: #138b62;
  opacity: .75;
}

.video-flag {
  position: absolute;
  top: 15px;
  right: 15px;
  background: white;
  border-radius: 30px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 700;
  color: #0b8157;
}

.article-body {
  padding: 22px;
  flex: 1;
}

.article-tag {
  font-size: 11px;
  color: #0e9b69;
  font-weight: 800;
}

.article h3 {
  margin: 9px 0;
  font-size: 19px;
  color: #1c4d3a;
}

.article p {
  font-size: 13px;
  color: #788b82;
  line-height: 1.7;
  margin: 0;
}

.article-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 22px 22px;
  font-size: 12px;
  color: #0b8c60;
  font-weight: 700;
}

.empty, .loading {
  text-align: center;
  color: #648777;
  padding: 50px;
  grid-column: 1/-1;
}

.help-block {
  margin: 85px auto 60px;
  max-width: 1180px;
  border-radius: 30px;
  background: linear-gradient(110deg,#e4f9ea,#c8f2df);
  padding: 36px 45px;
  display: flex;
  align-items: center;
  gap: 30px;
}

.help-art {
  font-size: 55px;
  color: #18a274;
}

.help-block>div:nth-child(2) {
  flex: 1;
}

.help-contact {
  background: #0d8057;
  color: white;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

footer {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 26px 6%;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
  color: #90a39b;
  font-size: 12px;
}

footer b {
  font-size: 20px;
  color: #087c55;
}

.detail-dialog {
  width: min(760px,calc(100% - 22px));
  max-height: 88vh;
  border: 0;
  border-radius: 23px;
  padding: 0;
  box-shadow: 0 25px 100px #002d1b66;
}

.detail-dialog::backdrop {
  background: #0c3527a8;
  backdrop-filter: blur(4px);
}

.close-dialog {
  position: sticky;
  float: right;
  top: 15px;
  right: 15px;
  margin: 15px;
  border: 0;
  background: #e5f6ed;
  border-radius: 50%;
  width: 37px;
  height: 37px;
  font-size: 25px;
  z-index: 5;
}

.detail-content {
  padding: 38px;
}

.detail-content h2 {
  font-size: 29px;
  color: #0d6c4d;
}

.detail-content p {
  white-space: pre-line;
  line-height: 2;
  color: #486a59;
}

.detail-content img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 15px;
  background: #effaf4;
}

.video-wrap {
  aspect-ratio: 16/9;
}

.video-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 15px;
}

.admin-container {
  max-width: 1200px;
  margin: 45px auto;
  padding: 0 24px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-head h1 {
  margin-bottom: 5px;
  font-size: 31px;
  color: #135b40;
}

.admin-head p {
  color: var(--muted);
}

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  box-shadow: var(--shadow);
  margin-top: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
}

.field.full {
  grid-column: 1/-1;
}

.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid #d8e9df;
  border-radius: 10px;
  padding: 12px;
  color: #295946;
  background: #fbfffc;
}

.field textarea {
  min-height: 185px;
  resize: vertical;
}

.btn-secondary {
  border: 1px solid #b9dac8;
  border-radius: 12px;
  padding: 12px 18px;
  background: white;
  color: #087950;
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-item {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: #f6fbf8;
  border-radius: 13px;
}

.admin-item small {
  display: block;
  color: #799187;
  margin-top: 5px;
}

.admin-item button {
  margin: 3px;
}

.status {
  color: #16825a;
  font-size: 13px;
  margin-top: 13px;
}

.danger {
  color: #b63b3b;
}

.login-panel {
  max-width: 445px;
  margin: 100px auto;
}

.login-panel h1 {
  color: #126747;
}

.login-panel .field {
  margin: 15px 0;
}

@media (max-width:1050px) {
  .hero {
    padding: 65px 5%;
    grid-template-columns: 1.2fr .8fr;
  }

  .hero h1 {
    font-size: 47px;
  }

  .category-grid {
    grid-template-columns: repeat(3,1fr);
  }

  .article-grid {
    grid-template-columns: repeat(2,1fr);
  }

  .chip-one {
    right: -4%;
  }

}

@media (max-width:760px) {
  .topbar {
    height: 68px;
    padding: 0 20px;
  }

  .brand-logo {
    font-size: 25px;
  }

  .topnav {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: white;
    padding: 22px;
    flex-direction: column;
    align-items: start;
    box-shadow: var(--shadow);
  }

  .topnav.open {
    display: flex;
  }

  .menu-toggle {
    display: block;
  }

  .hero {
    display: block;
    padding: 50px 22px 40px;
    min-height: 0;
  }

  .hero h1 {
    font-size: 39px;
  }

  .hero p {
    font-size: 14px;
  }

  .hero-visual {
    min-height: 350px;
    margin-top: 15px;
    transform: scale(.84);
  }

  .hero-info {
    gap: 9px;
  }

  .section {
    padding: 57px 20px 0;
  }

  .section-head {
    align-items: start;
    flex-wrap: wrap;
  }

  .section-head h2, .help-block h2 {
    font-size: 27px;
  }

  .category-grid {
    grid-template-columns: repeat(2,1fr);
    gap: 11px;
  }

  .category-card {
    padding: 16px;
    min-height: 160px;
  }

  .category-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .article-grid {
    grid-template-columns: 1fr;
  }

  .chips {
    justify-content: flex-start;
  }

  .help-block {
    margin: 60px 20px 30px;
    padding: 29px;
    display: block;
  }

  .help-contact {
    display: inline-block;
    margin-top: 20px;
    white-space: normal;
  }

  footer {
    display: block;
    text-align: center;
    line-height: 2;
  }

  .detail-content {
    padding: 24px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .admin-head {
    display: block;
  }

  .admin-container {
    padding: 0 15px;
  }

  .panel {
    padding: 20px;
  }

}

@media (max-width:380px) {
  .hero h1 {
    font-size: 34px;
  }

  .category-grid {
    grid-template-columns: 1fr 1fr;
  }

  .category-card strong {
    font-size: 13px;
  }

}

:root {
  color-scheme: dark;
  --green: #35d09d;
  --dark: #09241a;
  --mint: #173a2b;
  --text: #e7f1ed;
  --muted: #9bafa7;
  --line: #2b453c;
  --bg: #0e1915;
  --shadow: 0 18px 50px rgba(0,0,0,.2);
}

body {
  background: radial-gradient(circle at 92% 13%,rgba(120,84,34,.10),transparent 29%),#0e1915;
  color: var(--text);
}

.topbar {
  background: #0d1a15;
  border-bottom: 1px solid #263b33;
  box-shadow: none;
}

.brand-logo {
  color: #f2faf6;
}

.brand-copy {
  color: #f2faf6;
}

.topnav a {
  color: #b6cbc1;
}

.topnav a:hover {
  color: #43d5a5;
}

.admin-link {
  border-color: #30493d;
  background: #16241e;
}

.hero {
  margin: 18px 2% 0;
  border: 1px solid #2b453d;
  border-radius: 36px;
  padding: 70px 5%;
  min-height: 540px;
  background: radial-gradient(circle at 94% 29%,rgba(178,116,47,.18),transparent 30%),radial-gradient(circle at 48% 85%,rgba(8,92,63,.20),transparent 45%),linear-gradient(113deg,#14231d 0%,#12261d 64%,#26251b 100%);
}

.hero::after {
  background: rgba(29,150,98,.05);
}

.hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 42% 55%,rgba(5,120,76,.08),transparent 35%);
}

.eyebrow, .kicker {
  color: #36d3a1;
}

.eyebrow {
  color: #45d6a6;
}

.dot {
  background: #34d39e;
  box-shadow: 0 0 0 5px rgba(52,211,158,.12);
}

.hero h1 {
  color: #e9f4ef;
}

.hero h1 em {
  color: #3ad5a0;
}

.hero p {
  color: #a4b7af;
}

.hero-info {
  color: #9fb8aa;
}

.orb {
  border-color: rgba(97,158,129,.17);
}

.orb-1 {
  background: rgba(31,105,74,.09);
}

.orb-2 {
  background: rgba(29,142,90,.07);
}

.float-chip {
  background: #1c3027;
  border: 1px solid #385044;
  color: #caede0;
  box-shadow: 0 10px 30px #0005;
}

.section-head h2, .help-block h2 {
  color: #eff6f2;
}

.section-head p, .help-block p {
  color: #a0b5aa;
}

.subtle-button {
  color: #47d6a5;
}

.category-card, .article, .panel {
  background: #172620;
  border-color: #2e463a;
  box-shadow: 0 8px 28px #0000001f;
  color: #e3eee7;
}

.category-card:hover, .category-card.selected {
  background: #1b372b;
  border-color: #30bd89;
}

.category-icon {
  background: linear-gradient(125deg,#1d5940,#213d31);
  color: #49e1a5;
}

.category-card small, .article p {
  color: #98afa4;
}

.chip {
  background: #1a2b23;
  border-color: #344d40;
  color: #c2d6c9;
}

.chip.active {
  background: #0e845f;
  border-color: #25b88b;
  color: white;
}

.cover {
  background: linear-gradient(135deg,#193e2f,#24533f);
}

.cover-icon, .article-tag, .article-foot {
  color: #3ed29c;
}

.article h3 {
  color: #eef8f1;
}

.video-flag {
  background: #1e352a;
  color: #64e1b2;
}

.help-block {
  background: linear-gradient(115deg,#193b2b,#1a2b22 65%,#303023);
  border: 1px solid #315343;
}

.help-art {
  color: #45d9a3;
}

.help-contact, .primary {
  background: linear-gradient(120deg,#0c996c,#087555);
  color: white;
}

footer {
  background: #101d17;
  border-color: #294237;
  color: #92a99b;
}

footer b {
  color: #49d4a0;
}

.detail-dialog {
  background: #192820;
  color: #e9f4ed;
  border: 1px solid #385044;
}

.close-dialog {
  background: #274636;
  color: #eff8f3;
}

.detail-content h2 {
  color: #44d5a2;
}

.detail-content p {
  color: #c0d0c6;
}

.detail-content img {
  background: #172920;
}

.admin-head h1, .login-panel h1 {
  color: #dff8eb;
}

.field input, .field textarea, .field select {
  background: #102017;
  color: #f3faf5;
  border-color: #3a5848;
}

.field input::placeholder, .field textarea::placeholder {
  color: #819b8b;
}

.btn-secondary {
  background: #1b3025;
  color: #55dca9;
  border-color: #41664f;
}

.admin-item {
  background: #1d3327;
}

.admin-item small {
  color: #9eafa5;
}

.status {
  color: #60ddb0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.search-area {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 30px 0 22px;
  min-height: 52px;
  width: fit-content;
  max-width: 100%;
  z-index: 6;
}

.search-toggle {
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  background: #098660;
  color: #eafff4;
  border: 1px solid #2dbb8d;
  border-radius: 16px;
  box-shadow: 0 9px 24px #04140d66;
  transition: background .2s,transform .2s;
}

.search-toggle:hover {
  background: #0ca77a;
  transform: translateY(-2px);
}

.search-hint {
  font-size: 13px;
  color: #a7c4b4;
  pointer-events: none;
  transition: opacity .15s;
}

.search-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: min(470px,calc(100vw - 155px));
  border: 1px solid #355b49;
  border-radius: 15px;
  padding: 5px;
  background: #1b3027;
  box-shadow: 0 18px 40px #0004;
  animation: searchReveal .2s ease-out;
}

.search-panel[hidden] {
  display: none !important;
}

.search-area.is-open .search-hint {
  display: none;
}

.search-panel input {
  width: 100%;
  min-width: 0;
  flex: 1;
  outline: none;
  border: 0;
  background: transparent;
  color: #effcf4;
  padding: 10px 9px;
  font-size: 14px;
}

.search-panel input::placeholder {
  color: #91ab9d;
}

.search-submit {
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  background: #087c58;
  color: #fff;
  font-weight: 700;
  padding: 10px 14px;
  font-size: 12px;
}

.search-close {
  border: 0;
  background: transparent;
  color: #a7c1b4;
  font-size: 24px;
  padding: 0 6px;
}

@keyframes searchReveal {
  from {
    opacity: 0;
    transform: translateX(-9px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }

}

@media (max-width:760px) {
  .topnav {
    background: #15251d;
    border-top: 1px solid #2b4438;
  }

  .menu-toggle {
    color: #f2faf6;
  }

  .hero {
    margin: 10px 12px 0;
    border-radius: 24px;
    padding: 44px 22px 35px;
  }

  .search-area {
    margin: 23px 0;
  }

  .search-toggle {
    flex-basis: 48px;
    width: 48px;
    height: 48px;
  }

  .search-panel {
    width: min(350px,calc(100vw - 110px));
  }

  .search-submit {
    padding: 9px 10px;
  }

  .search-panel input {
    font-size: 13px;
  }

  .search-hint {
    font-size: 12px;
  }

  .category-card {
    min-height: 156px;
  }

  .hero-visual {
    margin-top: 0;
  }

}

@media (max-width:380px) {
  .search-panel {
    width: calc(100vw - 112px);
  }

  .search-panel input {
    font-size: 12px;
  }

  .search-submit {
    padding: 8px;
  }

}

@media (prefers-reduced-motion:reduce) {
  .search-panel {
    animation: none;
  }

  .search-toggle {
    transition: none;
  }

}

.header-actions {
  display: flex;
  align-items: center;
  gap: 13px;
}

.theme-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: #172720;
  color: #e3f3eb;
  border-radius: 15px;
  transition: background .18s,transform .18s;
}

.theme-toggle:hover {
  background: #234b37;
  transform: translateY(-1px);
}

.theme-icon {
  width: 21px;
  height: 21px;
}

html[data-theme="dark"] .theme-icon.moon, html[data-theme="light"] .theme-icon.sun {
  display: none;
}

html[data-theme="light"] {
  color-scheme: light;
  --green: #087c55;
  --dark: #064b39;
  --mint: #dcf8e8;
  --text: #233d36;
  --muted: #728780;
  --line: #e1ebe5;
  --bg: #f8fbf9;
  --shadow: 0 18px 50px rgba(12,75,52,.075);
}

html[data-theme="light"] body {
  background: radial-gradient(circle at 93% 11%,rgba(136,210,174,.12),transparent 28%),#f8fbf9;
  color: var(--text);
}

html[data-theme="light"] .topbar {
  background: #fff;
  border-color: #e1ebe5;
  box-shadow: 0 1px 16px #123e2410;
}

html[data-theme="light"] .brand-logo, html[data-theme="light"] .brand-copy {
  color: #18543d;
}

html[data-theme="light"] .topnav a {
  color: #385e4a;
}

html[data-theme="light"] .topnav a:hover {
  color: #087e55;
}

html[data-theme="light"] .admin-link {
  border-color: #dcece2;
  background: #f9fdfb;
}

html[data-theme="light"] .theme-toggle {
  background: #f2f8f4;
  color: #16573f;
  border-color: #cfe5d8;
}

html[data-theme="light"] .theme-toggle:hover {
  background: #e4f5e9;
}

html[data-theme="light"] .hero {
  background: radial-gradient(circle at 92% 28%,rgba(253,196,104,.20),transparent 32%),linear-gradient(112deg,#f0fff6 0%,#d9f4e6 54%,#a5dfc6 100%);
  border-color: #bfe7d1;
}

html[data-theme="light"] .hero::after {
  background: rgba(255,255,255,.27);
}

html[data-theme="light"] .hero-glow {
  background: radial-gradient(circle at 43% 55%,rgba(80,183,133,.10),transparent 35%);
}

html[data-theme="light"] .eyebrow, html[data-theme="light"] .kicker {
  color: #18855e;
}

html[data-theme="light"] .hero h1 {
  color: #174a37;
}

html[data-theme="light"] .hero h1 em {
  color: #098b61;
}

html[data-theme="light"] .hero p {
  color: #477463;
}

html[data-theme="light"] .hero-info {
  color: #5b826f;
}

html[data-theme="light"] .orb {
  border-color: rgba(255,255,255,.55);
}

html[data-theme="light"] .orb-1 {
  background: rgba(255,255,255,.14);
}

html[data-theme="light"] .orb-2 {
  background: rgba(255,255,255,.22);
}

html[data-theme="light"] .float-chip {
  background: #fff;
  border-color: #d7eee2;
  color: #197a55;
  box-shadow: var(--shadow);
}

html[data-theme="light"] .section-head h2, html[data-theme="light"] .help-block h2 {
  color: #184e3b;
}

html[data-theme="light"] .section-head p, html[data-theme="light"] .help-block p {
  color: #728780;
}

html[data-theme="light"] .subtle-button {
  color: #087e55;
}

html[data-theme="light"] .category-card, html[data-theme="light"] .article, html[data-theme="light"] .panel {
  background: #fff;
  border-color: #e1ebe5;
  color: #233d36;
  box-shadow: var(--shadow);
}

html[data-theme="light"] .category-card:hover, html[data-theme="light"] .category-card.selected {
  background: #f2fff7;
  border-color: #66cba5;
}

html[data-theme="light"] .category-icon {
  background: linear-gradient(125deg,#e5fae9,#c9f4e1);
  color: #11875f;
}

html[data-theme="light"] .category-card small, html[data-theme="light"] .article p {
  color: #728780;
}

html[data-theme="light"] .chip {
  background: #fff;
  border-color: #dcece2;
  color: #47705e;
}

html[data-theme="light"] .chip.active {
  background: #087c55;
  border-color: #087c55;
  color: white;
}

html[data-theme="light"] .cover {
  background: linear-gradient(135deg,#e6faed,#96d7b4);
}

html[data-theme="light"] .cover-icon, html[data-theme="light"] .article-tag, html[data-theme="light"] .article-foot {
  color: #11885e;
}

html[data-theme="light"] .article h3 {
  color: #1c4d3a;
}

html[data-theme="light"] .video-flag {
  background: #fff;
  color: #0b8157;
}

html[data-theme="light"] .help-block {
  background: linear-gradient(115deg,#e6f9ec,#c8f2df);
  border-color: #bee9d1;
}

html[data-theme="light"] .help-art {
  color: #18a274;
}

html[data-theme="light"] footer {
  background: #fff;
  border-color: #e1ebe5;
  color: #819c8d;
}

html[data-theme="light"] footer b {
  color: #087c55;
}

html[data-theme="light"] .detail-dialog {
  background: #fff;
  border-color: #d5e6db;
  color: #244835;
}

html[data-theme="light"] .close-dialog {
  background: #e5f6ed;
  color: #205941;
}

html[data-theme="light"] .detail-content h2 {
  color: #0d6c4d;
}

html[data-theme="light"] .detail-content p {
  color: #486a59;
}

html[data-theme="light"] .detail-content img {
  background: #effaf4;
}

html[data-theme="light"] .admin-head h1, html[data-theme="light"] .login-panel h1 {
  color: #135b40;
}

html[data-theme="light"] .field input, html[data-theme="light"] .field textarea, html[data-theme="light"] .field select {
  background: #fbfffc;
  color: #295946;
  border-color: #d8e9df;
}

html[data-theme="light"] .field input::placeholder, html[data-theme="light"] .field textarea::placeholder {
  color: #90a298;
}

html[data-theme="light"] .btn-secondary {
  background: #fff;
  color: #087950;
  border-color: #b9dac8;
}

html[data-theme="light"] .admin-item {
  background: #f6fbf8;
}

html[data-theme="light"] .admin-item small {
  color: #799187;
}

html[data-theme="light"] .status {
  color: #16825a;
}

html[data-theme="light"] .search-hint {
  color: #477363;
}

html[data-theme="light"] .search-toggle {
  background: #098660;
  border-color: #31bb8c;
  color: #fff;
  box-shadow: 0 9px 24px #087c5430;
}

html[data-theme="light"] .search-panel {
  background: #fff;
  border-color: #bfdfce;
  box-shadow: 0 18px 40px #115f3f21;
}

html[data-theme="light"] .search-panel input {
  color: #204d39;
}

html[data-theme="light"] .search-panel input::placeholder {
  color: #829c8c;
}

html[data-theme="light"] .search-close {
  color: #567764;
}

@media (max-width:760px) {
  html[data-theme="light"] .topnav {
    background: #fff;
    border-color: #dcece2;
  }

  html[data-theme="light"] .menu-toggle {
    color: #18543d;
  }

  .header-actions {
    gap: 8px;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    border-radius: 12px;
  }

  .back-link {
    font-size: 12px;
  }

}

@media (prefers-reduced-motion:reduce) {
  .theme-toggle {
    transition: none;
  }

}

.block-editor {
  padding: 18px;
  border: 1px solid var(--line, #355245);
  border-radius: 16px;
  min-width: 0;
}

.block-editor-heading h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.block-editor-heading p {
  margin: 0 0 12px;
  opacity: .75;
}

.block-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.blocks-list {
  display: grid;
  gap: 12px;
}

.block-item {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line, #355245);
  border-radius: 14px;
  background: var(--surface, rgba(120,160,135,.05));
  min-width: 0;
}

.block-row, .block-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.block-controls {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.block-controls button {
  min-width: 36px;
}

.block-preview {
  width: 100%;
  max-width: 300px;
  max-height: 200px;
  object-fit: contain;
  border-radius: 10px;
}

.blocks-empty {
  opacity: .7;
  font-size: .9rem;
  margin: 10px 0;
}

.guide-step-heading {
  margin: 24px 0 10px;
  font-size: 1.2rem;
}

.guide-step-text {
  white-space: pre-line;
  line-height: 1.8;
}

.guide-step-image {
  margin: 22px 0;
  text-align: center;
}

.guide-step-image img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 14px;
}

.guide-step-image figcaption {
  margin-top: 9px;
  opacity: .75;
  font-size: .9rem;
}

@media (max-width:640px) {
  .block-row {
    align-items: flex-start;
  }

  .block-controls {
    gap: 4px;
  }

  .block-item {
    padding: 12px;
  }

}

/* ============================================================
   01. BRAND IMAGE + CATEGORY IMAGE ICONS
   ============================================================ */
.brand-image {
  width: 52px;
  height: 52px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  padding: 5px;
  flex-shrink: 0;
}

.category-icon img,
.category-icon .category-icon-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.primary {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(120deg, #0c996c, #087555);
  color: #fff;
  font-weight: 700;
  padding: 13px 22px;
}

/* ============================================================
   02. PHONE FRAME (ONE SOURCE OF TRUTH)
   สัดส่วนตัวเครื่อง 71.9 : 150 (อัตราส่วนเพื่อจัดวางบนเว็บ)
   ความกว้างปรับตามพื้นที่ ความสูงคำนวณอัตโนมัติ

   HTML ที่รองรับ:
   <div class="phone iphone-18-pro">
     <img class="phone-screen" src="/images/cgh-app-screen.png" draggable="false" alt="">
     <div class="phone-top"></div>
   </div>
   ============================================================ */
.hero-visual {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.hero-visual .phone {
  --iphone-width: 255px; /* เปลี่ยนขนาดเครื่องบนคอมพิวเตอร์ตรงนี้ */
  --iphone-radius: 48px;
  position: relative;
  flex: 0 0 auto;
  width: min(var(--iphone-width), 75vw);
  height: auto;
  aspect-ratio: 71.9 / 150;
  box-sizing: border-box;
  padding: 6px;
  border: 4px solid #292e2c;
  border-radius: var(--iphone-radius);
  background: #050706;
  overflow: hidden;
  transform: rotate(7deg);
  box-shadow:
    0 0 0 2px #53615a,
    0 0 0 5px #10291f,
    0 28px 65px rgba(0, 0, 0, 0.38),
    0 0 42px rgba(26, 164, 112, 0.10);
}

.hero-visual .phone-screen {
  position: absolute;
  inset: 6px;
  display: block;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  object-fit: cover;
  object-position: center top;
  border-radius: calc(var(--iphone-radius) - 10px);
  transform: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.hero-visual .phone-top {
  position: absolute;
  top: 11px;
  left: 50%;
  width: 27%;
  height: 20px;
  transform: translateX(-50%);
  background: #050505;
  border-radius: 999px;
  z-index: 5;
}

/* ไม่ให้ปุ่มตกแต่งจาก CSS รุ่นก่อนทับกรอบใหม่ */
.hero-visual .phone::before,
.hero-visual .phone::after {
  content: none;
}

/* ใช้กรอบเครื่องสีดำในทั้งสองธีม */
html[data-theme="light"] .hero-visual .phone {
  border-color: #292e2c;
  background: #050706;
  box-shadow:
    0 0 0 2px #53615a,
    0 0 0 5px #10291f,
    0 28px 65px rgba(0, 0, 0, 0.27);
}
html[data-theme="light"] .hero-visual .phone-top {
  background: #050505;
}

/* ============================================================
   03. RESPONSIVE ADJUSTMENTS (PHONE FRAME + LOGO)
   ============================================================ */
@media (max-width: 760px) {
  .brand-image {
    width: 42px;
    height: 42px;
  }

  .hero-visual {
    min-height: 510px;
    /* ยกเลิก scale(.84) ของเลย์เอาต์รุ่นเก่า: ไม่หดเครื่องผิดสัดส่วน */
    transform: none;
  }

  .hero-visual .phone {
    --iphone-width: 205px;
    --iphone-radius: 43px;
  }
}

@media (max-width: 380px) {
  .hero-visual {
    min-height: 460px;
  }

  .hero-visual .phone {
    --iphone-width: 215px;
    --iphone-radius: 39px;
  }
}

/* =============================================
   v1.5 — Floating phone, Smart Search, Analytics
   ============================================= */
@keyframes cghPhoneFloat {
  0%,100% { translate:0 0; }
  50% { translate:0 -12px; }
}
.hero-visual .phone { animation:cghPhoneFloat 5.6s ease-in-out infinite; will-change:translate; }
@media(prefers-reduced-motion:reduce){.hero-visual .phone{animation:none;will-change:auto}}
.search-area { position:relative; }
.search-suggestions {
  position:absolute; z-index:40; top:calc(100% + 8px); left:0;
  width:min(470px,calc(100vw - 54px));max-height:340px; overflow-y:auto;
  border:1px solid var(--line); border-radius:15px; padding:8px;
  background:var(--bg); color:var(--text); box-shadow:0 18px 50px rgba(0,0,0,.25);
}
.search-suggestions[hidden] {display:none!important;}
.suggestions-heading {padding:7px 11px;font-size:12px;color:var(--muted);font-weight:700;}
.suggestion-item {display:flex; flex-direction:column;align-items:flex-start;gap:3px;width:100%;
  color:var(--text);background:transparent;border:0;border-radius:10px;padding:11px 12px;text-align:left;}
.suggestion-item:hover,.suggestion-item:focus-visible {background:var(--mint);}
.suggestion-item strong {font-size:14px;}
.suggestion-item small,.suggestions-empty {font-size:12px;color:var(--muted);}
.suggestions-empty {padding:10px 12px;}
.analytics-header {display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;}
.analytics-header h2 {margin:7px 0;}
.analytics-header p,.analytics-note {color:var(--muted);font-size:13px;}
.analytics-cards {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:20px;}
.analytics-card {padding:20px;border:1px solid var(--line);border-radius:16px;background:var(--mint);display:grid;gap:5px;}
.analytics-card strong {font-size:28px;color:var(--green);font-variant-numeric:tabular-nums;}
.analytics-card span {font-size:13px;color:var(--text);}
.analytics-details {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;margin-top:18px;}
.analytics-details h3 {font-size:16px;}
.analytics-row {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid var(--line);font-size:13px;}
.analytics-row strong {font-variant-numeric:tabular-nums;color:var(--green);}
.analytics-list>p {font-size:13px;color:var(--muted);}
@media(max-width:760px){.analytics-cards{grid-template-columns:1fr}.analytics-details{grid-template-columns:1fr}.search-suggestions{max-width:calc(100vw - 54px)}}
