/* ============================================================
   ระบบห้องเบาใจลูกเจ้าฟ้า — ธีม "จดหมายสีชมพู"
   Display: Mali (ลายมือไทยโค้งมน)  Body: Sarabun
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+Thai:wght@500;600;700&family=Anuphan:wght@300;400;500;600&family=Sarabun:wght@400;600&display=swap');

:root {
  /* กระดาษและพื้นหลัง */
  --paper:      #FFF9FB;
  --paper-warm: #FDF1F5;
  --blush:      #FBE4EC;
  --blush-deep: #F5C9D8;

  /* สีหลัก */
  --rose:       #E97B96;
  --rose-deep:  #C2506E;
  --rose-soft:  #FBEFF3;
  --mulberry:   #4A2233;
  --ink:        #5C3A48;
  --ink-soft:   #8A6975;

  /* สีสถานะ */
  --mint:       #6FB79A;
  --mint-soft:  #E4F3EC;
  --amber:      #D99441;
  --amber-soft: #FBF0E0;
  --crimson:    #C4485F;
  --crimson-soft:#FBE6EA;
  --lilac:      #A98BC4;
  --lilac-soft: #F1EBF7;

  --radius:     18px;
  --radius-sm:  11px;
  --shadow:     0 4px 20px rgba(194, 80, 110, .09);
  --shadow-lg:  0 12px 40px rgba(194, 80, 110, .16);
  --line:       #F2D9E2;

  --font-display: 'Mali', 'TH Sarabun New', sans-serif;
  --font-body:    'Sarabun', 'TH Sarabun New', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(circle at 12% 8%,  rgba(251,228,236,.85) 0%, transparent 42%),
    radial-gradient(circle at 88% 4%,  rgba(241,235,247,.75) 0%, transparent 38%),
    radial-gradient(circle at 50% 100%,rgba(253,241,245,.9)  0%, transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  color: var(--mulberry);
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 .6em;
  letter-spacing: -.01em;
}
h1 { font-size: 2.05rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

a { color: var(--rose-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- โครงหน้า ---------- */
.wrap      { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }
.wrap-slim { width: min(680px,  100% - 2.5rem); margin-inline: auto; }
.pad       { padding-block: 2.5rem; }
.center    { text-align: center; }
.muted     { color: var(--ink-soft); }
.small     { font-size: .87rem; }
.mt1{margin-top:.6rem}.mt2{margin-top:1.2rem}.mt3{margin-top:2rem}.mb2{margin-bottom:1.2rem}

/* ---------- แถบบน ---------- */
.topbar {
  background: rgba(255,249,251,.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 60;
}
.topbar-in {
  position: relative;
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 0; justify-content: space-between;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.22rem; color: var(--rose-deep); text-decoration: none;
  flex: 0 0 auto;
}
.brand:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-th { font-size: 1.12rem; white-space: nowrap; }
.brand-en {
  font-family: var(--font-body); font-weight: 500; font-size: .68rem;
  color: var(--ink-soft); letter-spacing: .04em; text-transform: uppercase;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 auto;
  background: linear-gradient(140deg, var(--rose) 0%, var(--lilac) 100%);
  display: grid; place-items: center; font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(233,123,150,.35);
}

/* ---------- รายการเมนู ---------- */
.topnav { display: flex; gap: .3rem; flex-wrap: nowrap; align-items: center; min-width: 0; }
.topnav a {
  padding: .42rem .78rem; border-radius: 999px;
  font-size: .92rem; color: var(--ink); font-weight: 500;
  white-space: nowrap;
}
.topnav a:hover { background: var(--blush); text-decoration: none; }
.topnav a.on { background: var(--rose); color: #fff; }

/* ลิงก์เจ้าหน้าที่ — เงียบและแยกออกจากเมนูของนักเรียนอย่างชัดเจน */
.topnav a.staff-link {
  color: var(--ink-soft); font-size: .86rem;
  border: 1px solid var(--line); background: #fff;
  margin-left: .45rem;
}
.topnav a.staff-link:hover { background: var(--rose-soft); color: var(--rose-deep); border-color: var(--blush-deep); }

/* ---------- ปุ่มเปิดเมนูและปุ่มลัด ---------- */
.nav-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.nav-bar-right { display: none; align-items: center; gap: .5rem; flex: 0 0 auto; }
.nav-cta { padding: .45rem 1.05rem; font-size: .92rem; }

.nav-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .42rem .7rem; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--rose-deep);
  font-family: var(--font-display); font-weight: 600; font-size: .88rem;
  user-select: none; transition: background .15s;
}
.nav-btn:hover { background: var(--rose-soft); }
.nav-bars { display: inline-flex; flex-direction: column; gap: 3.5px; width: 17px; }
.nav-bars i {
  display: block; height: 2px; border-radius: 2px; background: var(--rose-deep);
  transition: transform .22s ease, opacity .18s ease;
}
.nav-toggle:focus-visible + .nav-bar-right .nav-btn,
.nav-toggle:focus-visible ~ .nav-bar-right .nav-btn {
  outline: 3px solid var(--rose); outline-offset: 2px;
}
/* เปลี่ยนขีดสามเส้นเป็นกากบาทเมื่อเปิดอยู่ */
.nav-toggle:checked ~ .nav-bar-right .nav-bars i:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-toggle:checked ~ .nav-bar-right .nav-bars i:nth-child(2) { opacity: 0; }
.nav-toggle:checked ~ .nav-bar-right .nav-bars i:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.nav-backdrop { display: none; }
.nav-sos { display: none; }

/* ============================================================
   หน้าจอเล็ก — ยุบเมนูเป็นปุ่มสามขีด
   ปุ่ม "เล่าเรื่อง" ไม่ถูกยุบ เพราะเป็นสิ่งที่ผู้ใช้ตั้งใจเข้ามาทำ
   ============================================================ */
@media (max-width: 1280px) {
  .nav-bar-right { display: flex; }

  .topnav {
    position: absolute; top: calc(100% + .55rem); right: 0;
    width: min(300px, calc(100vw - 2.2rem));
    flex-direction: column; align-items: stretch; gap: .12rem;
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: .55rem; z-index: 70;

    opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.98);
    transform-origin: top right;
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
  }
  .nav-toggle:checked ~ .topnav {
    opacity: 1; visibility: visible; transform: translateY(0) scale(1);
  }

  .topnav { flex-wrap: wrap; }
  .topnav a {
    padding: .68rem .9rem; border-radius: var(--radius-sm);
    font-size: 1rem; white-space: normal;
  }
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand-th { white-space: normal; }
  .topnav a.staff-link { margin-left: 0; margin-top: .1rem; }
  .topnav a.staff-link::after { content: ' — สำหรับครูและบุคลากร'; font-size: .82rem; opacity: .75; }
  .topnav a.nav-sep { margin-top: .35rem; border-top: 1px dashed var(--line); padding-top: .8rem; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

  /* ซ่อนรายการที่ซ้ำกับปุ่มลัดด้านนอก */
  .nav-hide-cta { display: none; }

  /* ฉากหลังจาง กดที่ใดก็ปิดเมนู */
  .nav-backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(74,34,51,.28); z-index: 55;
    opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
  }
  .nav-toggle:checked ~ .nav-backdrop { opacity: 1; visibility: visible; }

  /* เบอร์ฉุกเฉินอยู่ท้ายเมนูเสมอ กดโทรได้ทันที */
  .nav-sos {
    display: block; margin-top: .5rem; padding: .7rem .9rem;
    background: var(--crimson-soft); border-radius: var(--radius-sm);
  }
  .nav-sos > span {
    display: block; font-size: .78rem; color: #93273C; font-weight: 600; margin-bottom: .3rem;
  }
  .nav-sos a {
    display: block; padding: .3rem 0; font-size: .92rem;
    color: var(--crimson); font-weight: 600; font-family: var(--font-display);
  }
  .nav-sos a:hover { background: transparent; text-decoration: underline; }

  .brand-en { display: none; }
  .brand-th { font-size: 1rem; }
}

@media (max-width: 420px) {
  .brand-th { font-size: .92rem; }
  .brand-mark { width: 34px; height: 34px; font-size: 1rem; }
  .nav-btn-label { display: none; }
  .nav-cta { padding: .45rem .8rem; font-size: .86rem; }
}

@media (prefers-reduced-motion: reduce) {
  .topnav, .nav-backdrop, .nav-bars i { transition: none; }
}

/* ---------- ฮีโร่: ซองจดหมาย ---------- */
.hero { padding: 3.2rem 0 2.4rem; text-align: center; }
.hero .eyebrow {
  font-family: var(--font-display); font-size: .92rem; color: var(--rose-deep);
  letter-spacing: .12em; margin-bottom: .8rem;
}
.hero h1 { font-size: clamp(2rem, 5vw, 2.9rem); margin-bottom: .5rem; }
.hero p.lead { font-size: 1.1rem; max-width: 52ch; margin-inline: auto; color: var(--ink); }

.envelope {
  position: relative; width: min(420px, 88%); margin: 2.2rem auto 0;
  aspect-ratio: 8 / 5;
  background: linear-gradient(170deg, #FFFFFF 0%, var(--rose-soft) 100%);
  border: 1px solid var(--blush-deep);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.envelope::before {   /* ฝาซอง */
  content: ''; position: absolute; inset: 0 0 auto 0; height: 62%;
  background: linear-gradient(160deg, var(--blush) 0%, var(--blush-deep) 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-bottom: 1px solid rgba(194,80,110,.12);
}
.envelope .seal {
  position: absolute; left: 50%; top: 54%; transform: translate(-50%,-50%);
  width: 78px; height: 78px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #F09FB4, var(--rose-deep));
  box-shadow: 0 6px 18px rgba(194,80,110,.4), inset 0 -3px 8px rgba(0,0,0,.12);
  display: grid; place-items: center; color: #fff; font-size: 1.9rem;
  animation: pulse 3.4s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { transform: translate(-50%,-50%) scale(1); }
  50%     { transform: translate(-50%,-50%) scale(1.045); }
}
@media (prefers-reduced-motion: reduce) {
  .envelope .seal { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- การ์ด ---------- */
.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.6rem 1.7rem;
  box-shadow: var(--shadow); margin-bottom: 1.2rem;
}
.card.tinted { background: linear-gradient(165deg, #fff 0%, var(--rose-soft) 130%); }
.card h2:first-child, .card h3:first-child { margin-top: 0; }

.card-title {
  font-family: var(--font-display); font-size: 1.1rem; color: var(--mulberry);
  display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem;
  padding-bottom: .7rem; border-bottom: 1px dashed var(--line);
}

.grid  { display: grid; gap: 1.1rem; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid4 { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  padding: .72rem 1.6rem; border-radius: 999px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-deep) 100%);
  color: #fff; box-shadow: 0 5px 16px rgba(233,123,150,.36);
  transition: transform .16s ease, box-shadow .16s ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 9px 22px rgba(233,123,150,.45); text-decoration: none; color:#fff; }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: #fff; color: var(--rose-deep); border: 1.5px solid var(--blush-deep);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--rose-soft); color: var(--rose-deep); }
.btn.lg   { padding: .95rem 2.3rem; font-size: 1.1rem; }
.btn.sm   { padding: .4rem 1rem; font-size: .88rem; }
.btn.wide { width: 100%; }
.btn.mint { background: linear-gradient(135deg, #86C7AC, var(--mint)); box-shadow: 0 5px 16px rgba(111,183,154,.35); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- ฟอร์ม ---------- */
.field { margin-bottom: 1.25rem; }
.field label {
  display: block; font-weight: 600; color: var(--mulberry);
  margin-bottom: .4rem; font-size: .97rem;
}
.field .hint { font-size: .85rem; color: var(--ink-soft); margin-bottom: .5rem; }
.req { color: var(--rose-deep); }

input[type=text], input[type=password], input[type=date], input[type=email],
input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: .72rem .95rem; font-family: var(--font-body); font-size: 1rem;
  color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(233,123,150,.15);
}
textarea { min-height: 160px; resize: vertical; line-height: 1.8; }

/* กระดาษเส้นบรรทัดสำหรับช่องเล่าเรื่อง */
textarea.letter {
  background-image: repeating-linear-gradient(
    to bottom, transparent, transparent 29px, var(--blush) 29px, var(--blush) 30px);
  line-height: 30px; padding-top: .55rem;
}

/* ตัวเลือกแบบการ์ด */
.choices { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); }
.choice {
  position: relative; display: flex; align-items: flex-start; gap: .65rem;
  padding: .85rem 1rem; background: #fff;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; transition: all .15s;
}
.choice:hover { border-color: var(--blush-deep); background: var(--rose-soft); }
.choice input { position: absolute; opacity: 0; }
.choice input:checked ~ .choice-body { color: var(--rose-deep); }
.choice:has(input:checked) {
  border-color: var(--rose); background: var(--rose-soft);
  box-shadow: 0 0 0 3px rgba(233,123,150,.14);
}
.choice .ico { font-size: 1.35rem; line-height: 1.2; }
.choice-body strong { display: block; font-size: .97rem; font-weight: 600; color: var(--mulberry); }
.choice-body span   { font-size: .82rem; color: var(--ink-soft); line-height: 1.5; }

/* ช่องกรอก PIN */
.pin-input {
  letter-spacing: .7em; text-align: center; font-size: 1.5rem;
  font-family: var(--font-display); padding-left: .7em;
}
.code-input { text-transform: uppercase; letter-spacing: .1em; font-family: var(--font-display); font-size: 1.15rem; text-align:center; }

/* ---------- ป้ายสถานะ ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .7rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.b-normal   { background: var(--mint-soft);    color: #3F7A62; }
.b-urgent   { background: var(--amber-soft);   color: #9C6420; }
.b-critical { background: var(--crimson-soft); color: var(--crimson); }
.b-new      { background: var(--lilac-soft);   color: #6B4C8A; }
.b-progress { background: var(--rose-soft);    color: var(--rose-deep); }
.b-closed   { background: #EFEAEC;             color: #7A6B71; }

/* ---------- ตาราง ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background:#fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.tbl th {
  background: var(--rose-soft); color: var(--mulberry); font-weight: 600;
  text-align: left; padding: .8rem 1rem; white-space: nowrap;
  border-bottom: 1px solid var(--line); font-family: var(--font-display); font-size:.92rem;
}
table.tbl td { padding: .8rem 1rem; border-bottom: 1px solid #FAEDF2; vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #FFFAFC; }
.code-cell { font-family: var(--font-display); font-weight: 600; color: var(--rose-deep); white-space: nowrap; }

/* ---------- กล่องข้อความ ---------- */
.alert {
  padding: .95rem 1.15rem; border-radius: var(--radius-sm);
  border-left: 4px solid; margin-bottom: 1.1rem; font-size: .95rem;
}
.alert-ok   { background: var(--mint-soft);   border-color: var(--mint);    color: #35634F; }
.alert-warn { background: var(--amber-soft);  border-color: var(--amber);   color: #8A5715; }
.alert-err  { background: var(--crimson-soft);border-color: var(--crimson); color: #93273C; }
.alert-info { background: var(--lilac-soft);  border-color: var(--lilac);   color: #5A3E77; }

/* กล่องช่วยเหลือฉุกเฉิน */
.sos {
  background: linear-gradient(150deg, #FFF 0%, var(--crimson-soft) 100%);
  border: 1.5px solid #F0BFC9; border-radius: var(--radius);
  padding: 1.25rem 1.4rem; margin: 1.3rem 0;
}
.sos h3 { color: var(--crimson); margin-bottom: .5rem; font-size: 1.05rem; }
.sos ul { margin: .5rem 0 0; padding-left: 1.1rem; }
.sos li { margin-bottom: .35rem; }
.sos strong { color: var(--crimson); font-family: var(--font-display); }

/* ---------- แถบสนทนา ---------- */
.thread { display: flex; flex-direction: column; gap: .9rem; margin: 1.2rem 0; }
.bubble {
  max-width: 78%; padding: .8rem 1.1rem; border-radius: 16px;
  font-size: .96rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}
.bubble .meta { font-size: .76rem; opacity: .72; margin-top: .35rem; }
.bubble.reporter { align-self: flex-end; background: linear-gradient(135deg, var(--rose) 0%, var(--rose-deep) 100%); color: #fff; border-bottom-right-radius: 5px; }
.bubble.staff    { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 5px; }

/* ---------- ไทม์ไลน์ ---------- */
.timeline { position: relative; padding-left: 1.7rem; margin-top: 1rem; }
.timeline::before { content:''; position:absolute; left:6px; top:6px; bottom:6px; width:2px; background: var(--blush-deep); border-radius:2px; }
.tl-item { position: relative; padding-bottom: 1.2rem; }
.tl-item::before {
  content:''; position:absolute; left:-1.7rem; top:7px; width:14px; height:14px;
  border-radius:50%; background:#fff; border:3px solid var(--rose);
}
.tl-item .tl-time { font-size: .82rem; color: var(--ink-soft); }
.tl-item .tl-title { font-weight: 600; color: var(--mulberry); }
.tl-item .tl-note { font-size: .93rem; margin-top: .2rem; white-space: pre-wrap; }

/* ---------- สถิติ ---------- */
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1.3rem; box-shadow: var(--shadow);
}
.stat .n { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; color: var(--rose-deep); line-height: 1.2; }
.stat .l { font-size: .88rem; color: var(--ink-soft); }
.bar { height: 9px; background: var(--blush); border-radius: 999px; overflow: hidden; margin-top: .4rem; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--rose), var(--rose-deep)); border-radius: 999px; }

/* ---------- ขั้นตอน ---------- */
.steps { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); counter-reset: s; }
.step { background:#fff; border:1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; position: relative; }
.step::before {
  counter-increment: s; content: counter(s);
  position: absolute; top: -13px; left: 1.2rem;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--rose); color:#fff; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
  box-shadow: 0 3px 9px rgba(233,123,150,.4);
}
.step h4 { margin: .55rem 0 .3rem; font-size: 1.02rem; }
.step p { margin: 0; font-size: .91rem; color: var(--ink-soft); }

/* ---------- สลิปรหัสเคส ---------- */
.slip {
  background: #fff; border: 2px dashed var(--blush-deep); border-radius: var(--radius);
  padding: 1.8rem 1.6rem; text-align: center; position: relative;
}
.slip .code {
  font-family: var(--font-display); font-size: 2rem; font-weight: 700;
  color: var(--rose-deep); letter-spacing: .06em; margin: .3rem 0 .1rem;
  word-break: break-all;
}
.slip .label { font-size: .87rem; color: var(--ink-soft); }

/* ---------- ท้ายหน้า ---------- */
.foot {
  margin-top: 3rem; padding: 2rem 0 2.4rem;
  border-top: 1px solid var(--line); text-align: center;
  font-size: .88rem; color: var(--ink-soft);
}

/* ---------- ฝั่งเจ้าหน้าที่: แน่นขึ้น เรียบขึ้น ---------- */
body.staff-side { background-image: none; background: #FFFBFC; font-size: 16px; }
body.staff-side .card { padding: 1.3rem 1.4rem; }
.side-head { display:flex; justify-content:space-between; align-items:center; gap:1rem; flex-wrap:wrap; margin-bottom:1.4rem; }
.side-head h1 { font-size: 1.55rem; margin: 0; }
.filters { display:flex; gap:.6rem; flex-wrap:wrap; align-items:flex-end; }
.filters .field { margin: 0; min-width: 150px; }
.filters select, .filters input { padding: .5rem .7rem; font-size: .92rem; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap, .wrap-slim { width: calc(100% - 1.8rem); }
  .card { padding: 1.2rem 1.1rem; }
  .bubble { max-width: 90%; }
}

@media print {
  .topbar, .foot, .btn, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ============================================================
   คลังความรู้ — การ์ดบทความและสไลด์โชว์
   ============================================================ */

.kb-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); text-decoration: none; color: inherit;
  transition: transform .18s ease, box-shadow .18s ease;
}
.kb-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.kb-thumb {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background: linear-gradient(150deg, var(--blush) 0%, var(--lilac-soft) 100%);
  display: grid; place-items: center;
}
.kb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kb-thumb-empty { font-size: 2.4rem; opacity: .55; }
.kb-badge {
  position: absolute; right: .6rem; bottom: .6rem;
  background: rgba(255,255,255,.92); color: var(--rose-deep);
  font-size: .76rem; font-weight: 600; padding: .18rem .6rem; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.kb-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; flex: 1; }
.kb-body h3 { font-size: 1.06rem; margin: .45rem 0 .4rem; line-height: 1.5; }
.kb-body p { font-size: .89rem; color: var(--ink-soft); margin: 0 0 .8rem; line-height: 1.65; }
.kb-topic {
  align-self: flex-start; background: var(--rose-soft); color: var(--rose-deep);
  font-size: .76rem; font-weight: 600; padding: .16rem .65rem; border-radius: 999px;
}
.kb-more { margin-top: auto; font-family: var(--font-display); font-size: .9rem; color: var(--rose-deep); }

/* ---------- สไลด์โชว์ ---------- */
.slideshow {
  position: relative; margin: 1.8rem 0; border-radius: var(--radius);
  overflow: hidden; background: var(--rose-soft);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.slideshow:focus-visible { outline: 3px solid var(--rose); outline-offset: 3px; }
.ss-viewport { overflow: hidden; }
.ss-track { display: flex; transition: transform .42s cubic-bezier(.4,0,.2,1); }
.ss-slide { flex: 0 0 100%; margin: 0; min-width: 0; }
.ss-slide img {
  width: 100%; max-height: 62vh; object-fit: contain; display: block;
  background: #fff;
}
.ss-slide figcaption {
  padding: .7rem 1.1rem; font-size: .89rem; color: var(--ink);
  background: #fff; border-top: 1px solid var(--line); text-align: center; line-height: 1.6;
}
.ss-nav {
  position: absolute; top: 42%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.94); color: var(--rose-deep);
  font-size: 1.7rem; line-height: 1; font-family: var(--font-body);
  box-shadow: 0 3px 12px rgba(194,80,110,.25);
  display: grid; place-items: center; padding-bottom: 4px;
  transition: background .15s, transform .15s;
}
.ss-nav:hover { background: #fff; transform: translateY(-50%) scale(1.08); }
.ss-prev { left: .7rem; }
.ss-next { right: .7rem; }
.ss-dots {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: .7rem;
  display: flex; gap: .38rem; background: rgba(255,255,255,.86);
  padding: .35rem .6rem; border-radius: 999px; backdrop-filter: blur(4px);
}
.ss-dot {
  width: 9px; height: 9px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--blush-deep); padding: 0; transition: all .18s;
}
.ss-dot.on { background: var(--rose-deep); width: 22px; border-radius: 999px; }
.ss-count {
  position: absolute; right: .7rem; top: .7rem;
  background: rgba(255,255,255,.9); color: var(--ink-soft);
  font-size: .78rem; padding: .18rem .6rem; border-radius: 999px;
}
@media (max-width: 640px) {
  .ss-nav { width: 36px; height: 36px; font-size: 1.4rem; }
  .ss-slide img { max-height: 48vh; }
}
@media (prefers-reduced-motion: reduce) { .ss-track { transition: none; } }

/* ---------- เนื้อหาบทความ ---------- */
.article-body {
  font-size: 1.03rem; line-height: 1.95; color: var(--ink);
  margin: 1.6rem 0;
}
.article-body br + br { display: block; content: ''; margin-top: .5rem; }

/* ---------- ตารางเวลาให้คำปรึกษาฝั่งเจ้าหน้าที่ ---------- */
.slot-row {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  flex-wrap: wrap; padding: .85rem 1rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: .6rem; background: #fff;
}
.slot-row.full { background: var(--rose-soft); }
.slot-row.closed { opacity: .6; }
.slot-time { font-family: var(--font-display); font-weight: 600; color: var(--rose-deep); }

/* ============================================================
   PWA — แถบเชิญติดตั้งแอป
   ============================================================ */
.pwa-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 1rem; z-index: 90;
  width: min(560px, calc(100% - 1.6rem));
  display: flex; align-items: center; gap: .85rem;
  background: rgba(255,255,255,.97); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: .8rem .9rem;
  animation: pwaUp .34s cubic-bezier(.2,.8,.3,1);
}
.pwa-bar[hidden] { display: none; }
@keyframes pwaUp { from { opacity: 0; transform: translate(-50%, 18px); }
                   to   { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .pwa-bar { animation: none; } }

.pwa-bar-icon { width: 42px; height: 42px; border-radius: 11px; flex: 0 0 auto; }
.pwa-bar-text { flex: 1; min-width: 0; line-height: 1.4; }
.pwa-bar-text strong { display: block; font-size: .95rem; color: var(--mulberry); }
.pwa-bar-text span   { display: block; font-size: .8rem; color: var(--ink-soft); }
.pwa-bar-act { display: flex; align-items: center; gap: .3rem; flex: 0 0 auto; }
.pwa-bar-close {
  background: transparent; border: 0; cursor: pointer; font-size: 1rem;
  color: var(--ink-soft); padding: .35rem .5rem; border-radius: 8px; line-height: 1;
}
.pwa-bar-close:hover { background: var(--rose-soft); color: var(--rose-deep); }

@media (max-width: 420px) {
  .pwa-bar-text span { display: none; }
}

/* เผื่อพื้นที่ท้ายหน้าไม่ให้แถบบังเนื้อหา และรองรับขอบจอโค้งบน iPhone */
body { padding-bottom: env(safe-area-inset-bottom); }
.foot { padding-bottom: calc(2.4rem + env(safe-area-inset-bottom)); }

/* เมื่อเปิดจากไอคอนแอป (standalone) ให้แถบบนติดขอบจออย่างสวยงาม */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); }
  .pwa-bar { display: none !important; }
}

/* ╔══════════════════════════════════════════════════════════╗
   ║  ห้องเบาใจ v4 — ธีม "Quiet Luxury"                       ║
   ║  หัวเรื่องเซริฟไทย Noto Serif Thai · เนื้อหา Anuphan      ║
   ║  สีหลักเปลี่ยนตามโรงเรียนผ่าน --brand                   ║
   ╚══════════════════════════════════════════════════════════╝ */

:root {
  --brand:       #B4536E;
  --brand-deep:  #7E2F4A;
  --brand-soft:  #F8ECF0;
  --brand-softer:#FCF6F8;
  --gold:        #B8935A;
  --ivory:       #FBF7F4;
  --ink-strong:  #241920;

  /* ผูกตัวแปรเดิมเข้ากับแบรนด์ หน้าเดิมทั้งหมดเปลี่ยนตามโดยอัตโนมัติ */
  --rose:       var(--brand);
  --rose-deep:  var(--brand-deep);
  --rose-soft:  var(--brand-soft);
  --mulberry:   var(--ink-strong);
  --ink:        #3D2B33;
  --ink-soft:   #7B6870;
  --paper:      var(--ivory);
  --paper-warm: #F6EFEB;
  --blush:      #F3E5EA;
  --blush-deep: #E6CCD6;
  --line:       #ECE2E5;

  --radius:    20px;
  --radius-sm: 13px;
  --shadow:    0 1px 2px rgba(36,25,32,.04), 0 6px 24px -8px rgba(36,25,32,.08);
  --shadow-lg: 0 2px 6px rgba(36,25,32,.05), 0 24px 60px -18px rgba(126,47,74,.22);

  --font-display: 'Noto Serif Thai', 'Sarabun', serif;
  --font-body:    'Anuphan', 'Sarabun', system-ui, sans-serif;
}
@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    --brand-deep:   color-mix(in srgb, var(--brand) 70%, #1a0610);
    --brand-soft:   color-mix(in srgb, var(--brand) 9%, #fff);
    --brand-softer: color-mix(in srgb, var(--brand) 4%, #fff);
    --blush:        color-mix(in srgb, var(--brand) 13%, #fff);
    --blush-deep:   color-mix(in srgb, var(--brand) 26%, #fff);
  }
}

body {
  font-family: var(--font-body); font-weight: 400; font-size: 16.5px;
  color: var(--ink); background: var(--ivory);
  background-image:
    radial-gradient(1100px 520px at 88% -8%, var(--brand-soft) 0%, transparent 60%),
    radial-gradient(900px 480px at -6% 18%, #F4EEF7 0%, transparent 55%);
  background-attachment: fixed;
  letter-spacing: .002em;
}
h1, h2, h3, h4, .display { font-family: var(--font-display); color: var(--ink-strong); font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: clamp(1.75rem, 3.4vw, 2.3rem); line-height: 1.35; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.12rem; font-family: var(--font-body); font-weight: 600; }
a { color: var(--brand-deep); }
::selection { background: var(--blush-deep); color: var(--ink-strong); }

.display-xl { font-size: clamp(2.2rem, 5.2vw, 3.6rem); line-height: 1.22; margin-bottom: .6rem; }
.display-xl em { font-style: normal; color: var(--brand); position: relative; }
.display-xl em::after { content:''; position:absolute; left:0; right:0; bottom:.08em; height:.22em; background: var(--blush); z-index:-1; border-radius:4px; }
.display-md { font-size: clamp(1.6rem, 3.2vw, 2.2rem); line-height: 1.3; }
.eyebrow {
  font-family: var(--font-body); font-weight: 600; font-size: .78rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--brand); margin-bottom: .9rem;
}
.lead { font-size: 1.12rem; line-height: 1.85; color: var(--ink); }
.tiny { font-size: .76rem; }

/* ---------- แถบบน ---------- */
.topbar { background: rgba(251,247,244,.82); border-bottom-color: rgba(236,226,229,.8); }
.brand { font-family: var(--font-display); color: var(--ink-strong); }
.brand-th { font-weight: 600; }
.brand-en { font-family: var(--font-body); letter-spacing: .02em; text-transform: none; font-size: .72rem; }
.brand-mark {
  background: linear-gradient(145deg, var(--brand) 0%, var(--brand-deep) 100%);
  box-shadow: 0 6px 16px -6px var(--brand), inset 0 1px 0 rgba(255,255,255,.25);
  border-radius: 12px;
}
.brand-mark.sm { width: 28px; height: 28px; font-size: .85rem; border-radius: 9px; display:inline-grid; place-items:center; }
.topnav a { font-weight: 500; color: var(--ink); }
.topnav a:hover { background: var(--brand-soft); }
.topnav a.on { background: var(--ink-strong); color: #fff; }

/* ---------- ปุ่ม ---------- */
.btn {
  font-family: var(--font-body); font-weight: 600; letter-spacing: .01em;
  background: var(--brand-deep); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 8px 20px -10px var(--brand-deep);
}
.btn:hover { background: var(--ink-strong); box-shadow: 0 10px 26px -12px var(--ink-strong); }
.btn.ghost { background: rgba(255,255,255,.7); color: var(--ink-strong); border: 1px solid var(--line); backdrop-filter: blur(6px); }
.btn.ghost:hover { background: #fff; border-color: var(--blush-deep); color: var(--brand-deep); }
.btn.mint { background: #3F7F66; box-shadow: 0 8px 20px -10px #3F7F66; }
.btn.mint:hover { background: #2F604D; }

/* ---------- การ์ด ---------- */
.card { border-color: var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.card.tinted { background: linear-gradient(170deg, #fff 0%, var(--brand-softer) 100%); }
.card.glass { background: rgba(255,255,255,.78); backdrop-filter: blur(14px); box-shadow: var(--shadow-lg); }
.card-title { font-family: var(--font-body); font-weight: 600; font-size: 1.02rem; color: var(--ink-strong); border-bottom: 1px solid var(--line); }
.stat { border-radius: var(--radius); }
.stat .n { font-family: var(--font-display); color: var(--ink-strong); font-weight: 600; }
.step-no { display:inline-grid; place-items:center; width:26px; height:26px; border-radius:50%;
  background: var(--ink-strong); color:#fff; font-size:.82rem; font-weight:600; }

/* ---------- ฟอร์ม ---------- */
input[type=text], input[type=password], input[type=date], input[type=email],
input[type=tel], input[type=number], input[type=time], select, textarea {
  border: 1px solid var(--line); background: #fff; border-radius: 12px; font-family: var(--font-body);
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.choice { border: 1px solid var(--line); border-radius: 14px; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-softer); box-shadow: 0 0 0 3px var(--brand-soft); }
.code-input { font-family: var(--font-body); font-weight: 600; letter-spacing: .14em; }
.code-xl { font-size: 1.5rem; padding: .9rem 1rem; }
.pin-input { font-family: var(--font-body); }

/* ---------- ป้าย/ตาราง ---------- */
table.tbl th { background: var(--brand-softer); font-family: var(--font-body); font-weight: 600; color: var(--ink-strong); }
.code-cell { font-family: var(--font-body); color: var(--brand-deep); letter-spacing: .03em; }
.slip { border: 1.5px dashed var(--blush-deep); background: linear-gradient(180deg,#fff,var(--brand-softer)); }
.slip .code { font-family: var(--font-body); font-weight: 600; color: var(--ink-strong); letter-spacing: .1em; }

/* ---------- ฮีโร่โรงเรียน ---------- */
.hero { padding: 4.2rem 0 3rem; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); line-height: 1.25; }
.envelope { border-radius: 24px; box-shadow: var(--shadow-lg); border-color: var(--line); }
.envelope::before { background: linear-gradient(160deg, var(--blush) 0%, var(--blush-deep) 100%); }
.envelope .seal { background: radial-gradient(circle at 35% 30%, var(--brand), var(--brand-deep)); }
.step::before { background: var(--ink-strong); box-shadow: none; }

/* ---------- พอร์ทัล ---------- */
.portal-hero { padding: 3.6rem 0 1.6rem; }
.lux-hero { padding: 4rem 0 3rem; overflow: hidden; }
.lux-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; }
.lux-copy .lead { max-width: 34em; }
.code-bar {
  display: flex; gap: .5rem; margin-top: 1.8rem; max-width: 470px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .4rem;
  box-shadow: var(--shadow-lg);
}
.code-bar input {
  border: 0 !important; box-shadow: none !important; background: transparent; flex: 1; min-width: 0;
  font-weight: 600; letter-spacing: .14em; font-size: 1.05rem; padding: .6rem 1rem;
}
.code-bar .btn { white-space: nowrap; }
.lux-art { position: relative; min-height: 380px; }
.orb { position: absolute; border-radius: 50%; filter: blur(2px); }
.orb-a { width: 320px; height: 320px; right: 2%; top: 4%;
  background: radial-gradient(circle at 30% 30%, var(--blush) 0%, var(--brand-soft) 55%, transparent 72%); }
.orb-b { width: 180px; height: 180px; left: 4%; bottom: 0;
  background: radial-gradient(circle at 40% 40%, #EFE6F5 0%, transparent 70%); }
.lux-env { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%) rotate(-4deg); width: min(330px, 80%); margin: 0; }
.float-card {
  position: absolute; display: flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.9); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 14px; padding: .55rem .9rem;
  font-size: .86rem; font-weight: 500; color: var(--ink-strong); box-shadow: var(--shadow);
  animation: floaty 6s ease-in-out infinite;
}
.fc-1 { left: 0; top: 14%; } .fc-2 { right: 0; top: 46%; animation-delay: -2s; } .fc-3 { left: 10%; bottom: 6%; animation-delay: -4s; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .float-card { animation: none; } }

.section-head { text-align: center; margin-bottom: 2.2rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.1rem; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.feature h3 { margin: .8rem 0 .4rem; }
.feature p { margin: 0; color: var(--ink-soft); font-size: .94rem; line-height: 1.75; }
.f-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; background: var(--brand-soft); }

.lux-band {
  display: grid; grid-template-columns: 1.4fr .6fr; gap: 2rem; align-items: center;
  background: linear-gradient(135deg, var(--ink-strong) 0%, var(--brand-deep) 130%);
  border-radius: 28px; padding: 2.6rem 2.8rem; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.lux-band::after { content:''; position:absolute; right:-80px; top:-80px; width:260px; height:260px; border-radius:50%;
  background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%); }
.light { color: #fff !important; } .eyebrow.light { color: var(--blush-deep) !important; }
.light-soft { color: rgba(255,255,255,.75); }
.band-cta { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; }
.light-btn { background: #fff; color: var(--ink-strong); }
.light-btn:hover { background: var(--blush); color: var(--ink-strong); }

.divider-text { display: flex; align-items: center; gap: 1rem; margin: 1.6rem 0 1rem; color: var(--ink-soft); font-size: .88rem; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.search-row { display: flex; gap: .5rem; }
.search-row input { flex: 1; }
.school-list { display: grid; gap: .5rem; margin-top: 1rem; }
.school-item {
  display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; color: inherit; text-decoration: none; transition: .15s;
}
.school-item:hover { border-color: var(--blush-deep); box-shadow: var(--shadow); text-decoration: none; transform: translateY(-1px); }
.school-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-deep);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; flex: 0 0 auto; }
.school-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.school-meta strong { color: var(--ink-strong); }
.school-meta span { font-size: .84rem; color: var(--ink-soft); }
.school-go { color: var(--brand); font-weight: 600; }

/* ---------- การ์ดรหัสโรงเรียนในหน้าตั้งค่า ---------- */
.school-card { background: linear-gradient(140deg, #fff 0%, var(--brand-softer) 100%); }
.school-card-main { display: grid; grid-template-columns: 1fr auto; gap: 1.6rem; align-items: center; }
.school-code { font-family: var(--font-body); font-weight: 600; font-size: 2.1rem; letter-spacing: .14em; color: var(--ink-strong); line-height: 1.2; }
.copy-row { display: flex; gap: .5rem; } .copy-row input { flex: 1; font-size: .88rem; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.qr-box #qr { background: #fff; padding: 10px; border-radius: 14px; border: 1px solid var(--line); line-height: 0; }
.seg { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.seg a { padding: .45rem .95rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: .9rem; }
.seg a.on { background: var(--ink-strong); color: #fff; border-color: var(--ink-strong); }
.seg a span { opacity: .6; margin-left: .2rem; }

/* ---------- เอกสาร ---------- */
.prose h2 { font-size: 1.25rem; margin-top: 2rem; }
.prose p, .prose li { line-height: 1.9; }
.prose ul { padding-left: 1.2rem; }

/* ---------- ท้ายหน้า ---------- */
.foot { border-top-color: var(--line); }
.foot-brand { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--font-display); color: var(--ink-strong); }
.foot-school { margin: .5rem 0 0; color: var(--ink); }

/* ---------- ฝั่งเจ้าหน้าที่: แถบเมนูด้านข้างบนจอกว้าง ---------- */
body.staff-side { background: #FAF8F7; background-image: none; }
body.staff-side h2, body.staff-side h3 { font-family: var(--font-body); }
@media (min-width: 1281px) {
  /* backdrop-filter ทำให้ position:fixed ของลูกอ้างอิงกับแถบบนแทนหน้าจอ จึงต้องปิด */
  body.staff-side .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: #fff; }
  body.staff-side .topbar .wrap { width: calc(100% - 2.5rem); max-width: none; }
  /* เลือกเฉพาะเมนูหลัก ไม่ให้แท็บย่อยในหน้าตั้งค่าถูกดึงไปด้วย */
  body.staff-side #mainNav {
    position: fixed; top: 66px; left: 0; bottom: 0; width: 236px; z-index: 40;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: .15rem;
    padding: 1.2rem .8rem; background: #fff; border-right: 1px solid var(--line); overflow-y: auto;
  }
  body.staff-side #mainNav a { border-radius: 11px; padding: .62rem .9rem; white-space: nowrap; }
  body.staff-side #mainNav a.on { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
  body.staff-side #mainNav a.nav-sep { margin-top: auto; border-top: 1px solid var(--line); border-radius: 0; padding-top: .9rem; }
  body.staff-side main, body.staff-side .foot { margin-left: 236px; }
}
/* แท็บย่อยในหน้าตั้งค่า (คลาส topnav ภายในเนื้อหา) แสดงเป็นแถบแนวนอนเสมอ */
.side-head .topnav { position: static !important; flex-direction: row !important; opacity: 1 !important;
  visibility: visible !important; transform: none !important; width: auto !important; box-shadow: none !important;
  border: 0 !important; padding: 0 !important; background: transparent !important; flex-wrap: wrap; }
.side-head .topnav a { background: #fff; border: 1px solid var(--line); }
.side-head .topnav a.on { background: var(--ink-strong); color: #fff; border-color: var(--ink-strong); }

/* ---------- หน้าจอเล็ก ---------- */
@media (max-width: 900px) {
  .lux-grid { grid-template-columns: 1fr; gap: 1rem; }
  .lux-art { min-height: 300px; order: -1; }
  .lux-band { grid-template-columns: 1fr; padding: 2rem 1.6rem; }
  .school-card-main { grid-template-columns: 1fr; }
  .qr-box { align-items: flex-start; }
}
@media (max-width: 520px) {
  .code-bar { flex-direction: column; border-radius: 20px; }
  .code-bar .btn { width: 100%; }
  .lux-art { min-height: 250px; }
  .float-card { font-size: .76rem; padding: .4rem .7rem; }
  .search-row { flex-direction: column; }
}

/* ---------- ฟอร์มฐานข้อมูลที่สร้างเองใน Plesk ---------- */
.manual-db { background: var(--brand-softer); border: 1px dashed var(--blush-deep); border-radius: 14px; padding: .8rem 1rem; }
.manual-db summary { cursor: pointer; font-weight: 600; color: var(--ink-strong); }
.manual-db[open] summary { margin-bottom: .2rem; }
