/* ==========================================================================
   FIN FOR KIDS PLUS — เช็กเบี้ยประกันเด็ก
   สไตล์ทั้งหมด scope ใต้ .fin-kids จึงไม่ชนกับ CSS ของโปรเจกต์ปลายทาง
   keyframes ทุกตัวขึ้นต้น finkids- ด้วยเหตุผลเดียวกัน

   สีทั้งหมดมาจาก CI ข้อ 5.1 — แก้สีแบรนด์ได้โดยทับตัวแปรจาก CSS ของคุณเอง
   ไม่ต้องแก้ไฟล์นี้ ดูวิธีใน README หัวข้อ "เปลี่ยนสีแบรนด์"
   ========================================================================== */

.fin-kids {
  /* ---- CI 5.1 สีหลัก ---- */
  --red:        #E51E2A;   /* ราคา ตัวเลขสำคัญ ป้าย CTA */
  --red-deep:   #B8151F;
  --navy:       #19186A;   /* หัวข้อหลัก ชื่อแผน ตาราง */
  --navy-deep:  #101047;
  --ink:        #333333;   /* CI: Text Gray */
  --ink-soft:   #6B7280;
  --line:       #E5E7EB;
  --gray:       #F3F4F6;   /* CI: Light Gray */
  --soft-red:   #FDE9EB;   /* CI: Soft Red */
  --soft-navy:  #E9EAF7;   /* CI: Soft Navy */
  --white:      #FFFFFF;
  --line-green: #06C755;   /* สีทางการของ LINE ใช้เฉพาะปุ่ม/สถานะ LINE */

  /* สถานะ "เลือกแล้ว" ของการ์ดแผน — อยู่นอกจานสี CI ข้อ 5.1
     รวมไว้เป็นตัวแปรคู่นี้ ถ้าฝ่ายแบรนด์ให้กลับไปใช้แดง เปลี่ยนสองบรรทัดนี้จบ */
  --pick:      #14A44D;
  --pick-soft: #E8F8EE;

  /* ---- ระยะและรูปทรง (CI 7.2: มุมโค้ง 20–30px, เงาอ่อน) ---- */
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 10px;
  --shadow: 0 2px 10px rgba(25, 24, 106, .07);
  --shadow-up: 0 8px 28px rgba(25, 24, 106, .14);
  --maxw: 560px;

  font-family: "Kanit", "Prompt", "Noto Sans Thai", "IBM Plex Sans Thai",
               -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  box-sizing: border-box;
}
.fin-kids *, .fin-kids *::before, .fin-kids *::after { box-sizing: inherit; }
.fin-kids img { max-width: 100%; display: block; }
.fin-kids button { font: inherit; color: inherit; cursor: pointer; }

/* หน้าเต็ม: การ์ดกลางจอ · โหมด embed: ปล่อยให้ไหลตามคอนเทนเนอร์ของคุณ */
.fin-kids.is-page   { max-width: var(--maxw); margin: 0 auto; background: var(--white);
                      min-height: 100dvh; box-shadow: 0 0 44px rgba(25,24,106,.10);
                      overflow-x: hidden; }
.fin-kids.is-embed  { max-width: var(--maxw); margin: 0 auto; background: var(--white);
                      border: 1px solid var(--line); border-radius: var(--r-lg);
                      overflow: hidden; overflow-x: hidden; }

/* ============================== หัวหน้าแรก
   CI 1.1: โลโก้ FIN อยู่แถบหัว · CI 1.2: MSIG เป็นข้อความเท่านั้น ห้ามใส่โลโก้
   พื้นสว่างตามสัดส่วนที่ CI 5.2 แนะนำ (ขาว 55–70%) กรมท่าไปอยู่ที่ตัวหนังสือแทนพื้น
   ทำให้หน้าโปร่งขึ้นมากโดยที่สีแบรนด์ยังครบ                                     */
.fin-kids .hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 90% at 108% 0%, rgba(229, 30, 42, .10) 0%, rgba(229, 30, 42, 0) 58%),
    linear-gradient(135deg, #F4F5FC 0%, var(--white) 62%);
  color: var(--navy);
  padding: 9px 14px 18px;
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 16px 16px;
}
.fin-kids .hero::after {
  content: ""; position: absolute; right: -40px; top: -48px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(229, 30, 42, .09);
}
.fin-kids .hero::before {
  content: ""; position: absolute; right: 24px; bottom: -32px; width: 70px; height: 70px;
  border-radius: 50%; background: rgba(25, 24, 106, .05);
}
.fin-kids .hero-bar {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 7px;
}
.fin-kids .hero .logo { height: 24px; width: auto; flex: none; }
.fin-kids .hero .insurer {
  flex: none; font-size: 9px; font-weight: 600; color: var(--navy);
  background: var(--soft-navy); border: 1px solid rgba(25, 24, 106, .12);
  border-radius: 99px; padding: 3px 8px; white-space: nowrap;
}
.fin-kids .hero h1 {
  position: relative; margin: 0; font-size: 17px; font-weight: 700;
  color: var(--navy); line-height: 1.25; letter-spacing: -.3px;
}
.fin-kids .hero p    { position: relative; margin: 3px 0 0; font-size: 10.5px;
                       color: var(--ink-soft); font-weight: 500; }
.fin-kids .hero p b  { font-weight: 700; color: var(--navy); }
.fin-kids .hero p i  { color: var(--red); font-weight: 700; font-style: normal; }

