/* =====================================================================
   หลังบ้านระบบจัดตารางสอน — ธีมราชการสมัยใหม่
   แถบหัวไล่เฉดน้ำเงิน · พื้นฟ้าอ่อนลายคลื่น · การ์ดขาวขอบมน · ป้ายหัวข้อแบบแท็บ
   ===================================================================== */
:root {
  --brand-900: #1E3A82; --brand-700: #3354A6; --brand-600: #4064B8; --brand-500: #4F75C9; --brand-300: #9DB7E8;
  --sky-200: #CFE0F3; --sky-100: #E3EEF9; --sky-50: #F3F8FD;
  --accent: #F0952C; --accent-bg: #FEF1E2; --teal: #23A6A1;
  --paper: #FFFFFF; --ink: #1D2A44; --muted: #5E6B82; --line: #D4DFEE; --soft: #F4F7FC;
  --ok: #17845A; --ok-bg: #E2F4EB; --warn: #B76A00; --warn-bg: #FDF1DC; --clash: #C9302C; --clash-bg: #FCE7E6;
  --focus: #2F6FED; --r: 12px; --r-sm: 8px;
  --head: "Kanit", "Prompt", "IBM Plex Sans Thai", Tahoma, sans-serif;
  font-family: "IBM Plex Sans Thai", "Sarabun", Tahoma, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink); font-size: 15px; line-height: 1.6;
  background-color: var(--sky-50);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 260' preserveAspectRatio='none'%3E%3Cpath d='M0 150 C 300 60 520 230 820 140 S 1300 40 1600 120 V260 H0Z' fill='%23E1ECF8'/%3E%3Cpath d='M0 200 C 360 120 640 260 960 190 S 1380 120 1600 170 V260 H0Z' fill='%23D5E4F5' opacity='.8'/%3E%3Cpath d='M0 120 C 280 40 560 200 900 110 S 1350 30 1600 90' fill='none' stroke='%23FFFFFF' stroke-width='3' opacity='.9'/%3E%3Cpath d='M0 175 C 320 100 600 240 940 160 S 1380 80 1600 140' fill='none' stroke='%23FFFFFF' stroke-width='2' opacity='.7'/%3E%3C/svg%3E"),
    radial-gradient(1200px 500px at 85% 0%, #FFFFFF 0%, rgba(255,255,255,0) 70%),
    linear-gradient(180deg, #F6FAFE 0%, #EAF2FB 100%);
  background-repeat: no-repeat; background-position: bottom center, 0 0, 0 0; background-size: 100% 240px, auto, auto; background-attachment: fixed;
}
a { color: var(--brand-700); }
h1, h2, h3, .head { font-family: var(--head); font-weight: 500; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- แถบหัว ---------- */
.hdr { position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(100deg, #2B4A9E 0%, #3E62B7 42%, #6F91D8 78%, #8CA9E3 100%); }
.hdr::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 120' preserveAspectRatio='none'%3E%3Cpath d='M700 120 C 900 30 1150 110 1600 20 V120Z' fill='%23FFFFFF' opacity='.10'/%3E%3Cpath d='M900 120 C 1100 60 1300 120 1600 60 V120Z' fill='%23FFFFFF' opacity='.08'/%3E%3C/svg%3E") no-repeat bottom right / 100% 100%; }
.hdr-in { position: relative; z-index: 1; display: flex; align-items: center; gap: 18px; padding: 16px 28px; min-height: 92px; }
.logo { display: flex; align-items: center; gap: 14px; text-decoration: none; color: #fff; padding-right: 18px; border-right: 1px solid rgba(255,255,255,.35); }
.logo svg { width: 54px; height: 54px; flex: none; filter: drop-shadow(0 2px 6px rgba(15,30,80,.25)); }
.hdr-title { margin-right: auto; min-width: 0; }
.hdr-title b { display: block; font-family: var(--head); font-weight: 500; font-size: 24px; line-height: 1.25; letter-spacing: .01em; }
.hdr-title span { display: block; font-size: 13.5px; opacity: .92; }
.hdr-date { font-family: var(--head); font-size: 19px; white-space: nowrap; }
.subbar { position: relative; background: linear-gradient(90deg, #C7DBF0 0%, #DCE9F7 30%, #E6F0FA 100%); border-bottom: 1px solid #CADBEF; }
.subbar::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 140px; background: linear-gradient(90deg, #A9C6E8, rgba(169,198,232,0)); clip-path: polygon(0 0, 100% 0, 70% 100%, 0 100%); }
.subbar-in { position: relative; display: flex; align-items: center; gap: 6px; padding: 6px 28px; min-height: 40px; font-size: 14px; }
.subbar-in .who { margin-right: auto; color: var(--brand-900); font-weight: 500; }
.subbar a.lnk { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; color: var(--brand-900); text-decoration: none; border-left: 1px solid #B6CBE6; font-family: var(--head); }
.subbar a.lnk:first-of-type { border-left: 0; }
.subbar a.lnk:hover { color: var(--brand-600); }
.subbar svg { width: 17px; height: 17px; }

/* ---------- เค้าโครง ---------- */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; padding: 22px 28px 56px; max-width: 1680px; margin: 0 auto; }
.side { background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 10px; align-self: start; position: sticky; top: 16px;
  max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 6px 24px rgba(40,80,150,.06); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 14.5px; font-family: var(--head); font-weight: 400; }
.nav a:hover { background: var(--sky-100); color: var(--brand-900); }
.nav a.on { background: linear-gradient(100deg, var(--brand-700), var(--brand-500)); color: #fff; box-shadow: 0 4px 12px rgba(51,84,166,.28); }
.nav .grp { margin: 14px 12px 4px; font-size: 12.5px; color: var(--muted); font-family: var(--head); }
.nav .grp:first-child { margin-top: 2px; }
.nav svg { width: 18px; height: 18px; flex: none; color: var(--brand-500); }
.nav a.on svg { color: #fff; }
.main { min-width: 0; }
.topline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.topline h1 { margin: 0; font-size: 26px; line-height: 1.25; color: var(--brand-900); }
.topline p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.btn.menu-btn { display: none; padding: 6px 8px; }
.menu-btn svg { width: 20px; height: 20px; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; padding: 14px 14px 48px; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; max-height: none; border-radius: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(20,35,70,.45); }
  .btn.menu-btn { display: inline-flex; }
  .hdr-in { padding: 12px 14px; min-height: 72px; gap: 12px; }
  .logo { padding-right: 12px; } .logo svg { width: 42px; height: 42px; }
  .hdr-title b { font-size: 18px; } .hdr-date { display: none; }
  .subbar-in { padding: 6px 14px; }
}
@media (max-width: 560px) { .subbar a.lnk span { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- การ์ด / หัวข้อแบบแท็บ ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; margin-bottom: 18px; box-shadow: 0 6px 24px rgba(40,80,150,.05); }
.panel > h2, .tab-title { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 18px; color: var(--ink); }
.panel > h2::before, .tab-title::before { content: ""; width: 30px; height: 30px; border-radius: 7px; flex: none;
  background: var(--brand-600) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 8h12M6 12h12M6 16h8'/%3E%3C/svg%3E") center / 18px no-repeat; }
.panel > .sub { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.panel.framed { position: relative; margin-top: 30px; padding-top: 38px; }
.panel.framed > .frame-tab { position: absolute; top: -21px; left: 50%; transform: translateX(-50%); display: flex; align-items: stretch; border-radius: 8px; overflow: hidden;
  background: #EEF2F7; box-shadow: 0 2px 8px rgba(40,80,150,.10); font-family: var(--head); font-size: 18px; white-space: nowrap; }
.frame-tab i { width: 42px; background: var(--brand-600) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 8h12M6 12h12M6 16h8'/%3E%3C/svg%3E") center / 20px no-repeat; }
.frame-tab span { padding: 7px 40px 7px 14px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { position: relative; display: flex; align-items: center; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; text-decoration: none; color: var(--ink); box-shadow: 0 6px 24px rgba(40,80,150,.05); }
.stat .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--sky-100); color: var(--brand-600); }
.stat .ic svg { width: 24px; height: 24px; }
.stat .ic.or { background: var(--accent-bg); color: var(--accent); } .stat .ic.tl { background: #DDF3F2; color: var(--teal); } .stat .ic.gn { background: var(--ok-bg); color: var(--ok); }
.stat b { display: block; font-family: var(--head); font-weight: 500; font-size: 28px; line-height: 1.15; color: var(--brand-900); }
.stat span { color: var(--muted); font-size: 13.5px; }
a.stat:hover { border-color: var(--brand-300); }

/* ---------- เมนูหลักแบบภาพประกอบ ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 26px; }
.tile { display: flex; flex-direction: column; align-items: stretch; }
.tile .art { display: grid; place-items: center; height: 168px; }
.tile .art svg { width: 100%; max-width: 230px; height: 160px; }
.tile .links { list-style: none; margin: 8px 0 0; padding: 0 6px; }
.tile .links li a { display: flex; align-items: center; gap: 12px; padding: 7px 4px; text-decoration: none; color: var(--ink); font-size: 15.5px; border-radius: 6px; }
.tile .links li a:hover { color: var(--brand-700); background: var(--sky-50); }
.tile .links li:first-child a { font-family: var(--head); font-weight: 500; color: var(--brand-900); font-size: 17px; }
.tile .links svg { width: 24px; height: 24px; flex: none; }

/* ---------- ตาราง ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); box-shadow: 0 6px 24px rgba(40,80,150,.04); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; font-family: var(--head); background: linear-gradient(180deg, #F0F5FC, #E6EEF9); color: var(--brand-900); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid #EBF0F7; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:nth-child(even) td { background: #FAFCFF; }
.tbl tbody tr:hover td { background: #F1F6FD; }
.tbl td.act { white-space: nowrap; text-align: right; }
.tbl td a { text-decoration: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ---------- ฟอร์ม ---------- */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field label, .lbl { font-size: 14px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field > .badge { align-self: flex-start; }
.hint .check { font-size: 12.5px; gap: 4px; } .hint .check input { width: 13px; height: 13px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=email], input[type=search], select, textarea {
  font: inherit; font-size: 14.5px; padding: 8px 11px; border: 1px solid #C3D2E6; border-radius: var(--r-sm); background: #fff; color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,117,201,.18); }
textarea { min-height: 80px; resize: vertical; }
input[type=color] { width: 56px; height: 38px; padding: 2px; border: 1px solid #C3D2E6; border-radius: var(--r-sm); background: #fff; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--brand-600); }
.req { color: var(--clash); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }

/* ---------- ปุ่ม / ป้าย ---------- */
.btn { font: inherit; font-family: var(--head); font-size: 14.5px; font-weight: 400; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 16px;
  border-radius: var(--r-sm); border: 1px solid #C3D2E6; background: #fff; color: var(--brand-900); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { border-color: var(--brand-500); background: var(--sky-50); }
.btn.primary { background: linear-gradient(180deg, #4A6DC0, #3354A6); border-color: #2F4E9C; color: #fff; box-shadow: 0 3px 10px rgba(51,84,166,.25); }
.btn.primary:hover { background: linear-gradient(180deg, #5277CC, #3A5CB0); }
.btn.go { background: linear-gradient(180deg, #23A06E, #17845A); border-color: #14774F; color: #fff; }
.btn.danger { color: var(--clash); }
.btn.danger:hover { border-color: var(--clash); background: var(--clash-bg); }
.btn.sm { padding: 3px 11px; font-size: 13.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--soft); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: #B5DFC9; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: #F0D3A2; }
.badge.clash { background: var(--clash-bg); color: var(--clash); border-color: #F2BEBB; }
.badge.ink { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
.flash { padding: 11px 15px; border-radius: var(--r-sm); margin-bottom: 14px; font-size: 14.5px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); border-color: #B5DFC9; color: #0F5B3D; }
.flash.err { background: var(--clash-bg); border-color: #F2BEBB; color: #8E1C18; }
.flash.info { background: #E8F0FC; border-color: #C3D5F3; color: #1E3E7A; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
.muted { color: var(--muted); } .small { font-size: 13px; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: var(--sky-100); padding: 1px 6px; border-radius: 4px; word-break: break-all; }
.copy { display: flex; gap: 6px; } .copy input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: var(--soft); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dashed #DCE5F1; }
.checklist li:last-child { border: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--accent); } .dot.clash { background: var(--clash); }
.pager { display: flex; gap: 6px; justify-content: flex-end; margin-top: 10px; align-items: center; }

/* ---------- จัดสอนแทน ---------- */
.dayline { display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)); gap: 5px; margin: 8px 0 16px; }
.dayline div { border: 1px dashed #C3D2E6; border-radius: 8px; padding: 6px 4px; text-align: center; font-size: 12.5px; color: var(--muted); min-height: 52px; background: var(--sky-50); }
.dayline div.vac { border: 2px solid var(--clash); background: var(--clash-bg); color: var(--clash); font-weight: 600; }
.dayline div.vac.assigned { border-color: var(--accent); background: var(--accent-bg); color: #A65F0C; }
.dayline div.vac.accepted { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.period-card { border: 1px solid var(--line); border-radius: var(--r); background: #fff; margin-bottom: 14px; overflow: hidden; box-shadow: 0 6px 24px rgba(40,80,150,.05); }
.period-card header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 10px 16px; background: linear-gradient(90deg, #EAF1FB, #F6F9FE); border-bottom: 1px solid var(--line); }
.period-card header .pno { font-family: var(--head); font-size: 21px; font-weight: 500; min-width: 70px; color: var(--brand-700); }
.period-card header .what { margin-right: auto; }
.period-card header .what b { display: block; font-family: var(--head); font-weight: 500; }
.period-card .body { padding: 10px 16px; }
.cand { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 7px 6px; border-bottom: 1px solid #F0F3F8; cursor: pointer; border-radius: 6px; }
.cand:last-child { border-bottom: 0; }
.cand:hover { background: var(--sky-50); }
.cand input { accent-color: var(--brand-600); width: 16px; height: 16px; }
.cand .why { font-size: 12.5px; color: var(--muted); }
.cand .score { font-family: var(--head); font-variant-numeric: tabular-nums; font-weight: 500; font-size: 17px; min-width: 36px; text-align: right; color: var(--brand-900); }
.p1 { background: var(--ok-bg); color: var(--ok); border-color: #B5DFC9; }
.p2 { background: #E6EEFB; color: var(--brand-700); border-color: #C3D5F3; }
.p3 { background: var(--soft); color: var(--muted); }
.toast { position: fixed; right: 18px; bottom: 18px; max-width: 420px; z-index: 60; padding: 12px 16px; border-radius: 10px; color: #fff; background: var(--brand-900); box-shadow: 0 8px 28px rgba(20,35,70,.3); font-size: 14.5px; }
.toast.err { background: var(--clash); } .toast.ok { background: var(--ok); }
.sub-layout { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1150px) { .sub-layout { grid-template-columns: 1fr; } }
.leave-row { padding: 10px 0; border-bottom: 1px dashed #DCE5F1; }
.leave-row:last-child { border-bottom: 0; }
.leave-row.on { background: var(--sky-100); margin: 0 -10px; padding: 10px; border-radius: 8px; border-bottom-color: transparent; }
.leave-row .tops { display: flex; gap: 8px; align-items: baseline; }
.leave-row .tops b { flex: 1; font-family: var(--head); font-weight: 500; }
.leave-row .chips { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0; }

/* ---------- หน้าเข้าสู่ระบบ / ติดตั้ง ---------- */
.solo { min-height: 100vh; display: flex; flex-direction: column; }
.solo .stage { flex: 1; display: grid; place-items: center; padding: 48px 20px 64px; }
.card { position: relative; width: 100%; max-width: 900px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 46px 40px 34px; box-shadow: 0 12px 40px rgba(40,80,150,.10); }
.card.narrow { max-width: 880px; }
.card > .frame-tab { position: absolute; top: -21px; left: 50%; transform: translateX(-50%); display: flex; border-radius: 8px; overflow: hidden; background: #EEF2F7; box-shadow: 0 2px 8px rgba(40,80,150,.12); font-family: var(--head); font-size: 18px; white-space: nowrap; }
.card h1 { margin: 0 0 4px; font-size: 23px; color: var(--brand-900); }
.card .lead { margin: 0 0 20px; color: var(--muted); }
.login-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 34px; align-items: center; }
.login-grid .art svg { width: 100%; height: auto; max-height: 300px; }
@media (max-width: 760px) { .login-grid { grid-template-columns: 1fr; } .login-grid .art { display: none; } .card { padding: 40px 22px 26px; } }
.foot { text-align: center; font-size: 12.5px; color: var(--muted); padding: 12px 16px 16px; }
.steps { display: flex; gap: 8px; margin: 0 0 22px; padding: 0; list-style: none; flex-wrap: wrap; }
.steps li { font-size: 13.5px; padding: 4px 14px; border-radius: 999px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); font-family: var(--head); }
.steps li.on { background: linear-gradient(100deg, var(--brand-700), var(--brand-500)); color: #fff; border-color: var(--brand-700); }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px 18px; margin: 0 0 18px; background: #FBFDFF; }
legend { font-family: var(--head); font-weight: 500; padding: 0 8px; color: var(--brand-900); font-size: 16px; }
details.more { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 12px; }
details.more > summary, details.navmore > summary { cursor: pointer; font-family: var(--head); color: var(--brand-700); list-style: none; }
details.more > summary::before, details.navmore > summary::before { content: "▸ "; }
details.more[open] > summary::before, details.navmore[open] > summary::before { content: "▾ "; }
details.more > .form { margin-top: 12px; }
details.navmore > summary { margin: 14px 12px 4px; font-size: 12.5px; color: var(--muted); }
details#adv > summary { list-style: none; }
details#adv > summary::before { content: "▸ "; color: var(--brand-600); }
details#adv[open] > summary::before { content: "▾ "; }
/* เลือกหลายรายการ */
.tbl th.chk, .tbl td.chk { width: 42px; text-align: center; padding-right: 4px; }
.tbl .chk input { width: 17px; height: 17px; accent-color: var(--brand-600); cursor: pointer; }
.tbl tbody tr.sel td { background: #E7EFFB !important; }
.bulkbar { position: sticky; top: 10px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 14px; margin-bottom: 10px;
  background: var(--brand-900); color: #fff; border-radius: 10px; box-shadow: 0 8px 22px rgba(30,58,130,.28); font-family: var(--head); }
.bulkbar[hidden] { display: none; }
.bulkbar .btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); color: #fff; }
.bulkbar .btn:hover { background: rgba(255,255,255,.22); }
.bulkbar .btn.danger-solid { background: var(--clash); border-color: var(--clash); }
.btn svg { width: 16px; height: 16px; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.mode { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; }
.mode:hover { border-color: var(--brand-300); }
.mode:has(input:checked) { border-color: var(--brand-600); background: var(--sky-50); box-shadow: 0 0 0 2px rgba(79,117,201,.15); }
.mode.danger:has(input:checked) { border-color: var(--clash); background: var(--clash-bg); }
.mode input { margin-top: 4px; accent-color: var(--brand-600); }
.mode b { display: block; font-family: var(--head); font-weight: 500; }
.mode small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.bulkbar .grow { flex: 1; }
/* การ์ดกลุ่ม (ระดับชั้น / กลุ่มสาระ) */
.gtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.gtile { display: flex; flex-direction: column; gap: 2px; padding: 18px 18px 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink);
  box-shadow: 0 6px 24px rgba(40,80,150,.05); position: relative; overflow: hidden; transition: border-color .15s, transform .15s; }
.gtile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--brand-500); }
.gtile:hover { border-color: var(--brand-300); transform: translateY(-1px); }
.gtile b { font-family: var(--head); font-weight: 500; font-size: 21px; color: var(--brand-900); }
.gtile span { color: var(--muted); font-size: 13.5px; }
.gtile.all::before { background: var(--accent); }
.gtile.empty { opacity: .6; } .gtile.empty::before { background: var(--line); }
.gtile.warn::before { background: var(--clash); }
/* แผนพักกลางวัน */
.lunch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.round { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: #fff; }
.round h3 { margin: 0 0 4px; font-size: 18px; color: var(--brand-900); }
.round .bar { height: 8px; border-radius: 99px; background: var(--sky-100); overflow: hidden; margin: 8px 0 4px; }
.round .bar i { display: block; height: 100%; background: var(--brand-500); }
.round .bar i.over { background: var(--clash); }
