/* PC Calendar · หน้าตาหลัก (โทนสว่าง เรียบ อ่านง่าย) */
@font-face { font-family: 'Sarabun'; font-weight: 400; font-display: swap; src: url(../fonts/sarabun-400.woff) format('woff'); }
@font-face { font-family: 'Sarabun'; font-weight: 600; font-display: swap; src: url(../fonts/sarabun-600.woff) format('woff'); }
@font-face { font-family: 'Sarabun'; font-weight: 700; font-display: swap; src: url(../fonts/sarabun-700.woff) format('woff'); }

:root {
  --p: #0866e8; --p-d: #0752bd; --p-l: #e8f1fe; --a: #0fa99a; --a-l: #e3f6f3;
  --ink: #14213d; --muted: #5d6a85; --line: #e1e7f0; --bg: #f4f7fb; --card: #fff;
  --red: #dc2626; --red-l: #fdecec; --orange: #d97706; --orange-l: #fff4e0; --green: #059669; --green-l: #e6f6ef;
  --violet: #7c3aed; --violet-l: #f1ebfe; --r: 12px; --sh: 0 1px 2px rgba(20,33,61,.05), 0 2px 8px rgba(20,33,61,.04);
  --side: 248px; --ctl: 44px; --ctl-sm: 38px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15.5px/1.6 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--p); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.hide { display: none !important; }

