/* ระบบชั้น 9 · สีลาเวนเดอร์ ข1 · หัวข้อ Mali · เนื้อหา Sarabun
   ขนาดทั้งหมดเป็น rem → ปุ่ม "ก+" ขยายทั้งหน้าได้ */
:root {
  --bg: #F7F4FE; --head: #E9E1FB; --line: #DDD3F5; --line2: #E6DEF7;
  --ink: #1F1A2E; --ink2: #3F3852; --muted: #5B5470;
  --primary: #7448C8; --primary-ink: #FFFFFF; --focus: #AE96EE; --focus-glow: #EFE9FB;
  --nav-on: #5B34A8; --nav-on-bg: #EDE6FB;
  --vgan: #15803D; --ok: #15803D; --ok-bg: #DCFCE7; --ok-ink: #14532D;
  --bad: #B42318; --bad-bg: #FEE4E2; --bad-ink: #912018;
  --warn-bg: #FFF4D6; --warn-ink: #5C4300; --star: #B45309;
  --card: #FFFFFF;
  --wA: #DBEEFC; --wA-ink: #0B4A75; --wA-bar: #5AB0E8;
  --wB: #DCFCE7; --wB-ink: #14532D; --wB-bar: #3FA35F;
  --wC: #FFE6CC; --wC-ink: #7C2D12; --wC-bar: #F28C28;
  --wD: #1E40AF; --wD-ink: #FFFFFF; --wD-bar: #1E40AF;
  --line-green: #06C755;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { font-size: 106.25%; -webkit-text-size-adjust: 100%; }
html.fs1 { font-size: 118%; }
html.fs2 { font-size: 131%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Sarabun', system-ui, sans-serif; font-size: 1rem; line-height: 1.5; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--nav-on); }
.mali { font-family: 'Mali', 'Sarabun', sans-serif; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.bad { color: var(--bad); }
.hide { display: none !important; }
.star { color: var(--star); }
.batch { font-size: .78em; font-weight: 600; color: var(--muted); font-family: 'Sarabun', sans-serif; }
.batch.star { color: var(--star); }

/* ---------- โครงหน้า ---------- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.side, .topnav { display: none; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.bottomnav {
  position: sticky; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 2px;
  padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line2);
}
.navbtn {
  min-height: 60px; border: none; border-radius: 14px; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .82rem; font-weight: 500; text-decoration: none;
}
.navbtn svg { width: 24px; height: 24px; }
.navbtn.on { background: var(--nav-on-bg); color: var(--nav-on); font-weight: 700; }

.head {
  background: var(--head); padding: 18px 18px 16px; border-radius: 0 0 28px 28px; display: flex; flex-direction: column; gap: 12px;
}
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.head h1 { margin: 0; font-family: 'Mali', sans-serif; font-size: 1.45rem; font-weight: 700; line-height: 1.25; }
.head .sub { font-size: .9rem; color: var(--warn-ink); }
.head .sub2 { font-size: .9rem; color: var(--ink2); }
.fsbtn { width: 48px; height: 48px; flex-shrink: 0; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-size: 1.1rem; font-weight: 700; }
.back { align-self: flex-start; min-height: 44px; padding: 0 12px 0 6px; border: none; background: transparent; color: var(--nav-on); font-size: 1rem; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.body { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.foot { position: sticky; bottom: 0; z-index: 15; padding: 10px 16px 8px; background: var(--bg); border-top: 1px solid var(--line2); display: flex; flex-direction: column; gap: 4px; }
.foot .note { text-align: center; font-size: .85rem; color: var(--muted); }
.shell.has-bottomnav .foot { bottom: calc(76px + env(safe-area-inset-bottom)); }

.card { background: var(--card); border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.focus { border: 3px solid var(--focus); box-shadow: 0 0 0 6px var(--focus-glow); }
.card h2, .h2 { margin: 0; font-family: 'Mali', sans-serif; font-size: 1.2rem; font-weight: 700; line-height: 1.3; }
.sec { font-size: .9rem; font-weight: 700; color: var(--muted); margin-top: 4px; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 12px; font-size: .82rem; font-weight: 700; background: var(--focus); color: #2A1658; white-space: nowrap; }
.pill.gray { background: #EEEAF5; color: var(--ink2); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.wing { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 10px; font-weight: 700; font-size: .9rem; white-space: nowrap; }
.wing.A { background: var(--wA); color: var(--wA-ink); } .wing.B { background: var(--wB); color: var(--wB-ink); }
.wing.C { background: var(--wC); color: var(--wC-ink); } .wing.D { background: var(--wD); color: var(--wD-ink); }
.chip-room { align-self: flex-start; border-radius: 999px; padding: 4px 12px; font-size: .9rem; font-weight: 600; }

.btn { min-height: 52px; padding: 0 18px; border-radius: 16px; border: 2px solid var(--primary); background: #fff; color: var(--nav-on); font-weight: 700; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; text-align: center; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-family: 'Mali', sans-serif; font-size: 1.1rem; min-height: 58px; border-radius: 18px; }
.btn.block { width: 100%; }
.btn.ghost { border-color: var(--line); color: var(--ink2); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: .5; }
.btn.sm { min-height: 44px; padding: 0 14px; border-radius: 12px; font-size: .9rem; }
.btn.line { background: var(--line-green); border-color: var(--line-green); color: #fff; font-family: 'Mali', sans-serif; font-size: 1.15rem; min-height: 60px; }
.linkbtn { border: none; background: none; color: var(--nav-on); font-weight: 700; text-decoration: underline; padding: 8px 4px; min-height: 44px; }

/* ---------- ตัวเลือก ---------- */
.opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.opts.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt { min-height: 52px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.opt.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.opt.on.vg { background: var(--vgan); border-color: var(--vgan); }
.opt-label { font-size: .9rem; font-weight: 600; color: var(--ink2); }
.decline { min-height: 48px; border-radius: 14px; border: 2px dashed #C4B8E6; background: #fff; color: var(--ink2); font-size: 1rem; font-weight: 600; }
.decline.on { border-style: solid; border-color: var(--ink2); background: #EEEAF5; color: var(--ink); font-weight: 700; }
.catgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.cat { min-height: 48px; border-radius: 12px; padding: 6px 10px; font-size: .92rem; font-weight: 600; text-align: left; line-height: 1.25; border: 2px solid var(--line); background: #fff; }
.cat.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.cat.sug { border: 2px dashed var(--primary); background: var(--nav-on-bg); }

/* ---------- แถวรูปคนในห้อง ---------- */
.ppl-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 2px; scrollbar-width: none; }
.ppl-row::-webkit-scrollbar { display: none; }
.av-btn { text-decoration: none; color: inherit; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; border: none; background: transparent; padding: 0; min-width: 58px; }
.av { position: relative; width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: 'Mali', sans-serif; font-weight: 700; font-size: 1.1rem; background: #fff; color: var(--ink); }
.av .dot { position: absolute; right: -2px; bottom: -2px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--head); }
.dot.ok { background: #16A34A; } .dot.miss { background: #F59E0B; } .dot.na { background: #B9B2CC; }
.av-btn.sel .av { background: var(--primary); color: #fff; box-shadow: 0 0 0 3px var(--head), 0 0 0 6px var(--primary); }
.av-btn .nm { font-size: .82rem; font-weight: 500; white-space: nowrap; }
.av-btn.sel .nm { font-weight: 700; }
.av-btn.me .nm { text-decoration: underline; text-underline-offset: 3px; }
.roomsel { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--ink2); }
.roomsel select { min-height: 40px; border-radius: 10px; border: 2px solid var(--line); background: #fff; padding: 0 8px; font-weight: 700; }

.plist { display: none; }

/* ---------- วงแหวน ---------- */
.ring { --p: 0; width: 64px; height: 64px; flex-shrink: 0; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--p) * 1turn), #fff 0); display: flex; align-items: center; justify-content: center; }
.ring > span { width: 50px; height: 50px; border-radius: 50%; background: var(--head); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .95rem; }
.ring.big { width: 76px; height: 76px; background: conic-gradient(var(--primary) calc(var(--p) * 1turn), #EEEAF5 0); }
.ring.big > span { width: 60px; height: 60px; background: #fff; }

/* ---------- การ์ดงาน (หน้าแรก) ---------- */
.task { min-height: 88px; border-radius: 22px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; text-align: left; background: #fff; border: 2px solid transparent; text-decoration: none; color: inherit; }
.task.focus { border: 3px solid var(--focus); box-shadow: 0 0 0 6px var(--focus-glow); }
.task.muted { opacity: .78; }
.task .ic { width: 52px; height: 52px; flex-shrink: 0; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--head); color: var(--primary); }
.task .ic svg { width: 28px; height: 28px; }
.task .tt { font-family: 'Mali', sans-serif; font-size: 1.1rem; font-weight: 700; }
.task .st { font-size: .9rem; font-weight: 600; }
.task .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chev { width: 22px; height: 22px; color: var(--muted); flex-shrink: 0; }

/* ---------- แถวที่บันทึกแล้ว (จางลง) ---------- */
.done-row { background: #fff; border-radius: 18px; padding: 10px 14px; min-height: 60px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border: none; width: 100%; text-align: left; }
.done-row.faded { opacity: .78; }
.done-row .l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tick { width: 32px; height: 32px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tick.na { background: #EEEAF5; color: var(--muted); }
.tick.lock { background: #EEEAF5; color: var(--muted); }
.done-row .d { font-family: 'Mali', sans-serif; font-size: 1.02rem; font-weight: 700; }
.done-row .r { font-size: .9rem; color: var(--ink2); text-align: right; }
.saved { font-size: .85rem; color: var(--ok); font-weight: 600; }
.by { font-size: .85rem; color: var(--muted); }
.hint { border-radius: 14px; padding: 10px 12px; font-size: .9rem; background: var(--warn-bg); color: var(--warn-ink); display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.hint.info { background: var(--nav-on-bg); color: #3B2470; }
.hint.ok { background: var(--ok-bg); color: var(--ok-ink); }
.month-h { font-family: 'Mali', sans-serif; font-weight: 700; font-size: 1.05rem; margin: 6px 4px 0; color: var(--ink2); }

/* ---------- แถบบันทึก ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; top: 10px; z-index: 60; display: flex; justify-content: center; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; max-width: 560px; width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 16px; background: #ECFDF3; border: 1px solid #A6E9C1; color: var(--ok-ink); box-shadow: 0 6px 18px rgba(31,26,46,.14); font-size: .95rem; font-weight: 600; transition: opacity .3s; }
.toast.err { background: #FEF3F2; border-color: #FECDCA; color: var(--bad-ink); }
.toast.warn { background: var(--warn-bg); border-color: #F5D98B; color: var(--warn-ink); }
.toast .msg { flex: 1; }
.toast button { min-height: 40px; padding: 0 12px; border-radius: 10px; border: none; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 70; background: rgba(31,26,46,.45); display: flex; align-items: flex-end; justify-content: center; padding: 12px; }
.modal { width: 100%; max-width: 460px; background: #fff; border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 14px; margin-bottom: env(safe-area-inset-bottom); }
.modal h3 { margin: 0; font-family: 'Mali', sans-serif; font-size: 1.25rem; }
.modal .row { display: flex; gap: 10px; }
.modal .row > * { flex: 1; }

/* ---------- เลือกห้อง / ชื่อ ---------- */
.step { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.step .no { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .95rem; }
.wingrow { display: flex; align-items: center; gap: 8px; }
.wingrow .wing { width: 58px; justify-content: center; height: 36px; flex-shrink: 0; padding: 0; }
.rooms5 { flex: 1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.roombtn { min-height: 48px; border-radius: 12px; font-size: .88rem; font-weight: 700; border: 2px solid var(--line); background: #fff; padding: 0; }
.roombtn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.namebtn { min-height: 58px; border-radius: 16px; padding: 6px 12px; text-align: left; display: flex; flex-direction: column; justify-content: center; border: 2px solid var(--line); background: #fff; }
.namebtn .n { font-size: 1.02rem; font-weight: 700; }
.namebtn .s { font-size: .8rem; color: var(--muted); }
.namebtn.on { background: var(--nav-on-bg); border: 3px solid var(--primary); }
.namebtn:disabled { opacity: .45; }
.sel3 { width: 100%; height: 58px; border-radius: 16px; border: 2px solid var(--line); background: #fff; padding: 0 14px; font-size: 1.15rem; font-weight: 700; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%235B5470' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
label.f { font-size: 1rem; font-weight: 700; color: var(--ink2); display: block; margin-bottom: 6px; }
.input { width: 100%; min-height: 52px; border-radius: 14px; border: 2px solid var(--line); background: #fff; padding: 0 14px; font-size: 1.05rem; }

/* ---------- ภาพรวม ---------- */
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 16px; background: #fff; }
.seg button { min-height: 48px; border-radius: 12px; border: none; background: transparent; font-weight: 600; color: var(--ink2); font-size: 1rem; }
.seg button.on { background: var(--nav-on); color: #fff; font-weight: 700; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; min-height: 44px; padding: 0 14px; border-radius: 12px; font-size: .92rem; font-weight: 700; border: 2px solid var(--line); background: #fff; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.f { border-radius: 999px; min-height: 40px; font-size: .85rem; }
.chip.f.on { background: var(--nav-on-bg); color: var(--nav-on); border-color: var(--primary); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { border-radius: 16px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.stat .k { font-size: .82rem; font-weight: 700; }
.stat .v { font-family: 'Mali', sans-serif; font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.stat .u { font-size: .78rem; }
.s-purple { background: var(--nav-on-bg); color: #3B2470; } .s-green { background: var(--ok-bg); color: var(--ok-ink); }
.s-gray { background: #EEEAF5; color: var(--ink2); } .s-red { background: var(--bad-bg); color: var(--bad-ink); } .s-yellow { background: var(--warn-bg); color: var(--warn-ink); }
.wcard { background: #fff; border-radius: 20px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; border: 2px solid transparent; }
.wcard.open { border: 3px solid var(--focus); }
.whead { display: flex; align-items: center; gap: 10px; border: none; background: none; padding: 0; text-align: left; width: 100%; min-height: 48px; }
.whead .grow { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bar { display: block; height: 10px; border-radius: 5px; background: #EEEAF5; overflow: hidden; }
.bar > span { display: block; height: 10px; border-radius: 5px; }
.rhead { display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: 0 10px; border-radius: 12px; border: 2px solid var(--line2); background: #fff; font-weight: 700; width: 100%; text-align: left; }
.rhead.open { border-color: var(--focus); background: var(--focus-glow); }
.prow { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 10px; border-radius: 12px; background: var(--bg); }
.prow.miss { background: #FFF8F7; }
.prow .cb { width: 8px; align-self: stretch; border-radius: 4px; flex-shrink: 0; }
.prow .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.prow .nm { font-size: .95rem; font-weight: 700; }
.prow .tx { font-size: .88rem; color: var(--ink2); }
.prow.miss .tx { color: var(--bad); font-weight: 600; }
.sends { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; background: #fff; border-radius: 22px; padding: 14px; border: 2px dashed #C4B8E6; }
.sends .btn { min-height: 52px; font-size: .92rem; }
.dash { border: 2px dashed #C4B8E6; }
.wings-grid { display: flex; flex-direction: column; gap: 12px; }
.ovgroups { display: flex; flex-direction: column; gap: 14px; }

/* ---------- แอดมิน ---------- */
.atabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.atabs::-webkit-scrollbar { display: none; }
.atabs a, .atabs span { flex-shrink: 0; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 12px; font-weight: 700; font-size: .92rem; text-decoration: none; background: #fff; color: var(--ink2); border: 2px solid var(--line); }
.atabs a.on { background: var(--nav-on-bg); color: var(--nav-on); border-color: var(--primary); }
.atabs span { opacity: .6; font-weight: 500; }
.atabs span i { font-style: normal; font-size: .75rem; background: #EEEAF5; border-radius: 999px; padding: 1px 8px; }
.alert { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border-radius: 14px; background: var(--bg); }
.alert .dot { position: static; width: 12px; height: 12px; border: none; flex-shrink: 0; border-radius: 50%; }
.alert .grow { flex: 1; }
.kv { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; min-height: 48px; border-bottom: 1px solid var(--line2); padding: 6px 0; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); font-size: .9rem; }
.kv .v { font-weight: 700; }
.hist { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line2); }
.hist:last-child { border-bottom: none; }
.plink { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 12px; border-radius: 14px; background: #fff; text-decoration: none; color: inherit; }
.plink .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.center-msg { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 32px 20px; text-align: center; }
.bigicon { width: 96px; height: 96px; border-radius: 50%; background: var(--head); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.bigicon svg { width: 52px; height: 52px; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--primary); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err-box { background: #FEF3F2; border: 1px solid #FECDCA; color: var(--bad-ink); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }

/* =====================================================================
   iPad (768–1199): เมนูบน + รายชื่อห้องด้านซ้าย
   ===================================================================== */
@media (min-width: 768px) {
  .bottomnav { display: none; }
  .shell.has-bottomnav .foot { bottom: 0; }
  .topnav { display: flex; position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line2); padding: 8px 16px; gap: 6px; align-items: center; }
  .topnav .logo { font-family: 'Mali', sans-serif; font-size: 1.35rem; font-weight: 700; color: var(--primary); margin-right: 10px; }
  .topnav .navbtn { flex-direction: row; min-height: 48px; padding: 0 14px; font-size: .95rem; gap: 8px; }
  .topnav .navbtn svg { width: 22px; height: 22px; }
  .topnav .sp { flex: 1; }
  .head { border-radius: 24px; margin: 16px 16px 0; padding: 18px 24px; }
  .head h1 { font-size: 1.65rem; }
  .body { padding: 16px 24px 24px; }
  .with-list { flex: 1; display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 0; }
  .with-list > .plist { display: flex; flex-direction: column; gap: 8px; padding: 16px 0 16px 16px; position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 64px); overflow: auto; }
  .with-list .ppl-row, .head .rowwrap, .head .fsbtn { display: none; }
  .plist .ttl { font-size: .95rem; font-weight: 700; color: var(--ink2); padding: 0 4px 4px; }
  .pbtn { min-height: 62px; border-radius: 16px; border: 2px solid transparent; background: #fff; padding: 8px 12px; display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; }
  .pbtn.sel { border-color: var(--primary); background: var(--nav-on-bg); }
  .pbtn .av { width: 42px; height: 42px; font-size: 1rem; background: var(--bg); }
  .pbtn.sel .av { background: var(--primary); color: #fff; }
  .pbtn .av .dot { border-color: #fff; width: 14px; height: 14px; }
  .pbtn .grow { display: flex; flex-direction: column; min-width: 0; }
  .pbtn .nm { font-weight: 700; }
  .pbtn .st { font-size: .82rem; font-weight: 600; }
  .modal-bg { align-items: center; }
  .catgrid.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats { gap: 12px; }
  .wings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
  .ovgroups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .ovgroups .catgrid { grid-template-columns: 1fr; }
  .sends { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .narrow { max-width: 640px; width: 100%; margin: 0 auto; }
}

/* =====================================================================
   คอม (≥1200): เมนูซ้าย
   ===================================================================== */
@media (min-width: 1200px) {
  .shell { flex-direction: row; }
  .topnav { display: none; }
  .side { display: flex; width: 232px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line2); padding: 24px 16px; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
  .side .logo { font-family: 'Mali', sans-serif; font-size: 1.65rem; font-weight: 700; color: var(--primary); padding: 0 8px; }
  .side nav { display: flex; flex-direction: column; gap: 6px; }
  .side .navbtn { flex-direction: row; justify-content: flex-start; min-height: 52px; padding: 0 14px; gap: 12px; font-size: 1rem; }
  .side .navbtn svg { width: 22px; height: 22px; }
  .side .bottom { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
  .side .me { display: flex; align-items: center; gap: 10px; padding: 8px; }
  .side .me .av { width: 40px; height: 40px; background: var(--primary); color: #fff; font-size: 1rem; }
  .with-list { grid-template-columns: 280px minmax(0, 1fr); }
  .with-list > .plist { top: 0; max-height: 100vh; padding: 24px 16px; border-right: 1px solid var(--line2); }
  .head { margin: 24px 32px 0; padding: 18px 28px; border-radius: 28px; }
  .body { padding: 20px 32px 28px; }
  .foot { padding: 14px 32px 20px; background: #fff; flex-direction: row; align-items: center; justify-content: flex-end; gap: 20px; }
  .foot .btn.primary { width: 340px; }
  .catgrid.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
