/* =========================================================
   STYLE.CSS — Cleaned & Enforced Input BG (Light Blue)
   ---------------------------------------------------------
   1) Design tokens
   2) Base + Background
   3) Typography
   4) Layout & Cards
   5) Buttons (โทนเดียวทั้งเว็บ)
   6) Links
   7) Tables
   8) Utilities
   9) Footer (CSS-only)
   10) Forms (รวมทุกกรณี + Autofill)  ← ย้ายไว้ท้ายสุด & เพิ่มความเฉพาะเจาะจง
   11) Responsive
   ======================================================= */

/* ---------- 1) Design tokens ---------- */
:root{
  --c-bg:        #f4f8ff;
  --c-bg-muted:  #eef4fb;
  --c-card:      #ffffff;
  --c-border:    #e8eef7;

  --c-text:      #0b2a4a;
  --c-muted:     #6c88a3;

  --btn-from:    #2FA1FF;
  --btn-to:      #0B84FF;
  --btn-border:  rgba(255,255,255,.45);

  --radius-lg:   18px;
  --radius-md:   12px;
  --shadow-sm:   0 6px 18px rgba(30,161,255,.18);
  --shadow-card: 0 10px 30px rgba(28, 98, 174, .12);

  /* ฟอร์ม */
  --form-max:        560px;
  --input-height:    56px;
  --input-fz:        20px;
  --input-bg:        #f2f8ff;  /* ปกติ */
  --input-bg-focus:  #eaf4ff;  /* โฟกัส */
  --input-bd:        #d6e7ff;
  --input-bd-focus:  #2FA1FF;
}

/* ---------- 2) Base + Background (เข้มบน → อ่อนล่าง) ---------- */
html, body{ height:100%; }
*{ box-sizing: border-box; }

body{
  font-family: system-ui, Segoe UI, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  margin: 0;
  color: var(--c-text);
  background: var(--c-bg);
}
body::before{
  content:"";
  position: fixed;
  inset: 0 0 auto 0;
  height: 100vh;
  pointer-events: none;
  z-index: -1;
  background: linear-gradient(180deg, #006CD1 0%, #3BA8FF 45%, #BFE9FF 100%);
}

/* ---------- 3) Typography ---------- */
h1, h2, h3{ margin:10px 0; font-weight:800; }
h1{
  font-size: clamp(28px, 4vw, 44px);
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.12);
}
h1::after{
  content: "โรงเรียนเจริญศิลป์ศึกษา “โพธิ์คำอนุสรณ์”";
  display: block;
  margin-top: 6px;
  font-size: clamp(14px, 1.7vw, 18px);
  font-weight: 600;
  letter-spacing: .3px;
  color: rgba(255,255,255,.96);
  text-align: center;
}
h2{ font-size: clamp(18px, 4vw, 28px); }

/* ---------- 4) Layout & Cards ---------- */
.container{
  max-width: 1200px;
  width: min(1200px, 90vw);
  margin-inline: auto;
  padding: 0 16px 80px;
}
.card{
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin: 14px auto;
  max-width: min(1200px, 90vw);
  box-shadow: var(--shadow-card);
}
.cards{ display: grid; gap: 14px; }
@media (min-width: 960px){
  .cards{ grid-template-columns: repeat(3, 1fr); align-items: start; }
  .cards > .card{ height: 100%; }
}
.results-shell{
  background: var(--c-bg-muted);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  max-width: min(1200px, 90vw);
  margin: 14px auto;
}
.results-shell > .cards{ margin-top: 8px; }

/* ---------- 5) Buttons (โทนเดียวทั้งเว็บ) ---------- */
.btn, button, a.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border: 1px solid var(--btn-border);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--btn-from) 0%, var(--btn-to) 100%);
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 750;
  letter-spacing: .3px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .09s ease, box-shadow .2s ease, filter .2s ease, opacity .2s ease;
  user-select: none;
}
.btn:hover{  filter: brightness(1.07); }
.btn:active{ transform: translateY(1px); }
.card .btn, header .btn{
  padding: 12px 18px;
  width: auto;
  border-radius: 12px;
  font-size: 16px;
}
.menu{
  display: grid;
  gap: 16px;
  margin: 0 auto;
  width: min(480px, 92vw);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow-card);
}
.menu .btn{
  width: 100%;
  min-height: 64px;
  padding: 22px 24px;
  border-radius: 22px;
  font-size: clamp(22px, 2.4vw, 26px);
  font-weight: 800;
}

/* ---------- 6) Links ---------- */
a{
  color: #1a6fe0;
  text-decoration: none;
  transition: color .2s ease, box-shadow .2s ease, background-size .2s ease;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 2px;
}
a:hover{
  color: #0c56b7;
  background-size: 100% 2px;
}