/* ---------- โครงหน้า ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; overflow-y: auto; }
.brand { display: flex; gap: 11px; align-items: center; padding: 18px 18px 14px; color: var(--ink); text-decoration: none !important; }
.brand .logo { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, var(--p), var(--a)); color: #fff; display: grid; place-items: center; overflow: hidden; flex: none; }
.brand .logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand b { display: block; font-size: 17px; }
.brand small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.nav { padding: 4px 12px 20px; display: flex; flex-direction: column; gap: 2px; }
.nav-h { font-size: 12px; font-weight: 600; color: #94a0b8; padding: 14px 10px 4px; letter-spacing: .02em; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: #34405e; font: inherit; font-size: 15px; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; text-decoration: none !important; }
.nav-item:hover { background: var(--bg); }
.nav-item.on { background: var(--p-l); color: var(--p); font-weight: 600; }
.nav-item .count { margin-left: auto; font-style: normal; background: var(--red); color: #fff; border-radius: 99px; font-size: 12px; padding: 0 7px; line-height: 19px; }
.nav-form { margin: 0; }
.main { margin-left: var(--side); min-height: 100vh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; height: 60px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 24px; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; margin-left: -6px; color: var(--ink); cursor: pointer; }
.crumbs { flex: 1; min-width: 0; font-size: 14.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { margin: 0 7px; color: #b5bfd2; }
.crumbs span:last-child { color: var(--ink); font-weight: 600; }
.fy-pill { font-size: 13px; background: var(--a-l); color: #0b7d72; padding: 3px 11px; border-radius: 99px; font-weight: 600; white-space: nowrap; }
.me { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none !important; }
.me .av { width: 32px; height: 32px; border-radius: 50%; background: var(--p); color: #fff; display: grid; place-items: center; font-weight: 600; }
.me-n { font-size: 14.5px; max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; padding: 24px; width: 100%; max-width: 1280px; }
.foot { padding: 16px 24px 22px; color: #94a0b8; font-size: 13px; }
.shade { display: none; }

@media (max-width: 960px) {
  .side { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 10px 40px rgba(0,0,0,.15); }
  body.nav-open .side { transform: none; }
  body.nav-open .shade { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: block; }
  .top { padding: 0 16px; gap: 10px; }
  .content { padding: 16px; }
  .me-n, .fy-pill { display: none; }
}

/* ---------- ส่วนประกอบ ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 20px; min-width: 0; }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h h2 { font-size: 17.5px; display: flex; align-items: center; gap: 8px; }
.card-h h2 .ic { color: var(--p); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1100px) { .g-main { grid-template-columns: minmax(0, 1fr); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } }

.kpi { display: flex; gap: 14px; align-items: center; }
.kpi .k-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.kpi .k-v { font-size: 26px; font-weight: 700; line-height: 1.1; }
.kpi .k-l { color: var(--muted); font-size: 14px; }
.k-blue { background: var(--p-l); color: var(--p); } .k-teal { background: var(--a-l); color: var(--a); }
.k-violet { background: var(--violet-l); color: var(--violet); } .k-orange { background: var(--orange-l); color: var(--orange); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: var(--ctl); padding: 0 16px; box-sizing: border-box; border-radius: 9px; border: 1px solid var(--p); background: var(--p); color: #fff; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none !important; white-space: nowrap; line-height: 1.3; }
.btn:hover { background: var(--p-d); }
.btn-o { background: #fff; color: var(--p); border-color: #c7d8f5; }
.btn-o:hover { background: var(--p-l); }
.btn-g { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-g:hover { background: var(--bg); }
.btn-teal { background: var(--a); border-color: var(--a); } .btn-teal:hover { background: #0c8f83; }
.btn-red { background: #fff; color: var(--red); border-color: #f5c2c2; } .btn-red:hover { background: var(--red-l); }
.btn-sm { min-height: var(--ctl-sm); padding: 0 12px; font-size: 14px; }
.btn-icon { padding: 0; width: var(--ctl); }
.btn-sm.btn-icon { width: var(--ctl-sm); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.inline { display: inline; margin: 0; }

.alert { padding: 11px 15px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; }
.a-success { background: var(--green-l); border-color: #a7e3c8; color: #065f46; }
.a-error { background: var(--red-l); border-color: #f5c2c2; color: #991b1b; }
.a-warn { background: var(--orange-l); border-color: #f4d39a; color: #92400e; }
.a-info { background: var(--p-l); border-color: #c7d8f5; color: #0a4fb8; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.b-blue { background: var(--p-l); color: var(--p); } .b-green { background: var(--green-l); color: var(--green); }
.b-gray { background: #eef1f6; color: #5d6a85; } .b-orange { background: var(--orange-l); color: var(--orange); }
.b-red { background: var(--red-l); color: var(--red); }
.tag { display: inline-block; padding: 0 8px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.t1 { background: var(--p-l); color: var(--p); } .t2 { background: var(--a-l); color: #0b7d72; } .t3 { background: var(--violet-l); color: var(--violet); }
.t4 { background: var(--orange-l); color: var(--orange); } .t5 { background: #fdeaf3; color: #be185d; }

/* ฟอร์ม */
label.f, .f { display: block; }
.f > span { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 5px; }
.f > span em { color: var(--red); font-style: normal; }
.f small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: #fff; border: 1px solid #cfd8e6; border-radius: 10px; padding: 0 12px; height: var(--ctl); line-height: 1.4; box-sizing: border-box; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; text-overflow: ellipsis;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235d6a85' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 13px center; }
input[type=date] { padding-right: 8px; }
input::placeholder, textarea::placeholder { color: #9aa6bd; }
textarea { height: auto; padding: 10px 12px; }
.in-sm, .t input[type=text], .t input[type=number], .t input[type=password], .t select { height: var(--ctl-sm); font-size: 14.5px; padding-left: 10px; }
.t select { padding-right: 32px; background-position: right 11px center; }
.w-num { width: 74px !important; } .w-user { width: 150px !important; } .w-dept { min-width: 190px; }
.stack { display: grid; gap: 6px; }
textarea { min-height: 120px; resize: vertical; line-height: 1.65; }
textarea.short { min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--p); box-shadow: 0 0 0 3px rgba(8,102,232,.14); }
input[type=file] { font: inherit; font-size: 14px; max-width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.chk { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--p); flex: none; margin: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 1px solid #cfd8e6; border-radius: 99px; font-size: 14.5px; background: #fff; }
.seg input:checked + span { background: var(--p); border-color: var(--p); color: #fff; font-weight: 600; }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px rgba(8,102,232,.25); }

/* ตัวเลือกครู */

/* ตาราง */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13.5px; padding: 9px 10px; border-bottom: 1px solid var(--line); background: #f8fafd; white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: #fafcff; }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; }
.t-title { font-weight: 600; color: var(--ink); }
.t-sub { color: var(--muted); font-size: 13.5px; }
.ev-links { display: flex; gap: 5px; flex-wrap: wrap; }
.ev-links a, .ev-links span { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 1px 8px; border-radius: 6px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.ev-links a { color: var(--p); background: var(--p-l); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 170px; }
.filters input[type=search] { flex: 1; min-width: 200px; }
.filters input[type=checkbox] { min-width: 0; width: 18px; height: 18px; padding: 0; }
@media (max-width: 600px) {
  .filters select, .filters input[type=search] { flex: 1 1 100%; min-width: 0; }
}
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 19px; margin-bottom: 6px; }
.pager { display: flex; gap: 5px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 14px; }
.pager .cur { background: var(--p); color: #fff; border-color: var(--p); font-weight: 600; }

/* รายการกิจกรรม */
.ev { display: flex; gap: 13px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.ev:last-child { border-bottom: 0; }
.ev-date { width: 54px; flex: none; text-align: center; border-radius: 10px; background: var(--p-l); color: var(--p); padding: 5px 0; line-height: 1.15; height: fit-content; }
.ev-date b { display: block; font-size: 21px; }
.ev-date small { font-size: 12.5px; }
.ev-body { min-width: 0; flex: 1; }
.ev-body .t-title { display: block; }
.ev-meta { display: flex; flex-wrap: wrap; gap: 3px 14px; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.ev-meta span { display: inline-flex; gap: 5px; align-items: center; }

/* ปฏิทิน */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-head h2 { font-size: 20px; min-width: 170px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal .dow { background: #f8fafd; text-align: center; font-size: 13.5px; font-weight: 600; color: var(--muted); padding: 7px 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 112px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px; background: #fff; min-width: 0; }
.cal .day.out { background: #fafbfd; }
.cal .day.out .dn { color: #b7c0d1; }
.cal .day.today { background: #f5f9ff; }
.cal .day.today .dn { background: var(--p); color: #fff; }
.cal .dn { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.cal .day.sun .dn, .cal .day.sat .dn { color: #c2410c; }
.cal .day.today.sun .dn, .cal .day.today.sat .dn { color: #fff; }
.chip { display: block; font-size: 12.5px; line-height: 1.35; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none !important; }
.chip.more { color: var(--muted); background: none; padding-left: 4px; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
@media (max-width: 720px) {
  .cal .day { min-height: 54px; padding: 3px; }
  .cal .chip { font-size: 0; height: 6px; padding: 0; margin-bottom: 2px; border-radius: 3px; }
  .cal .chip.more { display: none; }
  .cal .dn { width: 22px; height: 22px; font-size: 12.5px; }
}

/* เกียรติบัตร / ภาพ */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.thumb { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fff; display: flex; flex-direction: column; min-width: 0; }
.thumb .ph { aspect-ratio: 4/3; background: #f1f4f9; display: grid; place-items: center; overflow: hidden; color: #9aa6bd; }
.thumb .ph img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ph.contain img { object-fit: contain; background: #fff; }
.thumb .ph .pdf { display: grid; place-items: center; gap: 4px; font-weight: 700; color: var(--red); font-size: 14px; }
.thumb .tb { padding: 9px 11px; font-size: 14px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.thumb .tb b { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thumb .tf { display: flex; gap: 5px; padding: 0 9px 9px; flex-wrap: wrap; }
.thumb.sel { outline: 3px solid var(--p); outline-offset: -1px; }
.thumb .pick { position: absolute; top: 8px; left: 8px; }
.thumb-rel { position: relative; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; position: relative; border-radius: 9px; overflow: hidden; background: #f1f4f9; aspect-ratio: 4/3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery figcaption { position: absolute; inset: auto 0 0 0; background: linear-gradient(transparent, rgba(0,0,0,.6)); color: #fff; font-size: 12.5px; padding: 14px 8px 5px; }
.gallery form { position: absolute; top: 5px; right: 5px; }
.gallery .x { background: rgba(255,255,255,.92); border: 0; border-radius: 7px; padding: 4px; cursor: pointer; color: var(--red); display: grid; }

.dl { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; font-size: 15px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
@media (max-width: 600px) { .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .dl dd { margin-bottom: 8px; } }
.files { list-style: none; padding: 0; margin: 0; }
.files li { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.files li:last-child { border-bottom: 0; }
.files li a.fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop { border: 1.5px dashed #b9c9e4; border-radius: 10px; padding: 14px; background: #fafcff; }
.drop + .drop { margin-top: 10px; }
.drop b { display: flex; gap: 7px; align-items: center; font-size: 14.5px; margin-bottom: 6px; }
.step-note { display: flex; gap: 10px; align-items: flex-start; background: var(--a-l); border-radius: 10px; padding: 11px 14px; font-size: 14.5px; color: #0b5e56; }

/* หน้าเข้าสู่ระบบ */
.login-wrap { min-height: calc(100vh - 160px); display: grid; place-items: center; }
.login { width: 100%; max-width: 410px; }
.login .brand-l { text-align: center; margin-bottom: 18px; }
.login .brand-l .logo { width: 58px; height: 58px; border-radius: 16px; margin: 0 auto 10px; background: linear-gradient(135deg, var(--p), var(--a)); color: #fff; display: grid; place-items: center; }
.login h1 { font-size: 22px; }
.slip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.slip { border: 1px dashed #9fb2d6; border-radius: 10px; padding: 12px 14px; font-size: 14.5px; }
.slip code { font-size: 16px; font-weight: 700; background: var(--p-l); padding: 0 6px; border-radius: 5px; color: var(--p-d); }
@media (max-width: 600px) {
  .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .thumb .tf .btn { padding: 5px 8px; }
}
@media print {
  .side, .top, .foot, .no-print, .alert { display: none !important; }
  .main { margin: 0; } .content { padding: 0; max-width: none; } body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
}

/* ================= ตกแต่งเพิ่มเติม: ภาพเคลื่อนไหว กราฟ และส่วนช่วยให้ใช้ง่าย ================= */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes dash { from { stroke-dasharray: 0 100; } }
@keyframes pop { 0% { transform: scale(.96); opacity: 0; } 100% { transform: none; opacity: 1; } }
.content > * { animation: fadeUp .45s ease both; }
.content > *:nth-child(2) { animation-delay: .05s; } .content > *:nth-child(3) { animation-delay: .1s; }
.content > *:nth-child(4) { animation-delay: .15s; } .content > *:nth-child(5) { animation-delay: .2s; } .content > *:nth-child(n+6) { animation-delay: .25s; }
.grid > .card { animation: fadeUp .45s ease both; }
.grid > .card:nth-child(2) { animation-delay: .06s; } .grid > .card:nth-child(3) { animation-delay: .12s; } .grid > .card:nth-child(4) { animation-delay: .18s; }
.card, .btn, .thumb, .tile { transition: transform .18s ease, box-shadow .18s ease, background-color .15s, border-color .15s; }
a.card:hover, .thumb:hover, .tile:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(20,33,61,.09); }
.btn:active { transform: scale(.98); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* หัวหน้าแบบภาพเด่น */
.hero { position: relative; overflow: hidden; border-radius: 18px; padding: 26px 28px; margin-bottom: 18px; color: #fff;
  background: linear-gradient(120deg, #0752bd 0%, #0866e8 45%, #0fa99a 100%); box-shadow: 0 10px 30px rgba(8,102,232,.18); }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.09); }
.hero::before { width: 320px; height: 320px; right: -80px; top: -150px; }
.hero::after { width: 200px; height: 200px; right: 160px; bottom: -130px; background: rgba(255,255,255,.06); }
.hero > * { position: relative; }
.hero h1 { font-size: 26px; }
.hero p { margin: 4px 0 0; opacity: .92; }
.hero .hero-date { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; background: rgba(255,255,255,.16); padding: 3px 11px; border-radius: 99px; margin-bottom: 10px; }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.hero-stat { background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.2); border-radius: 13px; padding: 12px 14px; backdrop-filter: blur(4px); }
.hero-stat b { display: block; font-size: 28px; line-height: 1.15; font-weight: 700; }
.hero-stat b small { font-size: 15px; font-weight: 600; margin-left: 3px; opacity: .85; }
.hero-stat > span { font-size: 13.5px; opacity: .9; }
@media (max-width: 720px) { .hero { padding: 20px 18px; } .hero h1 { font-size: 21px; } .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hero-stat b { font-size: 23px; } }

/* ปุ่มลัดขนาดใหญ่ */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { display: flex; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 16px 18px; color: var(--ink); text-decoration: none !important; box-shadow: var(--sh); position: relative; }
.tile .t-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff; }
.tile b { display: block; font-size: 17px; }
.tile div > span { color: var(--muted); font-size: 13.5px; line-height: 1.4; display: block; }
.tile .t-badge { position: absolute; top: 10px; right: 12px; background: var(--red); color: #fff; font-size: 12.5px; font-weight: 700; border-radius: 99px; padding: 0 8px; line-height: 21px; }
.ti-blue { background: linear-gradient(135deg, #0866e8, #3b8cff); } .ti-orange { background: linear-gradient(135deg, #d97706, #f5a524); }
.ti-teal { background: linear-gradient(135deg, #0b8f83, #0fa99a); } .ti-violet { background: linear-gradient(135deg, #6d28d9, #8b5cf6); }
@media (max-width: 860px) { .tiles { grid-template-columns: minmax(0, 1fr); gap: 10px; } .tile { padding: 13px 15px; } }

.kpi .k-v small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 3px; }

/* กราฟแท่งแนวตั้ง */
.colchart { display: flex; gap: 8px; height: 210px; padding-top: 6px; }
.cc-grid { display: flex; flex-direction: column; justify-content: space-between; font-size: 11.5px; color: #9aa6bd; padding-bottom: 24px; text-align: right; min-width: 18px; }
.cc-bars { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px;
  background: linear-gradient(#eef2f8 1px, transparent 1px) 0 0 / 100% calc((100% - 24px) / 2); }
.cc-col { display: flex; flex-direction: column; align-items: center; min-width: 0; outline: none; }
.cc-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.cc-bar { width: min(34px, 72%); border-radius: 6px 6px 2px 2px; position: relative; transform-origin: bottom; animation: grow .7s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 45ms + .15s); }
.cc-bar b { position: absolute; top: -21px; left: 50%; transform: translateX(-50%); font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.cc-col:hover .cc-bar, .cc-col:focus .cc-bar { filter: brightness(1.12); }
.cc-l { font-size: 12px; color: var(--muted); height: 24px; line-height: 24px; white-space: nowrap; }

/* วงแหวน */
.donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-fig { position: relative; width: 168px; height: 168px; flex: none; margin: 0 auto; }
.donut-svg { width: 100%; height: 100%; transform: rotate(0deg); }
.donut-seg { animation: dash .9s ease both; animation-delay: calc(var(--i) * 120ms + .1s); transition: stroke-width .15s; cursor: default; }
.donut-seg:hover { stroke-width: 6.4; }
.donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; }
.donut-c b { font-size: 30px; }
.donut-c > span { font-size: 13px; color: var(--muted); }
.legend-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 180px; display: grid; gap: 7px; }
.legend-list li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 42px; gap: 9px; align-items: center; font-size: 14.5px; }
.legend-list i { width: 12px; height: 12px; border-radius: 4px; }
.legend-list b { font-weight: 700; }
.legend-list em { font-style: normal; color: var(--muted); font-size: 13px; text-align: right; }

/* แท่งแนวนอน */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.hb-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; margin-bottom: 4px; }
.hb-top span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-top small { color: var(--muted); }
.hb-track { height: 9px; background: #eef2f8; border-radius: 99px; overflow: hidden; }
.hb-bar { height: 100%; border-radius: 99px; transform-origin: left; animation: growX .8s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 70ms + .15s); }

/* วงแหวนความคืบหน้า */
.ring { position: relative; width: 150px; height: 150px; margin: 0 auto; }
.ring svg { width: 100%; height: 100%; }
.ring-seg { animation: dash 1.1s ease both .2s; }
.ring-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; }
.ring-c b { font-size: 28px; }
.ring-c > span { font-size: 12.5px; color: var(--muted); }

/* ฟอร์มแบบขั้นตอน */
.step-card .card-h h2 .num { width: 30px; height: 30px; border-radius: 50%; background: var(--p); color: #fff; display: inline-grid; place-items: center; font-size: 15px; flex: none; }
.step-card .card-h p { margin: 0; color: var(--muted); font-size: 13.5px; width: 100%; }
details.more { border: 1px dashed #c9d5e8; border-radius: 10px; padding: 0 14px; margin-top: 14px; background: #fafcff; }
details.more > summary { cursor: pointer; padding: 11px 0; font-weight: 600; color: var(--p); list-style: none; display: flex; gap: 6px; align-items: center; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; width: 20px; height: 20px; border-radius: 6px; background: var(--p-l); display: inline-grid; place-items: center; }
details.more[open] > summary::before { content: "–"; }
details.more[open] { padding-bottom: 14px; }
.big-save { font-size: 17px; padding: 13px 20px; border-radius: 12px; }

/* กล่องเลือกไฟล์ขนาดใหญ่ */
.picker-file { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px;
  border: 2px dashed #b9c9e4; border-radius: 12px; padding: 16px 12px; background: #fafcff; cursor: pointer; color: var(--muted); font-size: 14px; }
.picker-file:hover, .picker-file.drag { border-color: var(--p); background: var(--p-l); color: var(--p); }
.picker-file input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.picker-file .ic { color: var(--p); }
.picker-file b { color: var(--ink); font-size: 15px; }
.file-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-preview img { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); animation: pop .25s ease both; }
.file-preview span { font-size: 12.5px; background: var(--bg); border-radius: 6px; padding: 2px 8px; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; animation: pop .25s ease both; }

/* แจ้งเตือนแบบลอย */
.alert { animation: pop .3s ease both; }
.alert.hiding { opacity: 0; transform: translateY(-6px); transition: opacity .35s, transform .35s; }

/* หน้าว่าง */
.empty .e-ic { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--p-l); color: var(--p); }

.section-t { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 6px 0 12px; }
.section-t .ic { color: var(--p); }

/* ================= ตัวเลือกครู (รองรับครูจำนวนมาก) ================= */
.picker { border: 1px solid #cfd8e6; border-radius: 12px; overflow: hidden; background: #fff; }
.pk-chosen { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; background: #f6f9fe; border-bottom: 1px solid var(--line); min-height: 58px; align-items: center; }
.pk-chosen .pk-empty { color: var(--muted); font-size: 14px; }
.pk-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 12px; border-radius: 99px; background: var(--p); color: #fff; font-size: 14px; font-weight: 600; animation: pop .2s ease both; }
.pk-chip button { width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(255,255,255,.22); color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 15px; line-height: 1; padding: 0; }
.pk-chip button:hover { background: rgba(255,255,255,.38); }
.pk-tools { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.pk-search { position: relative; }
.pk-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9aa6bd; pointer-events: none; }
.pk-search input { padding-left: 38px; }
.pk-list { max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.pk-gh { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 12px; background: #eef3fa; font-size: 13.5px; font-weight: 600; color: #34405e; }
.pk-gh button { border: 0; background: none; color: var(--p); font: inherit; font-size: 13px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.pk-gh button:hover { background: var(--p-l); }
.pk-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pk-row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 12px; cursor: pointer; border-bottom: 1px solid #f0f3f8; }
.pk-row:hover { background: #f8fafd; }
.pk-row input { position: absolute; opacity: 0; pointer-events: none; }
.pk-av { width: 34px; height: 34px; border-radius: 50%; background: #e8eef8; color: #4d5b78; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; transition: background .15s, color .15s; }
.pk-name { min-width: 0; font-size: 15px; line-height: 1.3; }
.pk-name small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-tick { margin-left: auto; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #c3cfe2; flex: none; display: grid; place-items: center; color: transparent; transition: all .15s; }
.pk-row input:checked ~ .pk-tick { background: var(--p); border-color: var(--p); color: #fff; }
.pk-row input:checked ~ .pk-av { background: var(--p); color: #fff; }
.pk-row:has(input:checked) { background: var(--p-l); }
.pk-row input:focus-visible ~ .pk-tick { box-shadow: 0 0 0 3px rgba(8,102,232,.25); }
.pk-none { padding: 22px; text-align: center; color: var(--muted); }
.pk-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--line); background: #fafcff; font-size: 14px; }
@media (max-width: 600px) { .pk-tools { grid-template-columns: minmax(0, 1fr); } .pk-rows { grid-template-columns: minmax(0, 1fr); } }

.scroll-box { max-height: 560px; overflow-y: auto; margin: 0 -4px; }
.scroll-box th { position: sticky; top: 0; z-index: 1; }