/* ป้ายจุดเด่น — เม็ดยาขาวมีเครื่องหมายถูกสีแดงนำหน้า
   CI ข้อ 9 อนุญาตไอคอนเช็กวงกลมสีแดง จึงใช้เป็นสัญลักษณ์นำแทนไอคอนตกแต่งอื่น */
.fin-kids .hero .hi {
  position: relative; list-style: none; margin: 8px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.fin-kids .hero .hi li {
  display: flex; align-items: center; gap: 5px;
  background: var(--white); border: 1px solid rgba(25, 24, 106, .12);
  border-radius: 99px; padding: 3px 9px 3px 7px;
  font-size: 9.5px; font-weight: 600; color: var(--navy); line-height: 1.35;
  box-shadow: 0 1px 3px rgba(25, 24, 106, .07);
}
.fin-kids .hero .hi li::before {
  content: "✓"; flex: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--red); color: var(--white);
  display: grid; place-items: center; font-size: 7.5px; font-weight: 700; line-height: 1;
}

/* ============================== แถบขั้นตอนแบบเม็ดยา
   บอกทั้งลำดับและสถานะในแถวเดียว ไม่ต้องมีบรรทัด "ขั้นตอน x จาก 4" แยกอีก */
.fin-kids .steps {
  position: sticky; top: 0; z-index: 30;
  display: flex; gap: 5px; padding: 6px 12px;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.fin-kids .stp {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 5px 4px; border-radius: 99px; background: var(--gray);
  transition: background .25s, color .25s;
}
.fin-kids .stp .n {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  background: #D1D5DB; color: var(--white);
  display: grid; place-items: center; font-size: 9.5px; font-weight: 700;
  transition: background .25s;
}
.fin-kids .stp .t {
  font-size: 9.5px; font-weight: 600; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .25s;
}
.fin-kids .stp.done            { background: var(--soft-navy); }
.fin-kids .stp.done .n         { background: var(--navy); }
.fin-kids .stp.done .t         { color: var(--navy); }
.fin-kids .stp.now             { background: var(--soft-red); }
.fin-kids .stp.now .n          { background: var(--red); }
.fin-kids .stp.now .t          { color: var(--red-deep); }

@media (max-width: 419px) {
  .fin-kids .stp .t { display: none; }
  .fin-kids .stp    { padding: 6px 4px; }
}

/* ============================== แผงเฝ้าระวังสถานการณ์โรค
   พื้นสว่างตามสัดส่วนสีที่ CI 5.2 แนะนำ (ขาว 55–70%) ใช้แดงเป็นสีสัญญาณเท่านั้น
   ตั้งใจให้ "จริงจังและน่าเชื่อถือ" ไม่ใช่ "น่ากลัว" — CI ข้อ 2.3 ห้ามใช้ความกลัว
   กดดันการตัดสินใจ ทุกตัวเลขจึงมาพร้อมแหล่งอ้างอิงและวันที่ตัดข้อมูลเสมอ        */
.fin-kids .stats {
  position: relative; margin: 7px 12px 0; overflow: hidden;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px 10px 8px;
  box-shadow: 0 3px 11px rgba(25, 24, 106, .09);
}
/* แถบสัญญาณแดงพาดหัวแผง */
.fin-kids .stats::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--red), #FF8A93, var(--red));
}

.fin-kids .stats .st-h { position: relative; margin-bottom: 8px; text-align: center; }
.fin-kids .stats .st-ttl { display: flex; align-items: center; justify-content: center; gap: 7px; }
.fin-kids .stats .st-mark {
  width: 12px; height: 12px; flex: none; border-radius: 3px;
  background: var(--red); position: relative;
}
/* เครื่องหมายอัศเจรีย์ในกล่องแดง — สัญลักษณ์เฝ้าระวังมาตรฐาน อ่านออกทุกภาษา */
.fin-kids .stats .st-mark::before {
  content: "!"; position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--white); font-size: 8.5px; font-weight: 700; line-height: 1;
}
.fin-kids .stats .st-h h3 {
  margin: 0; font-size: 11.5px; font-weight: 700; color: var(--navy); line-height: 1.3;
}

.fin-kids .stats .st-tag {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  margin: 6px 0 0; padding: 3px 10px 3px 8px;
  background: var(--soft-red); border: 1px solid rgba(229, 30, 42, .28);
  border-radius: 99px;
  font-size: 9.5px; font-weight: 600; color: var(--navy); line-height: 1.35;
  animation: finkids-tagglow 2.6s ease-in-out infinite;
}
.fin-kids .stats .st-tag b { font-weight: 700; color: var(--red); }
.fin-kids .stats .st-dot {
  flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--red);
  animation: finkids-dot 2.6s ease-out infinite;
}
@keyframes finkids-tagglow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 30, 42, .26); }
  55%      { box-shadow: 0 0 0 7px rgba(229, 30, 42, 0); }
}
@keyframes finkids-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 30, 42, .5); }
  60%      { box-shadow: 0 0 0 5px rgba(229, 30, 42, 0); }
}