/* ---------- 7) Tables ---------- */
.table{ width: 100%; border-collapse: collapse; }
.table th, .table td{
  border: 1px solid #e7eef8;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}
.table thead th{ background: #f7fbff; }

/* ---------- 8) Utilities ---------- */
.row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #eaf2fb;
}
.muted{ color: var(--c-muted); }
.tiny { font-size: 12px; }
.ok   { color: #0aa36b; }
.error{ color: #c33; }
.picker .row{ justify-content: flex-start !important; gap: 12px; text-align: left; }
.picker .row > span{ margin: 0; flex: 0 1 auto; }
.picker .pickStatus{ margin-top: 12px !important; }
.card .cardStatus{ display: block; margin-top: 12px; line-height: 1.4; }
.cardStatus:empty{ display: none; }

/* ---------- 9) Footer (CSS-only) ---------- */
body::after{
  content: "พัฒนาโดย นายวรวิทย์ ไชยวงศ์คต";
  position: fixed;
  left: 0; right: 0; bottom: 14px;
  text-align: center;
  font-size: 13px;
  color: #4a6b8f;
  opacity: .9;
  z-index: 100;
  pointer-events: none;
}

/* ---------- 10) Forms (รวมทุกกรณี + Autofill) ---------- */
/* ฟอร์มซ้อนในการ์ด (จัดกลาง + คุมความกว้าง) */
.card:has(> form) > form{
  max-width: var(--form-max);
  width: 100%;
  margin: 0 auto;
  padding: 18px 20px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 14px;
  justify-items: stretch;
}
/* กลุ่ม label/field */
.card > form :is(label, .field){
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  color: var(--c-text);
}

/* ★★ บังคับ “พื้นหลังฟ้าอ่อน” ด้วยความเฉพาะเจาะจงสูง + important ★★ */
:where(body) :where(.card, #verifyCard) :where(
  input:not([type="submit"]):not([type="button"]),
  select,
  textarea
){
  width: 100%;
  min-height: var(--input-height);
  padding: 14px 16px;
  font-size: var(--input-fz);
  color: var(--c-text);
  border: 1px solid var(--input-bd);
  border-radius: 14px;
  background: var(--input-bg) !important;     /* กันสไตล์เก่าทับ */
  background-clip: padding-box;
  outline: none;
  transition: box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
}

/* โฟกัส */
:where(body) :where(.card, #verifyCard) :where(
  input:not([type="submit"]):not([type="button"]):focus,
  select:focus,
  textarea:focus
){
  border-color: var(--input-bd-focus);
  background: var(--input-bg-focus) !important;
  box-shadow: 0 0 0 3px rgba(31,161,255,.18);
}

/* Placeholder */
:where(.card, #verifyCard) input::placeholder,
:where(.card, #verifyCard) textarea::placeholder{
  font-size: calc(var(--input-fz) - 2px);
  color: #8aa7c7;
}

/* ปุ่มในฟอร์มจัดกลาง */
.card > form .btn{
  justify-self: center;
  min-width: 220px;
  padding: 14px 24px;
  border-radius: 16px;
  font-size: 18px;
}
.form-actions{
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

/* Autofill ให้ยังคงฟ้าอ่อน */
:where(.card, #verifyCard) input:-webkit-autofill,
:where(.card, #verifyCard) select:-webkit-autofill,
:where(.card, #verifyCard) textarea:-webkit-autofill{
  -webkit-text-fill-color: var(--c-text);
  -webkit-box-shadow: 0 0 0px 1000px var(--input-bg) inset;
  box-shadow: 0 0 0px 1000px var(--input-bg) inset;
  transition: background-color 0s;
}
:where(.card, #verifyCard) input:-webkit-autofill:focus,
:where(.card, #verifyCard) select:-webkit-autofill:focus,
:where(.card, #verifyCard) textarea:-webkit-autofill:focus{
  -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-focus) inset, 0 0 0 3px rgba(31,161,255,.18);
  box-shadow: 0 0 0px 1000px var(--input-bg-focus) inset, 0 0 0 3px rgba(31,161,255,.18);
}

/* ---------- 11) Responsive ---------- */
@media (max-width: 600px){
  .container,
  .card,
  .results-shell{ max-width: 92vw; }
  .btn, button, a.btn { padding: 14px 18px; }
  .menu{ gap: 12px; width: min(520px, 94vw); }
  :root{ --form-max: 92vw; }
}


/* --- Card status banner --- */
:root{
  --ok-grad-from:#22c55e; --ok-grad-to:#16a34a;   /* เขียว */
  --warn-grad-from:#f97316; --warn-grad-to:#ef4444;/* ส้ม→แดง */
  --neutral:#94a3b8;                                 /* เทา (ปิดรับ) */
}

.status-banner{
  margin: 8px 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
  color: #fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.status-ok{
  background: linear-gradient(180deg,var(--ok-grad-from),var(--ok-grad-to));
}
.status-warn{
  background: linear-gradient(180deg,var(--warn-grad-from),var(--warn-grad-to));
}
.status-closed{
  background: var(--neutral);
}
.status-banner .sub{
  font-weight:600;
  opacity:.95;
  font-size: 14px;
}

/* หัวข้อการ์ดให้จัดวางชิปได้สวย */
.card h3{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:0;
}

/* ชิปสถานะเล็ก ๆ */
.status-chip{
  margin-left:auto;
  padding:6px 10px;
  border-radius:999px;
  font-size:14px;
  font-weight:800;
  line-height:1;
  color:#fff;
  box-shadow:0 6px 18px rgba(0,0,0,.10);
  white-space:nowrap;
}
.status-chip.is-ok{
  background:linear-gradient(180deg,#22c55e,#16a34a);
}
.status-chip.is-warn{
  background:linear-gradient(180deg,#f97316,#ef4444);
}
.status-chip.is-closed{
  background:linear-gradient(180deg,#9ca3af,#6b7280);
}

/* ชื่อกิจกรรมบนหน้า results รายกิจกรรม */
/* ชื่อกิจกรรม + ครูผู้สอน ในหน้ารายกิจกรรม */
.result-title{
  margin: 0 0 4px;
  font-weight: 800;
  font-size: clamp(24px, 5vw, 36px);
  letter-spacing: .2px;
}

.result-subtitle{
  margin: 2px 0 10px;
  font-weight: 700;                          /* เด่นรองลงมา */
  font-size: clamp(16px, 2.6vw, 22px);       /* เล็กกว่าหัวเรื่อง */
  color: var(--c-text);
  opacity: .95;
}

/* เน้นชื่อครูเล็กน้อย */
.result-teacher{
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(47,161,255,.12);          /* ฟ้าอ่อนเข้าธีม */
  border: 1px solid rgba(47,161,255,.25);
}

/* =========================================================
   STYLE.CSS — Cleaned & Enforced Input BG (Light Blue)
   (คงเนื้อหาเดิมทั้งหมดของคุณไว้ แล้วเพิ่มส่วน print ด้านล่าง)
   ======================================================= */

/* ... [คงทุกบล็อคตามไฟล์ที่คุณส่งมา — ไม่ตัดอะไรออก] ... */

/* ---------- 11) Responsive ---------- */
@media (max-width: 600px){
  .container,
  .card,
  .results-shell{ max-width: 92vw; }
  .btn, button, a.btn { padding: 14px 18px; }
  .menu{ gap: 12px; width: min(520px, 94vw); }
  :root{ --form-max: 92vw; }
}

/* --- Card status banner --- */
:root{
  --ok-grad-from:#22c55e; --ok-grad-to:#16a34a;
  --warn-grad-from:#f97316; --warn-grad-to:#ef4444;
  --neutral:#94a3b8;
}
.status-banner{
  margin: 8px 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
  color: #fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.status-ok{     background: linear-gradient(180deg,var(--ok-grad-from),var(--ok-grad-to)); }
.status-warn{   background: linear-gradient(180deg,var(--warn-grad-from),var(--warn-grad-to)); }
.status-closed{ background: var(--neutral); }
.status-banner .sub{ font-weight:600; opacity:.95; font-size: 14px; }

.card h3{ display:flex; align-items:center; gap:10px; margin-top:0; }

/* ชิปสถานะเล็ก ๆ */
.status-chip{
  margin-left:auto; padding:6px 10px; border-radius:999px;
  font-size:14px; font-weight:800; line-height:1; color:#fff;
  box-shadow:0 6px 18px rgba(0,0,0,.10); white-space:nowrap;
}
.status-chip.is-ok{    background:linear-gradient(180deg,#22c55e,#16a34a); }
.status-chip.is-warn{  background:linear-gradient(180deg,#f97316,#ef4444); }
.status-chip.is-closed{background:linear-gradient(180deg,#9ca3af,#6b7280); }

/* ชื่อกิจกรรม + ครูผู้สอน ในหน้ารายกิจกรรม */
.result-title{
  margin: 0 0 4px;
  font-weight: 800;
  font-size: clamp(24px, 5vw, 36px);
  letter-spacing: .2px;
}
.result-subtitle{
  margin: 2px 0 10px;
  font-weight: 700;
  font-size: clamp(16px, 2.6vw, 22px);
  color: var(--c-text);
  opacity: .95;
}
/* เน้นชื่อครูเล็กน้อย */
.result-teacher{
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(47,161,255,.12);
  border: 1px solid rgba(47,161,255,.25);
}

/* ---------- Print basics ---------- */
@media print{
  body{ background: #fff !important; }
  body::before, body::after{ display: none !important; }
  a{ text-decoration: none !important; }
  #backBtn, .btn, .toolbar, nav, header.card, .menu { display: none !important; }
  .results-shell{ background: #fff !important; border: none !important; }
  .card{ box-shadow: none !important; border: 0 !important; }
  .table th, .table td{ border-color: #666 !important; }
  thead { display: table-header-group; } /* หัวตารางขึ้นทุกหน้า */
}

/* ปุ่มพิมพ์/ดาวน์โหลด PDF ให้แสดงเด่นบนมือถือ */
.print-actions{
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin: 8px 0 6px;
}
.print-actions .btn{
  /* ให้ปุ่มเตะตาพอ ๆ กับปุ่มหลัก */
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 750;
  font-size: 16px;
  line-height: 1.2;
}
@media (max-width: 600px){
  .print-actions{ justify-content: stretch; }
  .print-actions .btn{ width: 100%; } /* มือถือให้ปุ่มกินเต็มบรรทัด */
}
