:root{
  --navy:#173b6d;--navy-deep:#0d2b52;--purple:#8f2a8f;--orange:#ef5b2a;--gold:#d8a628;
  --blue-soft:#eef4fb;--purple-soft:#faf1fb;--line:#dbe4ee;--text:#172033;--muted:#64748b;
  --bg:#f3f6fa;--card:#fff;--ok:#0f766e;--danger:#b42318;--warn:#9a6700;--shadow:0 12px 34px rgba(15,39,71,.08);
}
*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;font-family:"Noto Sans Thai","Leelawadee UI","Tahoma",Arial,sans-serif;color:var(--text);background:var(--bg);line-height:1.55;-webkit-font-smoothing:antialiased}button,input,select,textarea{font:inherit}button{touch-action:manipulation}.hidden{display:none!important}
.school-header{background:#fff;border-bottom:1px solid #e4ebf3;position:relative;z-index:20}.school-header__inner{max-width:1120px;margin:auto;padding:13px 18px;display:flex;align-items:center;gap:14px}.school-logo{width:66px;height:66px;border-radius:50%;object-fit:cover;border:2px solid #fff;box-shadow:0 0 0 2px rgba(143,42,143,.15)}.school-brand{display:flex;flex-direction:column}.school-brand strong{font-size:18px;color:var(--navy-deep)}.school-brand>span:last-child{font-size:13px;color:var(--muted)}.system-kicker,.eyebrow{font-size:11px;letter-spacing:.08em;text-transform:uppercase;font-weight:800;color:var(--purple)}
.hero-school{background:linear-gradient(135deg,var(--navy-deep),var(--navy) 65%,#244f87);color:#fff;position:relative;overflow:hidden}.hero-school:after{content:"";position:absolute;width:420px;height:420px;border-radius:50%;right:-170px;top:-210px;background:radial-gradient(circle,rgba(255,255,255,.12),rgba(255,255,255,0) 68%)}.hero-school__content{max-width:1120px;margin:auto;padding:42px 18px 46px;position:relative;z-index:1}.hero-badge{display:inline-flex;padding:6px 12px;border-radius:999px;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.2);font-size:13px;font-weight:700}.hero-school h1{font-size:clamp(27px,4.2vw,44px);line-height:1.3;margin:14px 0 10px;max-width:900px}.hero-school p{font-size:16px;margin:0;opacity:.9}.hero-meta{display:flex;flex-wrap:wrap;gap:10px 18px;margin-top:22px;font-size:13px;color:#eaf2ff}.hero-meta span{display:inline-flex;align-items:center;gap:5px}
.container{max-width:1060px;margin:24px auto;padding:0 16px}.form-container{margin-top:22px}.card{background:var(--card);border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow)}.intro-panel{padding:18px 20px;display:flex;gap:14px;align-items:flex-start;margin-bottom:16px}.intro-panel h2{margin:0 0 3px;font-size:18px;color:var(--navy-deep)}.intro-panel p{margin:0;color:var(--muted);font-size:14px}.intro-icon{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;flex:0 0 auto;background:var(--blue-soft);color:var(--navy);font-weight:900;font-family:Georgia,serif}.notice,.status{border-radius:12px;padding:12px 14px;margin-top:12px;font-size:13px}.notice{background:#fff8e7;color:#7b5700;border:1px solid #f1d992}.status.ok{background:#ecfdf5;color:var(--ok);border:1px solid #a7f3d0}.status.err{background:#fff1f0;color:var(--danger);border:1px solid #fecaca}
.wizard-shell{display:grid;gap:16px}.wizard-progress{padding:16px 18px;position:sticky;top:8px;z-index:12}.wizard-progress__top{display:flex;justify-content:space-between;align-items:flex-end;gap:12px}.wizard-progress__top strong{display:block;color:var(--navy-deep);font-size:16px}.progress-percent{font-weight:800;color:var(--navy)}.progress-track{height:8px;border-radius:99px;background:#e6edf5;margin-top:10px;overflow:hidden}.progress-bar{height:100%;width:12.5%;border-radius:99px;background:linear-gradient(90deg,var(--purple),var(--navy));transition:width .25s ease}.step-dots{display:flex;justify-content:space-between;gap:6px;margin-top:12px}.step-dot{border:0;background:transparent;color:var(--muted);font-size:11px;font-weight:700;padding:0;min-width:0}.step-dot i{display:grid;place-items:center;width:24px;height:24px;margin:auto;border-radius:50%;background:#edf2f7;color:#64748b;font-style:normal}.step-dot.active i{background:var(--navy);color:#fff}.step-dot.done i{background:var(--purple);color:#fff}.step-dot span{display:block;margin-top:3px;max-width:80px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.section{padding:24px;margin-bottom:0}.section-title{display:flex;align-items:flex-start;gap:13px;padding-bottom:18px;margin-bottom:8px;border-bottom:1px solid var(--line)}.section-title>span{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:var(--navy);color:#fff;font-weight:800;flex:0 0 auto;box-shadow:0 7px 16px rgba(23,59,109,.18)}.section-title h2{margin:0;color:var(--navy-deep);font-size:23px}.section-title p{margin:2px 0 0;color:var(--muted);font-size:13px}.grid{display:grid;gap:14px}.grid.two{grid-template-columns:repeat(2,minmax(0,1fr));padding-top:12px}.full{grid-column:1/-1}label{display:flex;flex-direction:column;gap:7px;font-weight:700;font-size:14px;color:#24324a}label b{color:var(--danger)}.optional{font-weight:500;color:var(--muted);font-size:12px;margin-left:3px}
input,select,textarea{width:100%;border:1px solid #cbd7e4;border-radius:12px;padding:12px 13px;background:#fff;color:var(--text);min-height:46px;outline:none;transition:border-color .15s,box-shadow .15s}input:focus,select:focus,textarea:focus{border-color:#6f91bd;box-shadow:0 0 0 3px rgba(23,59,109,.1)}input::placeholder{color:#9aa8b9}.q{padding:16px 0;border-bottom:1px dashed var(--line)}.q:last-child{border-bottom:0}.q-title{font-weight:800;color:#24324a;margin-bottom:10px}.options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.option{display:flex;flex-direction:row;align-items:center;gap:9px;padding:10px 12px;border:1px solid #dce5ef;border-radius:12px;background:#fbfdff;font-weight:500;cursor:pointer}.option:has(input:checked){border-color:#a179aa;background:var(--purple-soft);color:#5f1e65}.option input{width:18px;height:18px;min-height:0;accent-color:var(--purple)}
.location-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;padding-top:12px}.location-card{border:1px solid var(--line);border-radius:16px;padding:18px;background:linear-gradient(180deg,#fff,#fbfdff)}.location-card__icon{width:42px;height:42px;border-radius:12px;display:grid;place-items:center;background:var(--blue-soft);font-size:22px;margin-bottom:10px}.location-card h3{margin:0 0 4px;color:var(--navy-deep)}.location-card>p{margin:0 0 14px;color:var(--muted);font-size:13px}.file-drop{border:2px dashed #b8c8db;border-radius:14px;min-height:154px;display:flex;align-items:center;justify-content:center;text-align:center;padding:18px;cursor:pointer;background:#fff}.file-drop input{position:absolute;opacity:0;pointer-events:none}.file-drop .file-icon{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;background:var(--purple-soft);color:var(--purple);font-size:28px;line-height:1}.file-drop strong{font-size:16px;color:var(--navy)}.file-drop small{font-weight:500;color:var(--muted)}.image-preview{margin-top:12px}.image-preview img,.detail-media img{display:block;width:100%;max-height:440px;object-fit:contain;border:1px solid var(--line);border-radius:12px;background:#f8fafc}.image-preview .small{margin-top:8px}.or-line{display:flex;align-items:center;gap:10px;color:var(--muted);margin:13px 0;font-size:12px}.or-line:before,.or-line:after{content:"";height:1px;background:var(--line);flex:1}.location-btn{width:100%}.hint{font-size:12px!important;color:var(--muted)!important;margin-top:8px!important}.mini-status{border-radius:10px;padding:9px 11px;margin-top:10px;font-size:13px}.mini-status.ok{background:#ecfdf5;color:var(--ok);border:1px solid #a7f3d0}.mini-status.err{background:#fff1f0;color:var(--danger);border:1px solid #fecaca}.privacy-note{margin-top:16px;padding:12px 14px;background:#f0f7ff;border:1px solid #cfe1f5;border-radius:12px;color:#21466e;font-size:13px}.confirm-box{display:flex;gap:13px;align-items:center;background:var(--blue-soft);border:1px solid #d8e7f6;border-radius:14px;padding:14px;margin:14px 0}.confirm-logo img{width:58px;height:58px;border-radius:50%;object-fit:cover}.confirm-box strong{color:var(--navy-deep)}.confirm-box p{margin:2px 0;color:var(--muted);font-size:13px}.consent{flex-direction:row;align-items:flex-start;gap:10px;padding:14px;border:1px solid var(--line);border-radius:14px;background:#fff}.consent input{width:20px;height:20px;min-height:0;margin-top:2px;accent-color:var(--purple)}
.wizard-controls{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px;margin-bottom:0}.wizard-controls__right{display:flex;gap:9px}.primary,.secondary,.ghost{border:0;border-radius:11px;padding:11px 16px;min-height:44px;font-weight:800;cursor:pointer}.primary{background:var(--navy);color:#fff;box-shadow:0 6px 14px rgba(23,59,109,.18)}.primary:hover{background:#102f5b}.primary.success{background:#147d63}.secondary{background:#e9eef4;color:#24324a}.ghost{background:transparent;color:var(--navy)}.wide{width:100%}.small{padding:8px 11px;min-height:36px;font-size:12px}.primary:disabled,.secondary:disabled{opacity:.55;cursor:not-allowed}
.school-footer{max-width:1060px;margin:20px auto 0;padding:24px 16px 40px;color:var(--muted);display:flex;justify-content:center;align-items:center;gap:10px;text-align:left}.school-footer img{width:44px;height:44px;border-radius:50%;object-fit:cover;flex:0 0 auto}.school-footer>div{min-width:0}.school-footer strong,.school-footer__meta{display:block}.school-footer strong{font-size:13px;color:var(--navy-deep)}.school-footer__meta{font-size:12px}.school-footer__year,.school-footer__year [data-academic-year]{display:inline;white-space:nowrap}
/* Admin */
.admin-page{background:#eef3f8}.admin-header{height:78px;background:#fff;border-bottom:1px solid var(--line);padding:10px 22px;display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:30}.admin-brand{display:flex;align-items:center;gap:11px}.admin-brand img{width:55px;height:55px;border-radius:50%;object-fit:cover}.admin-brand div{display:flex;flex-direction:column}.admin-brand span{font-size:11px;color:var(--purple);font-weight:800}.admin-brand strong{color:var(--navy-deep);font-size:16px}.admin-brand small{color:var(--muted)}.admin-logout{border:1px solid var(--line);background:#fff;border-radius:10px;padding:9px 13px;color:#4b5e76;font-weight:700;cursor:pointer}.admin-layout{max-width:1280px;margin:0 auto;padding:24px 18px 48px}.login-card{max-width:520px;margin:48px auto;padding:28px;text-align:center}.login-emblem img{width:92px;height:92px;border-radius:50%;object-fit:cover;box-shadow:0 0 0 5px #f2e7f3}.login-card h1{margin:5px 0 4px;color:var(--navy-deep)}.login-card>p{margin:0 0 18px;color:var(--muted)}.login-form{display:grid;gap:13px;text-align:left}.dashboard-title-row{display:flex;justify-content:space-between;gap:18px;align-items:flex-end;margin-bottom:18px}.dashboard-title-row h1{margin:2px 0 0;font-size:28px;color:var(--navy-deep)}.dashboard-title-row p{margin:3px 0 0;color:var(--muted)}.dashboard-actions{display:flex;gap:9px;flex:0 0 auto}.share-panel{padding:17px 18px;display:grid;grid-template-columns:48px 1fr;gap:14px;margin-bottom:16px;border-left:4px solid var(--purple)}.share-icon{width:46px;height:46px;border-radius:14px;background:var(--purple-soft);display:grid;place-items:center;font-size:23px}.share-copy strong{display:block;color:var(--navy-deep);margin:2px 0 9px}.share-url-row{display:flex;gap:8px}.share-url-row input{min-height:42px;background:#f8fafc;font-size:13px}.share-copy small{display:block;color:var(--muted);margin-top:6px}.stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:16px}.metric{padding:17px;display:flex;align-items:center;gap:13px}.metric-icon{width:48px;height:48px;border-radius:14px;background:var(--blue-soft);display:grid;place-items:center;font-size:23px}.metric.attention .metric-icon{background:#fff5e8}.metric div:last-child{display:flex;flex-direction:column}.metric span{font-size:12px;color:var(--muted)}.metric strong{font-size:30px;line-height:1.15;color:var(--navy-deep)}.metric small{font-size:11px;color:var(--muted)}.dashboard-grid.two-wide{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-bottom:16px}.analytics-card{padding:18px}.card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.card-head h2{margin:1px 0 0;color:var(--navy-deep);font-size:18px}.bar-list{display:grid;gap:10px}.bar-row{display:grid;grid-template-columns:minmax(120px,1fr) 3fr 38px;gap:9px;align-items:center;font-size:12px}.bar-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#42536a}.bar-track{height:9px;border-radius:99px;background:#e8eef5;overflow:hidden}.bar-fill{height:100%;border-radius:99px;background:linear-gradient(90deg,var(--purple),var(--navy))}.bar-value{text-align:right;font-weight:800;color:var(--navy-deep)}.empty-analytics{padding:18px 0;text-align:center;color:var(--muted);font-size:13px}.filter-card{padding:12px;display:grid;grid-template-columns:2fr repeat(3,minmax(140px,.6fr));gap:9px;margin-bottom:16px}.filter-main input{height:100%}.records-card{padding:0;overflow:hidden}.table-card-head{padding:18px 18px 10px;margin:0}.chip{display:inline-flex;border-radius:999px;background:var(--blue-soft);color:var(--navy);padding:5px 10px;font-size:12px;font-weight:800}.table-wrap{overflow:auto}.table-wrap table{width:100%;border-collapse:collapse;min-width:980px}.table-wrap th,.table-wrap td{padding:12px 14px;border-top:1px solid #edf1f5;text-align:left;vertical-align:middle}.table-wrap th{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:#66768c;background:#f8fafc}.student-cell strong{display:block;color:var(--navy-deep)}.student-cell small{color:var(--muted)}.status-pill{display:inline-flex;align-items:center;gap:5px;padding:5px 9px;border-radius:999px;font-size:11px;font-weight:800}.status-pill.ok{background:#ecfdf5;color:#0f766e}.status-pill.warn{background:#fff5e8;color:#945d00}.status-pill.muted{background:#eef2f6;color:#526174}.map-pill{display:inline-flex;gap:5px;align-items:center;color:var(--navy);font-weight:700;font-size:12px}.linkbtn{border:0;background:var(--blue-soft);color:var(--navy);border-radius:9px;padding:7px 10px;font-weight:800;cursor:pointer}
dialog{width:min(960px,95vw);max-height:88vh;border:0;border-radius:18px;padding:0;box-shadow:0 28px 80px rgba(0,0,0,.3)}dialog::backdrop{background:rgba(8,19,34,.62)}.dialog-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:15px 18px;border-bottom:1px solid var(--line);position:sticky;top:0;background:#fff;z-index:2}.dialog-head h2{margin:0;color:var(--navy-deep)}.detail{padding:20px}.detail-hero{display:flex;gap:14px;align-items:center;padding:15px;border-radius:14px;background:var(--blue-soft);margin-bottom:16px}.detail-avatar{width:54px;height:54px;border-radius:50%;display:grid;place-items:center;background:#fff;color:var(--navy);font-weight:900;font-size:20px}.detail-hero h3{margin:0;color:var(--navy-deep)}.detail-hero p{margin:2px 0 0;color:var(--muted);font-size:13px}.detail-media{margin-bottom:18px}.detail-media h3{margin:0 0 8px;color:var(--navy-deep)}.detail-grid{display:grid;grid-template-columns:240px 1fr;gap:0 14px}.detail-grid>div{padding:8px 0;border-bottom:1px dashed #e5e9ef}.detail-grid>div:nth-child(odd){font-weight:800;color:#43546a}.map-link{color:var(--navy);font-weight:800}.toast{position:fixed;right:18px;bottom:18px;background:#18263a;color:#fff;border-radius:12px;padding:11px 15px;box-shadow:0 10px 30px rgba(0,0,0,.2);z-index:50;font-size:13px}
@media(max-width:900px){.stats-grid{grid-template-columns:repeat(2,1fr)}.dashboard-grid.two-wide{grid-template-columns:1fr}.filter-card{grid-template-columns:1fr 1fr}.filter-main{grid-column:1/-1}.dashboard-title-row{align-items:flex-start}.step-dot span{display:none}}
@media(max-width:700px){
 .school-header__inner{padding:10px 14px}.school-logo{width:54px;height:54px}.school-brand strong{font-size:14px}.school-brand>span:last-child{font-size:11px}.hero-school__content{padding:28px 16px 32px}.hero-school h1{font-size:26px}.hero-school p{font-size:14px}.hero-meta{display:grid;gap:6px;margin-top:16px}
 .container{padding:0 12px;margin-top:14px}.intro-panel{padding:14px;border-radius:15px}.wizard-progress{top:6px;padding:12px 14px;border-radius:15px}.step-dots{gap:3px}.step-dot i{width:22px;height:22px}.section{padding:17px 14px;border-radius:16px}.section-title{gap:10px;padding-bottom:14px}.section-title>span{width:34px;height:34px}.section-title h2{font-size:20px}.grid.two,.location-grid{grid-template-columns:1fr}.options{grid-template-columns:1fr}.option{padding:11px 12px}.q{padding:14px 0}input,select{min-height:48px;font-size:16px}.location-card{padding:14px}.file-drop{min-height:145px}
 .wizard-controls{position:sticky;bottom:8px;z-index:15;padding:9px;border-radius:15px;box-shadow:0 12px 34px rgba(15,39,71,.18);align-items:stretch}.wizard-controls__left{display:none}.wizard-controls__right{display:grid;grid-template-columns:1fr 1.45fr;width:100%}.wizard-controls__right .primary,.wizard-controls__right .secondary{width:100%;padding:10px 12px}.school-footer{padding-bottom:92px}
 .admin-header{height:auto;padding:9px 12px}.admin-brand img{width:46px;height:46px}.admin-brand strong{font-size:13px}.admin-brand small{font-size:10px}.admin-brand span{font-size:9px}.admin-logout{font-size:12px;padding:8px 9px}.admin-layout{padding:16px 11px 36px}.login-card{margin:20px auto;padding:20px}.dashboard-title-row{display:block}.dashboard-title-row h1{font-size:23px}.dashboard-actions{margin-top:12px}.share-panel{grid-template-columns:1fr;padding:14px}.share-icon{display:none}.share-url-row{display:grid}.stats-grid{grid-template-columns:1fr 1fr;gap:9px}.metric{padding:13px;gap:9px}.metric-icon{width:40px;height:40px;font-size:19px}.metric strong{font-size:25px}.filter-card{grid-template-columns:1fr}.filter-main{grid-column:auto}.table-card-head{padding:14px}.table-card-head h2{font-size:17px}.bar-row{grid-template-columns:minmax(100px,1fr) 2fr 30px}.detail-grid{grid-template-columns:1fr}.detail-grid>div:nth-child(odd){border-bottom:0;padding-bottom:0;margin-top:6px}.dialog-head{align-items:flex-start}.dialog-head h2{font-size:18px}
}

/* ===== v0.4 : รายชื่อนักเรียน + สถานะส่ง/ยังไม่ส่ง ===== */
.class-link-banner{margin-top:12px;display:inline-flex;align-items:center;gap:7px;padding:8px 11px;border-radius:999px;background:#eef6ff;border:1px solid #cfe1f5;color:#21466e;font-size:12px;font-weight:800}.class-link-banner:before{content:"🔗"}.locked-field{background:#f3f6fa!important;color:#526174!important;border-color:#d8e1eb!important}
.share-picker-row{display:grid;grid-template-columns:repeat(2,minmax(0,220px));gap:8px;margin:0 0 8px}.share-picker-row select{min-height:40px;padding:8px 10px;font-size:13px;background:#fff}
.progress-overview{padding:18px;margin-bottom:16px}.progress-overview__head{display:flex;justify-content:space-between;align-items:flex-end;gap:12px}.progress-overview__head h2{margin:2px 0 0;color:var(--navy-deep);font-size:20px}.progress-overview__head>strong{font-size:32px;line-height:1;color:var(--navy)}.progress-track.big{height:12px;margin-top:14px}.progress-legend{display:flex;flex-wrap:wrap;gap:18px;margin-top:10px;color:var(--muted);font-size:12px}.progress-legend span{display:inline-flex;align-items:center;gap:6px}.legend-dot{width:9px;height:9px;border-radius:50%;display:inline-block}.legend-dot.sent{background:#167d65}.legend-dot.pending{background:#d59b19}
.stats-grid-v04 .pending-metric .metric-icon{background:#fff7df}.stats-grid-v04 .pending-metric strong{color:#8a5e00}
.roster-tools-card{padding:18px;margin-bottom:16px}.roster-tools-head{align-items:flex-start;margin:0}.roster-tools-head h2{font-size:19px}.roster-tools-head p{margin:3px 0 0;color:var(--muted);font-size:13px}.roster-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}.file-button{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;cursor:pointer;margin:0}.filter-card-v04{grid-template-columns:minmax(220px,2fr) repeat(3,minmax(130px,.7fr)) auto}.filter-card-v04>button{min-height:46px}
.status-pill.pending{background:#fff7df;color:#8a5e00}.status-pill.strong{font-weight:900}.pending-row{background:#fffdf7}.pending-row:hover{background:#fff9e9}.unmatched-note{display:block;color:#9a6700!important;margin-top:2px}.row-actions{display:flex;align-items:center;gap:6px;white-space:nowrap}.action-sep{color:#aab5c1}.empty-table{text-align:center!important;color:#64748b;padding:28px!important}
.student-dialog-form{margin:0}.dialog-head.static{position:static}.student-form-body{padding:20px}.student-form-actions{display:grid;grid-template-columns:auto 1fr auto auto;gap:9px;align-items:center;margin-top:20px}.danger{border:0;border-radius:11px;padding:11px 14px;min-height:44px;font-weight:800;cursor:pointer;background:#fff1f0;color:#b42318}.danger:hover{background:#fee4e2}
@media(max-width:1000px){.filter-card-v04{grid-template-columns:1fr 1fr}.filter-card-v04 .filter-main{grid-column:1/-1}.filter-card-v04 #exportPendingBtn{grid-column:1/-1}.roster-tools-head{display:block}.roster-actions{justify-content:flex-start;margin-top:12px}}
@media(max-width:700px){.share-picker-row{grid-template-columns:1fr}.progress-overview__head{align-items:flex-start}.progress-overview__head h2{font-size:17px}.progress-overview__head>strong{font-size:28px}.filter-card-v04{grid-template-columns:1fr}.filter-card-v04 .filter-main,.filter-card-v04 #exportPendingBtn{grid-column:auto}.roster-actions{display:grid;grid-template-columns:1fr}.roster-actions .secondary,.roster-actions .primary,.roster-actions .file-button{width:100%}.student-form-body{padding:15px}.student-form-actions{grid-template-columns:1fr 1fr}.student-form-actions span{display:none}.student-form-actions .danger{grid-column:1/-1;order:3}.student-form-actions .secondary,.student-form-actions .primary{width:100%}}


/* v0.5 classroom settings + teacher review */
.stats-grid-v05{grid-template-columns:repeat(5,minmax(0,1fr))}
.share-picker-row.one{grid-template-columns:minmax(260px,1fr)}
.classroom-card{padding:20px;margin-bottom:16px}.classroom-card-head{align-items:flex-start}.classroom-list{display:grid;gap:10px;margin-top:12px}
.classroom-row{display:grid;grid-template-columns:minmax(160px,1.2fr) minmax(140px,.8fr) auto;gap:12px;align-items:center;padding:14px;border:1px solid var(--line);border-radius:14px;background:#fbfdff}
.classroom-row strong{display:block;color:var(--navy)}.classroom-row small{display:block;color:var(--muted);margin-top:2px}.classroom-row__status{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.classroom-row__actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap}
.classroom-token{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;color:var(--muted)}
.toggle-label{display:flex!important;flex-direction:row!important;align-items:center!important;gap:10px!important;padding:12px;border:1px solid var(--line);border-radius:12px;background:#f8fafc}.toggle-label input{width:auto}
.review-panel{margin:18px 0;padding:16px;border:1px solid #cfe0f2;border-radius:14px;background:#f7fbff}.review-panel__head{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:12px}.review-panel h3{margin:0;color:var(--navy)}.review-grid{display:grid;grid-template-columns:220px 1fr;gap:12px}.review-grid textarea{min-height:96px;resize:vertical}.review-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.status-pill.reviewed{background:#e8f7ef;color:#166534}.status-pill.review-wait{background:#fff7ed;color:#9a3412}.status-pill.teacher-follow{background:#fff1f2;color:#be123c}.print-btn{white-space:nowrap}
.system-ready-badge{display:inline-flex;align-items:center;gap:7px;border-radius:999px;padding:6px 10px;background:#ecfdf5;color:#047857;font-size:12px;font-weight:700}.system-ready-badge.demo{background:#fff7ed;color:#9a3412}
@media(max-width:1100px){.stats-grid-v05{grid-template-columns:repeat(3,minmax(0,1fr))}.classroom-row{grid-template-columns:1fr 1fr}.classroom-row__actions{grid-column:1/-1;justify-content:flex-start}}
@media(max-width:700px){.stats-grid-v05{grid-template-columns:1fr 1fr}.classroom-row{grid-template-columns:1fr}.classroom-row__actions{grid-column:auto}.review-grid{grid-template-columns:1fr}.review-actions{flex-direction:column}.share-picker-row.one{grid-template-columns:1fr}}
@media(max-width:420px){.stats-grid-v05{grid-template-columns:1fr}}


/* v0.6 go-live readiness + receipt */
.go-live-panel{display:flex;justify-content:space-between;align-items:center;gap:18px;padding:18px 20px;margin-bottom:16px;border-left:5px solid #2b6cb0}.go-live-panel h2{margin:2px 0 3px;color:var(--navy-deep);font-size:20px}.go-live-panel p{margin:0;color:var(--muted);font-size:13px}.go-live-side{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}.system-dialog{width:min(760px,94vw)}.system-check-body{padding:18px 20px}.system-check-list{display:grid;gap:9px;margin:14px 0}.system-check-item{display:grid;grid-template-columns:34px 1fr;gap:10px;align-items:center;border:1px solid var(--line);border-radius:12px;padding:11px;background:#fff}.system-check-item i{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;font-style:normal;font-weight:900}.system-check-item strong{display:block}.system-check-item small{display:block;color:var(--muted);margin-top:1px}.system-check-item.ok i{background:#e8f7ef;color:#166534}.system-check-item.warn i{background:#fff7ed;color:#9a3412}.system-check-item.bad i{background:#fff1f2;color:#be123c}.system-check-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}.receipt-box{display:flex;align-items:center;gap:12px;background:#ecfdf5;border:1px solid #a7f3d0;color:#065f46;border-radius:14px;padding:14px 16px;margin:14px 0 26px}.receipt-icon{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:#059669;color:#fff;font-size:24px;font-weight:900}.receipt-box strong{display:block;font-size:16px}.receipt-box p{margin:2px 0}.receipt-box small{font-weight:800}.share-url-row{grid-template-columns:minmax(0,1fr) auto auto}
@media(max-width:700px){.go-live-panel{display:block}.go-live-side{justify-content:flex-start;margin-top:12px}.system-check-actions{flex-direction:column}.share-url-row{grid-template-columns:1fr 1fr}.share-url-row input{grid-column:1/-1}}

.setup-wizard{max-width:850px;margin:28px auto;padding:24px}.setup-wizard h1{color:var(--navy-deep);margin:4px 0 6px}.setup-wizard>p{color:var(--muted)}.setup-actions{display:flex;justify-content:flex-end;gap:10px;margin:18px 0}.setup-wizard code{background:#eef3f8;padding:2px 5px;border-radius:5px}@media(max-width:700px){.setup-actions{flex-direction:column}}


/* ===== v0.9.2 : Login UX / password recovery ===== */
.password-field{position:relative;width:100%}
.password-field input{padding-right:52px}
.password-toggle{position:absolute;right:7px;top:50%;transform:translateY(-50%);width:38px;height:38px;min-height:0;padding:0;border:0;border-radius:10px;background:transparent;color:var(--navy);display:grid;place-items:center;cursor:pointer;font-size:18px}
.password-toggle:hover{background:var(--blue-soft)}
.password-toggle:focus-visible{outline:2px solid #6f91bd;outline-offset:2px}
.login-help-row{display:flex;justify-content:flex-end;margin-top:-4px}
.text-link{border:0;background:transparent;color:var(--navy);font-weight:800;padding:3px 0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}
.text-link:hover{color:var(--purple)}
.reset-card{max-width:520px;margin:48px auto;padding:28px;text-align:center}
.reset-card h1{margin:5px 0 4px;color:var(--navy-deep)}
.reset-card>p{margin:0 0 18px;color:var(--muted)}
.reset-form{display:grid;gap:13px;text-align:left}
.reset-actions{display:grid;gap:9px;margin-top:4px}
@media(max-width:700px){.reset-card{margin:20px auto;padding:20px}}


/* ===== v0.9.4 : Photo library + clear test submission ===== */
.image-source-panel{border:2px dashed #b8c8db;border-radius:14px;padding:16px;background:#fff}
.image-source-intro{display:flex;align-items:center;gap:11px;margin-bottom:13px}
.image-source-intro .file-icon{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;flex:0 0 auto;background:var(--purple-soft);color:var(--purple);font-size:28px;line-height:1}
.image-source-intro strong{display:block;color:var(--navy);font-size:16px}
.image-source-intro small{display:block;color:var(--muted);font-weight:500}
.image-source-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.image-source-btn{min-height:72px;border:1px solid #cbd7e4;border-radius:12px;background:#f8fbff;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:8px;padding:12px;cursor:pointer;text-align:center;color:var(--navy-deep)}
.image-source-btn:hover{border-color:#7b9bc0;background:#f1f7ff}
.image-source-btn.album-btn{background:#f5f8ff;border-color:#bfcfe2}
.image-source-btn.camera-btn{background:#fff8f4;border-color:#efd2c4}
.image-source-btn input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.image-source-btn>span{font-size:22px}
.image-source-btn strong{font-size:14px}
.image-source-hint{margin-bottom:0!important}
.danger-link{color:#b42318!important}
.danger-link:hover{background:#fff1f0!important}
@media(max-width:700px){.image-source-actions{grid-template-columns:1fr}.image-source-btn{min-height:64px}}


/* ===== v0.9.5 : chronic disease + “other” detail fields ===== */
.conditional-detail{
  display:block;
  margin-top:12px;
  padding:12px 14px;
  border:1px solid #cbd8e6;
  border-radius:12px;
  background:#f8fbff;
  color:var(--navy-deep);
  font-weight:800;
}
.conditional-detail.hidden{display:none!important}
.conditional-detail input{
  width:100%;
  margin-top:8px;
  background:#fff;
}
.q .conditional-detail{
  margin-left:0;
  margin-right:0;
}
@media(max-width:700px){
  .conditional-detail{padding:11px}
}


/* ===== v0.9.6 : Dashboard table hierarchy / no-wrap data ===== */

/* ใช้พื้นที่จอ Desktop มากขึ้นเพื่อให้ข้อมูลจริงอ่านง่าย */
@media (min-width:1100px){
  .admin-layout{
    max-width:1660px;
    padding-left:24px;
    padding-right:24px;
  }
}

/* ตารางข้อมูลนักเรียน: ให้พื้นที่กับข้อมูล มากกว่าเครื่องมือ */
.student-status-table{
  width:100%;
  min-width:1390px!important;
  border-collapse:collapse;
  table-layout:auto;
}

.student-status-table col.col-student{width:25%}
.student-status-table col.col-class{width:7%}
.student-status-table col.col-submit{width:9%}
.student-status-table col.col-guardian{width:17%}
.student-status-table col.col-location{width:9%}
.student-status-table col.col-care{width:12%}
.student-status-table col.col-review{width:10%}
.student-status-table col.col-updated{width:9%}
.student-status-table col.col-actions{width:2%}

/* รักษาข้อความข้อมูลหลักให้อยู่ในบรรทัดเดียว */
.student-status-table th,
.student-status-table td{
  white-space:nowrap;
  padding:13px 12px;
}

.student-status-table th{
  font-size:11px;
  letter-spacing:0;
  text-transform:none;
  font-weight:800;
}

.student-status-table .student-data{
  min-width:260px;
}

.student-status-table .student-cell strong{
  display:block;
  white-space:nowrap;
  overflow:visible;
  text-overflow:clip;
  font-size:14px;
  line-height:1.35;
}

.student-status-table .student-cell small{
  display:block;
  white-space:nowrap;
  margin-top:3px;
}

.student-status-table .guardian-data{
  min-width:190px;
}

.student-status-table .guardian-data .student-cell strong,
.student-status-table .guardian-data .student-cell small{
  white-space:nowrap;
}

.student-status-table .class-data,
.student-status-table .submit-data,
.student-status-table .location-data,
.student-status-table .care-data,
.student-status-table .review-data,
.student-status-table .updated-data{
  vertical-align:middle;
}

.student-status-table .updated-data{
  min-width:125px;
}

.student-status-table .status-pill,
.student-status-table .map-pill{
  white-space:nowrap;
}

/* คอลัมน์เครื่องมือให้เล็กที่สุด และรวม 3 ปุ่มไว้ในเมนูเดียว */
.student-status-table .tools-head,
.student-status-table .tools-data{
  width:1%;
  min-width:88px;
  text-align:right;
}

.row-menu{
  position:relative;
  display:inline-block;
}

.row-menu>summary{
  list-style:none;
  cursor:pointer;
  user-select:none;
  white-space:nowrap;
  border:1px solid #d6e1ec;
  background:#f5f8fc;
  color:var(--navy);
  border-radius:9px;
  padding:7px 10px;
  font-size:12px;
  font-weight:800;
}

.row-menu>summary::-webkit-details-marker{display:none}
.row-menu>summary::after{content:" ▾";font-size:10px;color:#718096}

.row-menu[open]>summary{
  background:var(--blue-soft);
  border-color:#b9cde2;
}

.row-menu-panel{
  position:absolute;
  right:0;
  top:calc(100% + 6px);
  z-index:25;
  min-width:168px;
  padding:6px;
  border:1px solid #d8e2ec;
  border-radius:11px;
  background:#fff;
  box-shadow:0 14px 36px rgba(19,41,68,.18);
}

.row-menu-item{
  width:100%;
  border:0;
  background:transparent;
  color:var(--navy);
  border-radius:8px;
  padding:9px 10px;
  text-align:left;
  white-space:nowrap;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}

.row-menu-item:hover{background:#f1f6fb}

/* ให้แถวอ่านเป็นแนวเดียวกันและสมมาตรมากขึ้น */
.student-status-table tbody tr{
  min-height:70px;
}

.student-status-table tbody td{
  height:70px;
}

/* บนจอแคบ ให้เลื่อนแนวนอนแทนการบีบจนชื่อ/ข้อมูลแตกบรรทัด */
@media(max-width:1099px){
  .student-status-table{
    min-width:1390px!important;
  }
  .table-wrap{
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }
}


/* ===== v0.9.7 : Fixed action menu outside table overflow ===== */

/*
  v0.9.6 ใช้ dropdown แบบ absolute ภายใน .table-wrap (overflow:auto)
  ทำให้เมนูถูกตัดตามขอบ scroll container
  v0.9.7 ย้ายเมนูจริงไปเป็น fixed portal ที่ body
*/
.row-menu-trigger{
  border:1px solid #d6e1ec;
  background:#f5f8fc;
  color:var(--navy);
  border-radius:9px;
  padding:7px 10px;
  min-width:74px;
  white-space:nowrap;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}

.row-menu-trigger:hover,
.row-menu-trigger[aria-expanded="true"]{
  background:var(--blue-soft);
  border-color:#b9cde2;
}

.row-menu-trigger span{
  font-size:10px;
  color:#718096;
  margin-left:2px;
}

.row-action-menu{
  position:fixed;
  z-index:9999;
  width:188px;
  padding:6px;
  border:1px solid #d8e2ec;
  border-radius:11px;
  background:#fff;
  box-shadow:0 16px 42px rgba(19,41,68,.24);
}

.row-action-menu.hidden{
  display:none!important;
}

.row-action-item{
  display:block;
  width:100%;
  border:0;
  background:transparent;
  color:var(--navy);
  border-radius:8px;
  padding:10px 11px;
  text-align:left;
  white-space:nowrap;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}

.row-action-item:hover{
  background:#f1f6fb;
}

.row-action-item.danger-link{
  color:#b42318!important;
}

.row-action-item.danger-link:hover{
  background:#fff1f0!important;
}

/* CSS เก่าของ details ไม่ให้มีผลกับเมนูรุ่นใหม่ */
.student-status-table .tools-data{
  overflow:visible;
}


/* ===== v1.0 : PWA desktop installation ===== */
.admin-install-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:auto;
}

.install-app-btn{
  border:1px solid #b6c9df;
  background:#eef5fc;
  color:var(--navy);
  border-radius:11px;
  padding:10px 14px;
  min-height:42px;
  white-space:nowrap;
  font-weight:800;
  cursor:pointer;
  box-shadow:0 4px 14px rgba(23,59,109,.08);
}

.install-app-btn:hover{
  background:#e2eef9;
  border-color:#91aecf;
}

.install-app-btn.installed{
  background:#eaf8f0;
  border-color:#b9dec8;
  color:#17653b;
}

.install-app-hint{
  display:none;
  max-width:220px;
  color:var(--muted);
  font-size:11px;
  line-height:1.35;
}

@media(min-width:1180px){
  .admin-install-wrap:hover .install-app-hint{
    display:block;
  }
}

@media(max-width:780px){
  .admin-install-wrap{
    margin-left:0;
  }
  .install-app-btn{
    padding:9px 11px;
    min-height:40px;
    font-size:12px;
  }
}
