/* Regent School of English · login.regentenglishschool.com · หน้าตาชุดเดียวกับ Regent DB (น้ำเงินเข้ม #28285E · ปุ่มฟ้า #2F7CF6 · Google Sans) */
@font-face { font-family: 'Google Sans'; font-style: normal; font-display: swap; font-weight: 400 700;
  src: url(assets/fonts/google-sans-thai-wght-normal.woff2) format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Google Sans'; font-style: normal; font-display: swap; font-weight: 400 700;
  src: url(assets/fonts/google-sans-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Google Sans'; font-style: normal; font-display: swap; font-weight: 400 700;
  src: url(assets/fonts/google-sans-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root { --bg: #F2F4F7; --card: #fff; --text: #111827; --muted: #6B7280; --faint: #9CA3AF; --line: #E5E7EB; --line-soft: #F0F2F5;
  --primary: #2F7CF6; --primary-soft: #EAF2FF; --good: #16A34A; --good-soft: #E7F6EC; --warn: #C2700A; --warn-soft: #FEF3E2; --bad: #DC3E42; --bad-soft: #FDECEC; --nav: #28285E; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Google Sans", "Leelawadee UI", "Segoe UI", Tahoma, sans-serif; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.top { position: sticky; top: 0; z-index: 10; background: var(--nav); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; }
.top-row { display: flex; align-items: center; gap: 10px; }
.top h1 { font-size: 16px; line-height: 1.3; margin: 0; flex: 1; }
.upd { font-size: 12px; color: #CACBE8; }
.top-sub { font-size: 12px; font-weight: 400; color: #CACBE8; }
.icon-btn { border: 0; background: rgba(255,255,255,.12); color: #fff; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.branches { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.branches::-webkit-scrollbar { display: none; }
.chip { border: 0; border-radius: 999px; padding: 6px 14px; background: rgba(255,255,255,.12); color: #fff; white-space: nowrap; font-weight: 600; font-size: 14px; }
.chip[aria-pressed=true] { background: #fff; color: var(--nav); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px 0; }
.filters .search { grid-column: 1 / -1; }
.filters input, .filters select { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 0 12px; }
.check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.check input { width: 18px; height: 18px; }
main { padding: 10px 12px calc(28px + env(safe-area-inset-bottom)); }
.tab-h { display: flex; align-items: center; justify-content: space-between; margin: 14px 2px 8px; font-weight: 700; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 10px; white-space: nowrap; background: var(--line-soft); color: var(--muted); }
.pill.run { background: var(--good-soft); color: var(--good); } .pill.soon { background: var(--warn-soft); color: var(--warn); } .pill.end { background: #E5E7EB; color: #374151; }
.card { display: block; width: 100%; text-align: left; border: 0; background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.card:active { background: #FAFBFC; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-name { font-weight: 700; }
.sub { color: var(--muted); font-size: 13px; }
.blks { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 6px; }
.blk { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; padding: 4px 8px; border-radius: 6px; }
.blk.now { outline: 2px solid var(--text); }
.blk.past { opacity: .5; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.err { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
/* รายละเอียดกลุ่ม */
.det-top { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--line); padding: calc(8px + env(safe-area-inset-top)) 10px 8px; display: flex; align-items: center; gap: 8px; }
.det-top h2 { font-size: 16px; margin: 0; flex: 1; line-height: 1.3; }
.back { border: 0; background: var(--bg); width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.back svg { width: 20px; height: 20px; }
.share { border: 0; background: var(--primary); color: #fff; border-radius: 10px; height: 38px; padding: 0 12px; font-weight: 600; flex: none; }
.box { background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.box h3 { margin: 0 0 8px; font-size: 15px; }
dl.info { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; }
dl.info dt { color: var(--muted); } dl.info dd { margin: 0; font-weight: 600; }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.mt { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; font-size: 11px; text-align: center; }
.g .w { color: var(--faint); font-weight: 600; }
.g .d { padding: 3px 0; border-radius: 4px; position: relative; }
.g .d.on { font-weight: 700; }
.g .d.off { background: #FEE2E2; color: #B91C1C; text-decoration: line-through; }
.g .d.moved { color: var(--faint); text-decoration: line-through; }
.g .d.today { outline: 1.5px solid var(--text); }
.g .d.pd::after { content: ''; position: absolute; top: 1px; right: 1px; width: 5px; height: 5px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 1px #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.stu-h { font-weight: 700; font-size: 13px; border-radius: 6px; padding: 3px 8px; margin-top: 8px; }
.stu-list { margin: 4px 0 0; padding-left: 22px; font-size: 14px; }
.chg { font-size: 14px; padding: 4px 0; border-top: 1px solid var(--line-soft); }
.chg:first-of-type { border-top: 0; }
.note { white-space: pre-wrap; font-size: 14px; }
.intake { background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 4px; }
.intake h3 { margin: 0 0 6px; font-size: 15px; }
.in-tab { font-weight: 700; font-size: 13px; color: var(--muted); margin-top: 8px; }
.in-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.in-row:first-of-type { border-top: 0; }
.in-date { font-weight: 700; }
.in-free { font-weight: 700; color: var(--good); text-align: right; }
.in-free.full { color: var(--bad); }
.mini-blk { font-size: 12px; font-weight: 700; border-radius: 5px; padding: 1px 6px; margin-right: 4px; }
.det-btns { display: flex; gap: 6px; flex: none; }
.share.alt { background: var(--bg); color: var(--text); }
.ov { position: fixed; inset: 0; z-index: 50; background: rgba(17,24,39,.85); display: flex; flex-direction: column; padding: calc(12px + env(safe-area-inset-top)) 12px 12px; gap: 10px; }
.ov-top { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 14px; }
.ov-top span { flex: 1; }
.ov-img { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }
.ov-img img { width: 100%; height: auto; display: block; border-radius: 8px; -webkit-touch-callout: default; user-select: auto; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 60; max-width: 90vw; }
.br-head { font-weight: 700; margin: 6px 2px 10px; color: var(--muted); }
.br-card { display: block; width: 100%; text-align: left; border: 0; background: var(--card); border-radius: 16px; padding: 18px 18px 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.06); }
.br-card:active { background: #FAFBFC; }
.br-code { font-size: 32px; font-weight: 800; color: var(--primary); line-height: 1.1; }
.br-name { font-size: 17px; font-weight: 600; margin: 2px 0 10px; }
.br-stat { display: flex; gap: 6px; flex-wrap: wrap; }
.foot { text-align: center; color: var(--faint); font-size: 12px; margin-top: 14px; }

/* ---------- หน้าเข้าสู่ระบบ (แบบโปรแกรม Regent DB) ---------- */
.lg { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 14px; background: var(--nav); }
.lg-card { background: var(--card); border-radius: 20px; padding: 30px 26px 24px; width: min(400px, 100%); box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.lg-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.lg-logo img { height: 52px; max-width: 240px; object-fit: contain; }
.lg-head { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 18px; text-align: center; }
.lg-head b { font-size: 19px; color: var(--nav); }
.lg-head span { font-size: 14px; font-weight: 600; color: var(--primary); }
.lg-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
.lg-card input { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; font-size: 16px; background: #fff; }
.lg-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.lg-btn { width: 100%; margin-top: 18px; height: 48px; border: 0; border-radius: 12px; background: var(--primary); color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; }
.lg-btn:disabled { opacity: .6; }
.lg-err { color: var(--bad); font-size: 14px; min-height: 22px; margin-top: 10px; text-align: center; }
.lg-note { margin: 8px 0 0; text-align: center; font-size: 12px; color: var(--faint); }

/* ---------- รายชื่อนักเรียน: เพิ่ม / แก้ / ลบ ---------- */
.stu-rows { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 4px; }
.stu-row { display: flex; align-items: center; gap: 6px; }
.stu-n { width: 20px; text-align: right; font-size: 12px; color: var(--faint); flex: none; }
.stu-f { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.stu-f input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: #fff; font-size: 16px; }
.stu-name { height: 40px; font-weight: 600; }
.stu-note { height: 34px; font-size: 14px !important; color: var(--muted); }
.stu-f input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); color: var(--text); }
.stu-name::placeholder, .stu-note::placeholder { color: var(--faint); font-weight: 400; }
.stu-book { display: flex; flex-direction: column; align-items: center; gap: 0; font-size: 12px; flex: none; cursor: pointer; }
.stu-book input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.stu-x { width: 34px; height: 34px; flex: none; border: 0; border-radius: 9px; background: transparent; color: var(--faint); display: grid; place-items: center; cursor: pointer; }
.stu-x:hover, .stu-x:active { background: var(--bad-soft); color: var(--bad); }
.stu-x svg { width: 16px; height: 16px; }
.stu-add { display: inline-flex; align-items: center; gap: 4px; border: 1px dashed var(--line); background: var(--card); color: var(--primary); border-radius: 10px; padding: 7px 12px; font-weight: 600; font-size: 14px; margin: 2px 0 6px 26px; cursor: pointer; }
.stu-add svg { display: none; }
.empty-s { color: var(--muted); font-size: 14px; }
.user-btn svg { width: 19px; height: 19px; }