/* สามป้ายเรียงข้างกัน แต่ละป้ายจบในตัวเอง */
.fin-kids .stats .st-list {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
@media (max-width: 439px) { .fin-kids .stats .st-list { grid-template-columns: 1fr; } }

.fin-kids .stats .st-card {
  min-width: 0; display: flex; flex-direction: column; text-align: center;
  background: var(--gray); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 6px 6px;
  animation: finkids-rise .5s cubic-bezier(.22, 1, .36, 1) both;
}
/* ป้ายของโรคที่ยอดสูงสุดเน้นด้วยพื้นและกรอบ ไม่ใช่ตัวหนังสือที่ใหญ่กว่า */
.fin-kids .stats .st-card.lead {
  background: var(--soft-red); border-color: rgba(229, 30, 42, .30);
}
.fin-kids .stats .st-card:nth-child(2) { animation-delay: .08s; }
.fin-kids .stats .st-card:nth-child(3) { animation-delay: .16s; }
@keyframes finkids-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.fin-kids .stats .st-r1 { display: block; }
.fin-kids .stats .st-nm {
  display: flex; align-items: center; justify-content: center;
  min-height: 2.6em; min-width: 0;
  font-size: 10px; font-weight: 700; color: var(--navy);
  line-height: 1.3; overflow-wrap: anywhere;
}
.fin-kids .stats .st-n {
  display: block; margin-top: 2px; font-size: 14px; font-weight: 700; color: var(--red);
  line-height: 1.2; letter-spacing: -.4px;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
}
.fin-kids .stats .st-n i {
  font-style: normal; font-size: 8px; font-weight: 500; color: var(--ink-soft); margin-left: 3px;
}

.fin-kids .stats .st-r2 { display: block; margin-top: 7px; padding-top: 6px;
                          border-top: 1px solid rgba(25, 24, 106, .09); }
.fin-kids .stats .st-lb {
  display: block; min-width: 0; font-size: 8px; color: var(--ink-soft);
  line-height: 1.4; overflow-wrap: anywhere;
}
.fin-kids .stats .st-d      { font-weight: 700; color: var(--navy); }
.fin-kids .stats .st-d.none { font-weight: 600; color: var(--ink-soft); }
.fin-kids .stats .st-as {
  display: block; margin-top: 4px; padding-top: 4px;
  border-top: 1px solid rgba(25, 24, 106, .10);
  font-size: 7.5px; color: var(--ink-soft); line-height: 1.35;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
}

/* แหล่งอ้างอิง — อยู่ในกรอบเดียวกับป้ายเสมอ ห้ามหลุดออกไปลอยนอกแผง */
.fin-kids .stats .st-src {
  position: relative; margin-top: 8px; padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 7.5px; color: var(--ink-soft); line-height: 1.45; text-align: center;
}

/* ============================== ส่วนเนื้อหา */
.fin-kids .sec { padding: 16px 16px 4px; }
.fin-kids .sec-h { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 11px; }
.fin-kids .sec-h .ico {
  flex: none; width: 29px; height: 29px; border-radius: 9px;
  background: var(--soft-red); color: var(--red);
  display: grid; place-items: center; font-size: 15px;
}
.fin-kids .sec-h h3 { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--navy); }
.fin-kids .sec-h p  { margin: 1px 0 0; font-size: 11px; color: var(--ink-soft); line-height: 1.4; }

/* ============================== การ์ดช่วงอายุ (ขั้นที่ 1) */
.fin-kids .ages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 439px) { .fin-kids .ages { grid-template-columns: 1fr; } }

/* การ์ดเป็น flex column — ทุกบรรทัดจึงขึ้นบรรทัดใหม่เสมอ
   (span เป็น inline โดยธรรมชาติ ถ้าไม่บังคับตรงนี้ข้อความจะไหลต่อกันบรรทัดเดียว) */
.fin-kids .age {
  position: relative; text-align: center;
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-md);
  padding: 10px 8px 0; width: 100%; min-width: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.fin-kids .age:hover  { border-color: #C7C6E8; box-shadow: var(--shadow); }
.fin-kids .age:active { transform: scale(.985); }
.fin-kids .age.on {
  border-color: var(--red); box-shadow: 0 0 0 3px var(--soft-red);
  background: var(--soft-red);
}

.fin-kids .age .pic {
  display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
  border-radius: 10px; background: var(--gray); margin-bottom: 8px;
}
.fin-kids .age .nm   { display: block; font-size: 13.5px; font-weight: 700; color: var(--navy); line-height: 1.28; }
.fin-kids .age .rg   { display: block; font-size: 10.5px; color: var(--ink-soft); margin-top: 2px; line-height: 1.35; }
.fin-kids .age .dz {
  display: inline-block; margin-top: 7px; font-size: 9.5px; font-weight: 600; line-height: 1.35;
  color: var(--navy); background: var(--soft-navy); border-radius: 99px; padding: 3px 9px;
}
/* แถบราคาเป็นพื้นเทาอ่อนเต็มความกว้างท้ายการ์ด แยกจากส่วนข้อมูลชัดโดยไม่ต้องมีเส้นคั่น */
.fin-kids .age .sep  {
  display: block; width: calc(100% + 16px); margin: 9px -8px 0;
  height: 1px; background: var(--line);
}
.fin-kids .age .fr   {
  display: block; font-size: 9.5px; color: var(--ink-soft); line-height: 1.25;
  width: calc(100% + 16px); margin: 0 -8px; padding: 7px 0 0; background: var(--gray);
}
.fin-kids .age .pr, .fin-kids .age .un { width: calc(100% + 16px); margin-left: -8px; margin-right: -8px;
                                         background: var(--gray); }
.fin-kids .age .un   { padding-bottom: 8px; }
.fin-kids .age.on .fr, .fin-kids .age.on .pr, .fin-kids .age.on .un { background: transparent; }
.fin-kids .age .pr   { display: block; font-size: 18px; font-weight: 700; color: var(--red);
                       line-height: 1.2; letter-spacing: -.4px; margin-top: 1px; }
.fin-kids .age .un   { display: block; font-size: 10px; color: var(--ink-soft); line-height: 1.35; margin-top: 2px; }

/* ---- ดาวหางเส้นแดงวิ่งรอบกรอบ ----
   วงแหวนคือ ::before (กว้างเท่าการ์ด) ทับด้วย ::after สีขาวที่หดเข้ามา 1.5px
   เหลือให้เห็นเฉพาะขอบ · หมุนด้วยการเปลี่ยนมุมของ conic-gradient ไม่ใช่หมุนกล่อง
   จึงไม่ต้องคำนวณขนาดให้ครอบมุมการ์ด และไม่มีอาการกระตุกตอนเปลี่ยนความกว้างจอ

   ถ้าเบราว์เซอร์ไม่รองรับ @property: background-image จะถูกมองข้าม
   เหลือ background-color สีเส้นขอบปกติ — การ์ดยังมีกรอบเหมือนเดิม ไม่พัง        */
@property --finkids-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

.fin-kids.has-comet .age { border-color: transparent; }
.fin-kids.has-comet .age::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0;
  background-color: var(--line);
  background-image: conic-gradient(from var(--finkids-a),
    rgba(229, 30, 42, 0)   0deg,
    rgba(229, 30, 42, 0)   232deg,
    rgba(229, 30, 42, .14) 276deg,
    rgba(229, 30, 42, .42) 312deg,
    rgba(229, 30, 42, .80) 338deg,
    #FF8A93                352deg,
    #E51E2A                357deg,
    rgba(229, 30, 42, 0)   360deg);
  animation: finkids-comet 4.2s linear infinite;
}
.fin-kids.has-comet .age::after {
  content: ""; position: absolute; inset: 1.5px; border-radius: 14.5px;
  background: var(--white); z-index: 0;
}
/* เนื้อหาต้องลอยเหนือวงแหวน */
.fin-kids.has-comet .age > * { position: relative; z-index: 1; }

/* เหลื่อมเวลากันไว้ ดาวหาง 3 ดวงจะได้ไม่วิ่งพร้อมกันเป๊ะจนดูเป็นจังหวะเดียว */
.fin-kids.has-comet .age:nth-child(2)::before { animation-delay: -1.4s; }
.fin-kids.has-comet .age:nth-child(3)::before { animation-delay: -2.8s; }

/* เลือกแล้วหยุดวิ่ง เปลี่ยนเป็นกรอบแดงเต็มวง จะได้แยกออกว่าอันไหนถูกเลือก */
.fin-kids.has-comet .age.on::before { background: var(--red); animation: none; }
.fin-kids.has-comet .age.on::after  { background: var(--soft-red); }

@keyframes finkids-comet { to { --finkids-a: 360deg; } }

/* ============================== แผ่นเปรียบเทียบแผน (ขั้นที่ 2) */
.fin-kids .scrim {
  position: fixed; inset: 0; z-index: 60; background: rgba(16, 16, 71, .55);
  opacity: 0; pointer-events: none; transition: opacity .25s;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.fin-kids .scrim.on { opacity: 1; pointer-events: auto; }

.fin-kids .sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 61;
  width: 100%; max-width: var(--maxw); transform: translate(-50%, 100%);
  background: var(--white); border-radius: 24px 24px 0 0;
  max-height: 92dvh; display: flex; flex-direction: column;
  transition: transform .32s cubic-bezier(.32, .72, 0, 1);
  box-shadow: var(--shadow-up);
}
.fin-kids .sheet.on { transform: translate(-50%, 0); }

.fin-kids .sheet .sh-head {
  padding: 14px 16px 12px; border-bottom: 1px solid var(--line); flex: none; position: relative;
}
.fin-kids .sheet .grip {
  width: 38px; height: 4px; border-radius: 99px; background: var(--line);
  margin: 0 auto 11px;
}
.fin-kids .sheet .sh-head h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--navy); padding-right: 34px; }
.fin-kids .sheet .sh-head p  { margin: 2px 0 0; font-size: 12px; color: var(--ink-soft); }
.fin-kids .sheet .x {
  position: absolute; top: 22px; right: 12px; width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: var(--gray); color: var(--ink-soft); font-size: 16px; line-height: 1;
  display: grid; place-items: center;
}
.fin-kids .sheet .sh-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px 6px; }
.fin-kids .sheet .sh-foot {
  flex: none; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--white);
  border-radius: 0 0 0 0;
}

/* การ์ดแผน 3 ใบเรียงแนวตั้งข้างกัน — CI 16: แยกการ์ดชัดเจน หัวข้อกรมท่า ตัวเลขแดง
   เลือกด้วยการแตะที่การ์ด ไม่มีช่องติ๊ก ใช้ไฮไลต์แดงจางเหมือนการ์ดช่วงอายุ  */
.fin-kids .plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.fin-kids .plan {
  position: relative; width: 100%; min-width: 0; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--white);
  padding: 13px 7px 11px; overflow: hidden;
  transition: border-color .18s, box-shadow .18s, background .18s, transform .18s;
}
.fin-kids .plan:hover  { border-color: #C7C6E8; transform: translateY(-2px); }
.fin-kids .plan.on {
  border-color: var(--pick); box-shadow: 0 0 0 3px var(--pick-soft); background: var(--pick-soft);
}

/* โล่ประจำแผน — สีมาจากคลาสโทนของการ์ด ไม่ฝังสีใน SVG */
.fin-kids .plan .pshield {
  width: 32px; height: 36px; flex: none; overflow: visible;
  filter: drop-shadow(0 2px 4px rgba(25, 24, 106, .22));
}
.fin-kids .plan .pshield text { font-family: inherit; }
.fin-kids .plan.tone-navy .pshield { color: var(--navy); }
.fin-kids .plan.tone-red  .pshield { color: var(--red); }
.fin-kids .plan.tone-gold .pshield { color: #B8862B; }

/* โทนสีประจำแผน — ใช้เป็น currentColor ให้ทั้งโล่และหัวดาวหาง */
.fin-kids .plan.tone-navy { color: var(--navy); }
.fin-kids .plan.tone-red  { color: var(--red); }
.fin-kids .plan.tone-gold { color: #B8862B; }

/* ---- ดาวหางวิ่งรอบกรอบการ์ดแผน ----
   หลักการเดียวกับการ์ดช่วงอายุ: ::before เป็นวงแหวน ::after เป็นพื้นในที่หดเข้ามา
   ต่างกันตรงหัวดาวหางใช้ currentColor การ์ดแต่ละใบจึงได้สีตามระดับแผนของตัวเอง */
.fin-kids.has-comet .plan { border-color: transparent; }
.fin-kids.has-comet .plan::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0;
  background-color: var(--line);
  background-image: conic-gradient(from var(--finkids-a),
    var(--line)  0deg,
    var(--line)  252deg,
    currentColor 350deg,
    currentColor 356deg,
    var(--line)  360deg);
  animation: finkids-comet 4.6s linear infinite;
}
.fin-kids.has-comet .plan::after {
  content: ""; position: absolute; inset: 1.5px; border-radius: 14.5px;
  background: var(--white); z-index: 0;
}
.fin-kids.has-comet .plan > * { position: relative; z-index: 1; }

.fin-kids.has-comet .plan:nth-child(2)::before { animation-delay: -1.5s; }
.fin-kids.has-comet .plan:nth-child(3)::before { animation-delay: -3.0s; }

/* เลือกแล้ว: ดาวหางหยุด กรอบและพื้นเปลี่ยนเป็นเขียว */
.fin-kids.has-comet .plan.on::before { background: var(--pick); animation: none; }
.fin-kids.has-comet .plan.on::after  { background: var(--pick-soft); }

.fin-kids .plan .pn {
  display: block; margin-top: 7px; font-size: 12.5px; font-weight: 700;
  color: var(--navy); line-height: 1.25; letter-spacing: .3px;
}
.fin-kids .plan .pp { display: block; margin-top: 5px; }
.fin-kids .plan .pp .n {
  display: block; font-size: 17px; font-weight: 700; color: var(--red);
  line-height: 1.2; letter-spacing: -.4px;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
}
.fin-kids .plan .pp .u { display: block; font-size: 10px; color: var(--ink-soft); margin-top: 2px; }
.fin-kids .plan .sep {
  display: block; width: calc(100% - 4px); height: 1px; background: var(--line); margin: 8px 0 7px;
}

/* วงเงินเรียงลงมาในการ์ด อ่านไล่ลงทีละหมวด IPD กับ OPD จึงไม่ปนกัน */
.fin-kids .plan .kv { display: grid; gap: 5px; width: 100%; }
.fin-kids .plan .kv div { background: var(--gray); border-radius: 8px; padding: 5px 4px; }
.fin-kids .plan.on .kv div { background: rgba(255, 255, 255, .78); }
.fin-kids .plan .kv span { display: block; font-size: 9px; font-weight: 600; color: var(--ink-soft); line-height: 1.2; }
.fin-kids .plan .kv span i { display: block; font-style: normal; font-size: 7.5px; font-weight: 400; opacity: .8; }
.fin-kids .plan .kv b    { display: block; font-size: 12px; font-weight: 700; color: var(--navy); margin-top: 2px; }

.fin-kids .plans-note {
  margin-top: 8px; font-size: 10px; color: var(--ink-soft); text-align: center; line-height: 1.45;
}

/* ตารางเปรียบเทียบเต็ม — CI 10 ห้ามรวม IPD กับ OPD เป็นยอดเดียว จึงแยกแถวเสมอ */
.fin-kids .cmp { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 11px; }
.fin-kids .cmp th, .fin-kids .cmp td { padding: 6px 5px; border-bottom: 1px solid var(--line); vertical-align: top; }
.fin-kids .cmp thead th { background: var(--soft-navy); color: var(--navy); font-size: 10.5px; font-weight: 700;
                          text-align: center; border-bottom: 2px solid rgba(25, 24, 106, .14); }
.fin-kids .cmp thead th:first-child { text-align: left; border-radius: var(--r-sm) 0 0 0; }
.fin-kids .cmp thead th:last-child  { border-radius: 0 var(--r-sm) 0 0; }
.fin-kids .cmp tbody th { text-align: left; font-weight: 600; color: var(--navy); font-size: 10.5px; width: 40%; line-height: 1.35; }
.fin-kids .cmp tbody th s { display: block; font-weight: 400; color: var(--ink-soft); font-size: 9px;
                            text-decoration: none; line-height: 1.3; margin-top: 2px; }
.fin-kids .cmp td { text-align: center; font-weight: 600; color: var(--ink); }
.fin-kids .cmp td.same { color: var(--ink-soft); font-weight: 500; }
.fin-kids .cmp td u { display: block; font-weight: 400; color: var(--ink-soft); font-size: 8.5px; text-decoration: none; line-height: 1.3; }
.fin-kids .cmp tr.pick td, .fin-kids .cmp tr.pick th { background: #FFF7F8; }

/* กล่องโรคที่คุ้มครอง — CI 3.4 ต้องผูกกับช่วงอายุเสมอ */
.fin-kids .dz-box { background: var(--soft-navy); border-radius: var(--r-md); padding: 11px 12px; margin-top: 12px; }
.fin-kids .dz-box h4 { margin: 0 0 2px; font-size: 12px; font-weight: 700; color: var(--navy); }
.fin-kids .dz-box .sub { font-size: 10px; color: var(--ink-soft); margin-bottom: 7px; line-height: 1.4; }
.fin-kids .dz-box ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.fin-kids .dz-box li { display: flex; gap: 6px; font-size: 10.5px; line-height: 1.4; align-items: flex-start; }
.fin-kids .dz-box li::before { content: "✓"; color: var(--red); font-weight: 700; flex: none; font-size: 10px; }

.fin-kids .note {
  background: var(--gray); border-radius: var(--r-md); padding: 10px 11px; margin-top: 10px;
  font-size: 10px; color: var(--ink-soft); line-height: 1.5;
}
.fin-kids .note b { color: var(--navy); }

/* ============================== ความคุ้มครองผู้ปกครอง
   วงเงินสองรายการนี้เท่ากันทุกแผน จึงไม่ยัดลงตารางเทียบ แต่แยกเป็นกล่องของตัวเอง
   แถวละ 3 ส่วน: ไอคอนเช็ก · ชื่อความคุ้มครอง · วงเงิน แล้วเงื่อนไขอยู่บรรทัดล่าง
   ที่ไม่เอาเงื่อนไขมาต่อท้ายบรรทัดเดียวกัน เพราะข้อความยาวจะดันตัวเลขจนอ่านไม่ออก */
.fin-kids .gd {
  background: var(--soft-red); border-radius: var(--r-md); padding: 12px 13px 13px; margin-top: 14px;
}
.fin-kids .gd-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fin-kids .gd-h h4 { margin: 0; font-size: 13px; font-weight: 700; color: var(--navy); }
.fin-kids .gd-tag {
  font-size: 9.5px; font-weight: 600; color: var(--red-deep);
  background: var(--white); border-radius: 99px; padding: 3px 9px; white-space: nowrap;
}
.fin-kids .gd-note { margin: 3px 0 0; font-size: 10.5px; color: var(--ink-soft); line-height: 1.4; }

.fin-kids .gd-row {
  background: var(--white); border-radius: var(--r-sm); padding: 10px 11px; margin-top: 8px;
}
.fin-kids .gd-top { display: flex; align-items: flex-start; gap: 8px; }
.fin-kids .gd-ico {
  flex: none; width: 17px; height: 17px; margin-top: 1px; border-radius: 50%;
  background: var(--red); color: var(--white);
  display: grid; place-items: center; font-size: 10px; line-height: 1;
}
.fin-kids .gd-lb {
  flex: 1; min-width: 0; font-size: 11.5px; font-weight: 600; color: var(--navy); line-height: 1.4;
}
.fin-kids .gd-val {
  flex: none; font-size: 16px; font-weight: 700; color: var(--red);
  line-height: 1.2; letter-spacing: -.3px; white-space: nowrap;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
}
.fin-kids .gd-val i {
  font-style: normal; font-size: 9.5px; font-weight: 500; color: var(--ink-soft); margin-left: 3px;
}
.fin-kids .gd-sub {
  margin: 6px 0 0; padding-left: 25px; font-size: 10px; color: var(--ink-soft); line-height: 1.5;
}

/* ============================== ฟอร์มติดต่อ (ขั้นที่ 3) */
.fin-kids .fld { margin-bottom: 13px; }
.fin-kids .fld label { display: flex; justify-content: space-between; align-items: baseline;
                       font-size: 12.5px; font-weight: 600; color: var(--navy); margin-bottom: 5px; }
.fin-kids .fld label em { font-style: normal; font-size: 10.5px; font-weight: 500; color: var(--ink-soft); }
.fin-kids .fld label em.req { color: var(--red); }
.fin-kids .fld input {
  width: 100%; padding: 12px 13px; font: inherit; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--white);
  color: var(--ink); outline: none; transition: border-color .16s, box-shadow .16s;
}
.fin-kids .fld input:focus  { border-color: var(--navy); box-shadow: 0 0 0 3px var(--soft-navy); }
.fin-kids .fld input.bad    { border-color: var(--red); box-shadow: 0 0 0 3px var(--soft-red); }
.fin-kids .fld .err { font-size: 11px; color: var(--red); margin-top: 4px; display: none; }
.fin-kids .fld.is-bad .err { display: block; }

/* ============================== กล่องเชื่อม LINE (ขั้นที่ 4) */
.fin-kids .line-box {
  border: 1.5px dashed #BFE9CE; background: #F3FCF6; border-radius: var(--r-md); padding: 15px;
  transition: border-color .2s, background .2s;
}
.fin-kids .line-box.done { border-style: solid; border-color: var(--line-green); }
.fin-kids .line-box .lb-t { font-size: 13.5px; font-weight: 700; color: var(--navy); margin-bottom: 3px; }
.fin-kids .line-box .lb-s { font-size: 11.5px; color: var(--ink-soft); line-height: 1.5; margin-bottom: 12px; }
.fin-kids .line-box .oa   { font-weight: 700; color: #05963F; }

.fin-kids .line-btn {
  width: 100%; border: 0; border-radius: var(--r-sm); background: var(--line-green); color: var(--white);
  font-size: 15px; font-weight: 600; padding: 13px; display: flex; align-items: center;
  justify-content: center; gap: 8px; transition: filter .16s, transform .12s;
}
.fin-kids .line-btn:hover  { filter: brightness(1.05); }
.fin-kids .line-btn:active { transform: scale(.99); }

.fin-kids .line-ok { display: flex; align-items: center; gap: 11px; }
.fin-kids .line-ok .av {
  width: 42px; height: 42px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--line-green); color: var(--white); display: grid; place-items: center;
  font-size: 17px; font-weight: 700;
}
.fin-kids .line-ok .tx    { min-width: 0; }
.fin-kids .line-ok .tx b  { display: block; font-size: 14px; font-weight: 700; color: #05963F; }
.fin-kids .line-ok .tx s  { display: block; font-size: 11.5px; color: var(--ink-soft); text-decoration: none;
                            margin-top: 2px; line-height: 1.45; }

/* ============================== การ์ดตัวแทนที่ดูแล
   CI ข้อ 10 ห้ามเขียนว่า "ตัวแทน MSIG" จึงระบุเป็นนายหน้าพร้อมเลขใบอนุญาต
   ซึ่งเป็นข้อมูลที่ตรวจสอบได้กับ คปภ. และตรงตามกฎหมายนายหน้าประกันวินาศภัย */
.fin-kids .agent {
  background: var(--soft-navy); border: 1px solid rgba(25, 24, 106, .10);
  border-radius: var(--r-md); padding: 13px 14px; margin-top: 14px;
}
.fin-kids .agent .ag-top { display: flex; align-items: flex-start; gap: 12px; }
.fin-kids .agent .av {
  width: 44px; height: 44px; border-radius: 50%; flex: none; object-fit: cover;
  background: linear-gradient(135deg, #3A38A8, var(--navy));
  color: var(--white); display: grid; place-items: center;
  font-size: 18px; font-weight: 700;
  box-shadow: 0 3px 8px rgba(25, 24, 106, .20);
}
.fin-kids .agent .ag-tx   { min-width: 0; padding-top: 1px; }
.fin-kids .agent .ag-tx b { display: block; font-size: 14px; font-weight: 700; color: var(--navy); line-height: 1.3; }
.fin-kids .agent .ag-tx s { display: block; font-size: 11px; color: var(--ink-soft); text-decoration: none;
                            margin-top: 2px; line-height: 1.4; }
.fin-kids .agent .ag-tx em {
  display: block; font-style: normal; font-size: 10px; color: var(--navy); opacity: .8;
  margin-top: 5px; line-height: 1.4;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
}

.fin-kids .agent .ag-call {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 11px; padding: 11px; border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  color: var(--white); font-size: 14px; font-weight: 600; text-decoration: none;
  box-shadow: 0 3px 10px rgba(229, 30, 42, .26);
  transition: filter .16s, transform .12s;
}
.fin-kids .agent .ag-call:hover  { filter: brightness(1.05); }
.fin-kids .agent .ag-call:active { transform: scale(.99); }
.fin-kids .agent .ag-call svg    { width: 17px; height: 17px; flex: none; }

.fin-kids .agent .ag-note {
  margin-top: 8px; text-align: center; font-size: 10.5px; color: var(--ink-soft); line-height: 1.45;
}

/* ============================== หน้าสรุป: กลุ่มข้อมูลและรายการแผน */
.fin-kids .done-h { text-align: center; margin: 0; font-size: 18px; font-weight: 700; color: var(--navy); }
.fin-kids .done-p { text-align: center; margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); line-height: 1.5; }

.fin-kids .sum-g { margin-top: 16px; }
.fin-kids .sum-gh {
  font-size: 11px; font-weight: 700; color: var(--red); letter-spacing: .3px;
  padding-bottom: 6px; margin-bottom: 4px; border-bottom: 2px solid var(--soft-red);
}

.fin-kids .dp-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--gray); border-radius: var(--r-sm); padding: 9px 11px; margin-top: 7px;
}
.fin-kids .dp-row.tone-navy { color: var(--navy); }
.fin-kids .dp-row.tone-red  { color: var(--red); }
.fin-kids .dp-row.tone-gold { color: #B8862B; }
.fin-kids .dp-row .pshield  { width: 26px; height: 29px; flex: none; }
.fin-kids .dp-row .pshield text { font-family: inherit; }
.fin-kids .dp-nm   { flex: 1; min-width: 0; }
.fin-kids .dp-nm b { display: block; font-size: 12px; font-weight: 700; color: var(--navy); line-height: 1.3; }
.fin-kids .dp-nm s { display: block; font-size: 9.5px; color: var(--ink-soft); text-decoration: none;
                     margin-top: 2px; line-height: 1.35; }
.fin-kids .dp-pr {
  flex: none; font-size: 15px; font-weight: 700; color: var(--red); white-space: nowrap;
  letter-spacing: -.3px; font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
}
.fin-kids .dp-pr i { font-style: normal; font-size: 9px; font-weight: 500; color: var(--ink-soft); margin-left: 3px; }
.fin-kids .dp-note { margin: 7px 0 0; font-size: 9.5px; color: var(--ink-soft); line-height: 1.45; }

/* ============================== ปุ่มหลัก / แถบล่างติดหน้าจอ */
.fin-kids .cta {
  width: 100%; border: 0; border-radius: 13px; padding: 15px;
  font-size: 15.5px; font-weight: 600; color: var(--white);
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  box-shadow: 0 4px 14px rgba(229, 30, 42, .28);
  transition: transform .12s, box-shadow .16s, filter .16s;
}
.fin-kids .cta:hover  { filter: brightness(1.04); }
.fin-kids .cta:active { transform: scale(.99); }
.fin-kids .cta[disabled] {
  background: var(--gray); color: #9CA3AF; box-shadow: none; cursor: not-allowed; filter: none;
}
.fin-kids .cta.ghost {
  background: var(--white); color: var(--navy); border: 1.5px solid var(--line);
  box-shadow: none; font-weight: 600;
}
.fin-kids .cta.ghost:hover { border-color: #C7C6E8; }

.fin-kids .dock {
  position: sticky; bottom: 0; z-index: 25; background: var(--white);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.fin-kids .dock .hint { font-size: 10.5px; color: var(--ink-soft); text-align: center; margin-top: 8px; line-height: 1.45; }

/* ============================== หน้าสรุปใบเสนอราคา */
.fin-kids .done-mark {
  width: 62px; height: 62px; border-radius: 50%; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--red), var(--red-deep)); color: var(--white);
  display: grid; place-items: center; font-size: 30px;
  animation: finkids-pop .45s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes finkids-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.fin-kids .ref {
  text-align: center; background: var(--soft-navy); border-radius: var(--r-md);
  padding: 10px; margin: 14px 0 0;
}
.fin-kids .ref span { display: block; font-size: 10px; color: var(--ink-soft); margin-bottom: 2px; }
.fin-kids .ref b {
  display: block; font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 16px; font-weight: 600; color: var(--navy); letter-spacing: 1px;
}
.fin-kids .sum { width: 100%; border-collapse: collapse; font-size: 12px; }
.fin-kids .sum th { text-align: left; font-weight: 500; color: var(--ink-soft); padding: 7px 0; width: 38%;
                    border-bottom: 1px solid var(--line); vertical-align: top; }
.fin-kids .sum td { text-align: right; font-weight: 600; color: var(--navy); padding: 7px 0;
                    border-bottom: 1px solid var(--line); }
.fin-kids .sum tr:last-child th, .fin-kids .sum tr:last-child td { border-bottom: 0; }
.fin-kids .sum tr.total th { color: var(--navy); font-weight: 700; font-size: 13.5px; border-bottom: 0; padding-top: 13px; }
.fin-kids .sum tr.total td { color: var(--red); font-weight: 700; font-size: 19px; border-bottom: 0; padding-top: 13px;
                             letter-spacing: -.4px; }

/* ============================== แถบข้อมูลมาตรฐาน (CI ข้อ 10) */
.fin-kids .footer {
  background: var(--soft-navy); color: var(--ink-soft);
  border-top: 1px solid rgba(25, 24, 106, .10);
  padding: 15px 18px calc(17px + env(safe-area-inset-bottom));
  font-size: 10px; line-height: 1.6; text-align: center;
}
.fin-kids .footer .f1 { color: var(--navy); font-weight: 700; font-size: 11.5px; margin-bottom: 3px; }
.fin-kids .footer .f2 { color: var(--navy); font-size: 11px; margin-bottom: 8px; }
.fin-kids .footer .f2 b { font-weight: 700; color: #05963F; }
.fin-kids .footer .f3 { color: var(--ink-soft); }

/* ============================== toast */
.fin-kids .toast {
  position: fixed; left: 50%; bottom: 88px; transform: translate(-50%, 14px); z-index: 90;
  background: var(--navy); color: var(--white); font-size: 12.5px; font-weight: 500;
  padding: 10px 17px; border-radius: 99px; box-shadow: var(--shadow-up);
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s; max-width: 88vw; text-align: center;
}
.fin-kids .toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ============================== การเข้าถึง */
.fin-kids [hidden] { display: none !important; }
.fin-kids .age:focus-visible, .fin-kids .plan:focus-visible,
.fin-kids .cta:focus-visible, .fin-kids .line-btn:focus-visible, .fin-kids .sheet .x:focus-visible {
  outline: 3px solid rgba(25, 24, 106, .35); outline-offset: 2px;
}
.fin-kids .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .fin-kids *, .fin-kids *::before, .fin-kids *::after {
    animation-duration: .01ms !important; transition-duration: .01ms !important;
  }
  /* ปิดดาวหางไปเลย ไม่งั้นจะค้างเป็นเส้นแดงกลางทางแบบสุ่ม */
  .fin-kids.has-comet .age::before,
  .fin-kids.has-comet .plan::before { background-image: none; }
}
