/* ระบบเช็คการเข้าใช้งานห้องสมุด — ธีมม่วงกลีบบัวพาสเทล ตัดทองคำ (Royal Violet & Soft Lavender with Gold) */

:root {
  --bg: #faf7fd;
  --surface: #ffffff;
  --ink: #2b1d3a;
  --muted: #6f5c82;
  --line: #eadff5;
  --line-strong: #d7c3eb;
  --brand: #7e22ce;
  --brand-light: #a855f7;
  --brand-dark: #581c87;
  --brand-soft: #f5edfd;
  --accent: #d49617;
  --accent-dark: #9e6c08;
  --danger: #c83e4d;
  --danger-soft: #fdebed;
  --ok: #267c52;
  --ok-soft: #e6f6ee;
  --warn: #9a6408;
  --warn-soft: #fef4dc;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(88, 28, 135, 0.06), 0 1px 3px rgba(88, 28, 135, 0.04);
  --shadow-3d: 0 22px 55px rgba(74, 34, 112, 0.28), 0 8px 22px rgba(45, 20, 75, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Sarabun", "Noto Sans Thai", "Leelawadee UI", "Tahoma", "Segoe UI", system-ui, sans-serif;
  line-height: 1.6;
}
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5rem; color: var(--ink); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; margin-top: 1.2rem; }
p { margin: 0 0 .75rem; }
a { color: var(--brand-dark); transition: color .2s ease; }
a:hover { color: var(--brand); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
code { background: var(--brand-soft); color: var(--brand-dark); padding: .1rem .4rem; border-radius: 6px; font-size: .92em; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .88rem; margin: .6rem 0 0; }
.note { background: var(--warn-soft); border-radius: 10px; padding: .6rem .85rem; margin-top: .8rem; }
.empty { color: var(--muted); padding: 1.2rem 0; text-align: center; }

/* ---------- โครงหน้า ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 1.4rem 1.2rem 3rem; }

body.no-nav {
  background-color: #d6aaf5;
  min-height: 100vh;
}
body.no-nav .container {
  max-width: 1380px;
  padding: 1rem 5vw;
}

.topbar {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  background: linear-gradient(135deg, #4c1d95 0%, #7e22ce 55%, #581c87 100%);
  color: #fff; padding: .6rem 1.2rem;
  box-shadow: 0 3px 16px rgba(76, 29, 149, 0.25), inset 0 -1px 0 rgba(253, 224, 71, 0.35);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; text-shadow: 0 1px 2px rgba(25, 8, 50, .3); }
.brand:hover { color: #fef08a; }
.nav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.nav a {
  color: #f3e8ff; text-decoration: none; padding: .45rem .9rem; border-radius: 10px;
  font-size: .97rem; transition: all .2s ease;
}
.nav a:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.nav a.active {
  background: rgba(255, 255, 255, .2); color: #fff; font-weight: 600;
  box-shadow: inset 0 -3px 0 #fcd34d;
}
.usermenu { display: flex; align-items: center; gap: .7rem; }
.who { color: #fff; text-decoration: none; display: flex; flex-direction: column; line-height: 1.25; text-align: right; font-size: .95rem; }
.who:hover { color: #fef9c3; }
.who small { color: #e9d5ff; font-size: .78rem; }

.page-title { margin-bottom: 1rem; }
.page-title p { margin: 0; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem 1.35rem; margin-bottom: 1.1rem;
}
.card.narrow { max-width: 640px; margin: 2rem auto; }
.card.narrow-left { max-width: 720px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.danger-zone { border-color: #f3c2c8; background: #fff9fa; }

.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; font-size: .95rem; }
.alert-success { background: var(--ok-soft); border-color: #b5e2cc; color: #1d5e3e; }
.alert-error { background: var(--danger-soft); border-color: #f3c0c6; color: #962734; }
.alert-info { background: var(--brand-soft); border-color: #dcc2f5; color: var(--brand-dark); }

/* ---------- ปุ่มกดมีมิติและเอฟเฟกต์เงาสะท้อน (Glossy 3D Violet & Gold) ---------- */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .62rem 1.25rem;
  background: linear-gradient(180deg, #9333ea 0%, #7e22ce 52%, #581c87 100%);
  color: #ffffff;
  border: 1px solid #4c1d95;
  border-radius: 10px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.4;
  text-shadow: 0 1px 2px rgba(25, 8, 50, 0.4);
  box-shadow:
    0 5px 14px rgba(126, 34, 206, 0.3),
    0 2px 4px rgba(45, 15, 80, 0.2),
    inset 0 1.5px 1px rgba(243, 232, 255, 0.65),
    inset 0 -1.5px 2px rgba(45, 15, 80, 0.4);
  transition: transform .16s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease, filter .2s ease;
  user-select: none;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 48%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.05) 100%);
  pointer-events: none;
}

.btn::after {
  content: "";
  position: absolute;
  top: 0; left: -110%; width: 65%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  transform: skewX(-24deg);
  transition: left .55s ease;
  pointer-events: none;
}
.btn:hover::after {
  left: 155%;
}

.btn:hover {
  background: linear-gradient(180deg, #a855f7 0%, #9333ea 52%, #6b21a8 100%);
  border-color: #581c87;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow:
    0 8px 20px rgba(126, 34, 206, 0.4),
    0 3px 6px rgba(45, 15, 80, 0.25),
    inset 0 1.5px 1px rgba(243, 232, 255, 0.8),
    inset 0 -1.5px 2px rgba(45, 15, 80, 0.4);
}

.btn:active {
  transform: translateY(1.5px) scale(0.985);
  box-shadow:
    0 2px 5px rgba(88, 28, 135, 0.3),
    inset 0 2px 5px rgba(35, 10, 65, 0.4);
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn:disabled::after { display: none; }

.btn-login {
  margin-top: .5rem;
  padding: .75rem 1.2rem;
  font-size: 1.05rem;
  border-radius: 10px;
}

.btn-ghost {
  background: #fff;
  color: var(--brand-dark);
  border-color: var(--line-strong);
  font-weight: 600;
  text-shadow: none;
  box-shadow: 0 2px 6px rgba(88, 28, 135, 0.07);
}
.btn-ghost::before, .btn-ghost::after { display: none; }
.btn-ghost:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(126, 34, 206, 0.16);
}
.btn-ghost:active {
  transform: translateY(1px) scale(0.985);
  box-shadow: inset 0 1px 3px rgba(88, 28, 135, 0.16);
}

.topbar .btn-ghost {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-color: rgba(253, 224, 71, .5);
  box-shadow: none;
}
.topbar .btn-ghost:hover {
  background: rgba(255, 255, 255, .24);
  border-color: #fde047;
  color: #fff;
}

.btn-sm { padding: .35rem .75rem; font-size: .9rem; border-radius: 8px; }
.btn-lg { padding: .85rem 1.7rem; font-size: 1.1rem; border-radius: 12px; }
.btn-block { width: 100%; }

.btn-danger {
  background: linear-gradient(180deg, #e05868 0%, var(--danger) 100%);
  color: #fff;
  border-color: #a62b38;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
  box-shadow: 0 4px 12px rgba(200, 62, 77, 0.28), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn-danger:hover {
  background: linear-gradient(180deg, #ea6575 0%, #b53240 100%);
  border-color: #94222e;
  color: #fff;
  box-shadow: 0 7px 16px rgba(200, 62, 77, 0.36);
}

.btn-link {
  background: none; border: 0; padding: .15rem .4rem; color: var(--brand-dark);
  cursor: pointer; font: inherit; text-decoration: underline; border-radius: 6px;
  transition: background .15s ease, color .15s ease;
}
.btn-link:hover { background: var(--brand-soft); color: var(--brand); }
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { background: var(--danger-soft); }
.btn:focus-visible, .btn-link:focus-visible, .tab:focus-visible { outline: 3px solid rgba(126, 34, 206, .38); outline-offset: 2px; }

/* ---------- ฟอร์ม ---------- */
input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], select {
  width: 100%; padding: .62rem .85rem; border: 1.5px solid var(--line-strong); border-radius: 10px;
  font: inherit; background: #fff; color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(88, 28, 135, 0.04);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
input::placeholder { color: #ad9ec0; }
input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(126, 34, 206, .18), inset 0 1px 2px rgba(88, 28, 135, 0.04);
}
input[type=file] { font: inherit; max-width: 100%; }
.form label { display: block; margin-bottom: 1rem; font-weight: 600; font-size: .94rem; color: var(--ink); }
.form label input, .form label select { margin-top: .35rem; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
label.check { display: inline-flex; align-items: center; gap: .45rem; font-weight: 400; margin: 0 .8rem .6rem 0; cursor: pointer; }
label.check input { width: auto; accent-color: var(--brand); }
label.inline { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
label.inline select, label.inline input { width: auto; }
.narrow-input { width: 5rem !important; }
.form-error { color: var(--danger); font-weight: 600; margin: .5rem 0; }
.form-inline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem 1rem; align-items: end; }
.form-inline-grid label { margin: 0; }
.form-inline-grid .grow { grid-column: span 2; }
.form-actions { display: flex; gap: .5rem; }
.filters { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; font-size: .9rem; font-weight: 600; gap: .25rem; }
.filters input, .filters select { width: auto; min-width: 9rem; font-weight: 400; }
.filter-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.checks { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 1rem; }
.check-pill {
  display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .95rem;
  border: 1.5px solid var(--line-strong); border-radius: 999px; cursor: pointer; background: #fff; user-select: none;
  transition: all .18s ease;
}
.check-pill:hover { border-color: var(--brand); background: #fcf9ff; }
.check-pill input { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); }
.check-pill:has(input:checked) {
  background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 600;
  box-shadow: 0 2px 8px rgba(126, 34, 206, .16);
}

/* ---------- ตาราง ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .96rem; }
.table th {
  text-align: left; background: #f3eafc; color: var(--brand-dark);
  font-weight: 600; padding: .6rem .75rem; border-bottom: 2px solid var(--line-strong); white-space: nowrap;
}
.table td { padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #faf5fe; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td input[type=text], .table td input[type=password], .table td select { min-width: 8rem; }
.muted-row td { color: var(--muted); }
.actions { white-space: nowrap; text-align: right; }
.tag {
  display: inline-block; background: var(--brand-soft); color: var(--brand-dark);
  border: 1px solid #dfcaf5; border-radius: 999px; padding: .08rem .6rem; font-size: .84rem; margin: .1rem 0;
}
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }
.steps { padding-left: 1.3rem; margin: .5rem 0 1rem; }
.steps li { margin-bottom: .35rem; }

.badge { display: inline-block; background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: .08rem .7rem; font-size: .82rem; font-weight: 600; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- หน้าเข้าสู่ระบบ ---------- */
.login-wrap {
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
}
.login-wrap.login-right {
  justify-content: flex-end;
  padding-right: 3vw;
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem 1.9rem 1.65rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-3d);
  position: relative;
  margin-bottom: 0;
}
.login-brand { text-align: center; margin-bottom: 1.35rem; }
.login-logo-badge {
  width: 84px; height: 84px; margin: 0 auto .65rem;
  display: grid; place-items: center;
  color: var(--brand-dark);
}
.login-logo-img {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(74, 34, 112, 0.18));
}
.login-title {
  margin: 0;
  font-size: 1.38rem;
  font-weight: 800;
  line-height: 1.35;
  color: #4c1d95;
  text-shadow: 0 2px 4px rgba(76, 29, 149, 0.18), 0 1px 0 #ffffff;
  letter-spacing: -0.01em;
}
.login-title span {
  display: inline-block;
  margin-top: .15rem;
  font-size: 1.04rem;
  font-weight: 700;
  color: #6b21a8;
  text-shadow: 0 1px 3px rgba(107, 33, 168, 0.14);
}

.password-wrap { position: relative; margin-top: .35rem; }
.password-wrap input { margin-top: 0 !important; padding-right: 2.6rem; }
.toggle-pw {
  position: absolute; right: .55rem; top: 50%; transform: translateY(-50%);
  background: none; border: 0; padding: .3rem; color: var(--muted);
  cursor: pointer; border-radius: 8px; display: grid; place-items: center;
  transition: color .15s ease, background .15s ease;
}
.toggle-pw:hover { color: #6b21a8; background: #f3e8ff; }
.toggle-pw.is-shown { color: #7e22ce; }

.login-credit {
  margin-top: 1.25rem;
  padding-top: .85rem;
  border-top: 1px solid #ede4f7;
  text-align: center;
  font-size: .83rem;
  color: #6b5b7b;
}
.login-credit strong {
  color: #4c1d95;
  font-weight: 600;
}

.checklist { list-style: none; padding: 0; margin: 1rem 0; }
.checklist li { padding: .2rem 0; }
.checklist .ok { color: var(--ok); }
.checklist .bad { color: var(--danger); font-weight: 600; }
.checklist .info { color: var(--muted); font-size: .92rem; }

/* ---------- หน้าเช็คชื่อ ---------- */
.checkin-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 1.1rem; align-items: start; }
.checkin-grid > .card { margin-bottom: 0; }
.checkin-grid > .card:last-child { position: sticky; top: 76px; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: .55rem 1rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; transition: color .15s ease; }
.tab:hover { color: var(--brand-dark); }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.big-input { font-size: 1.25rem !important; padding: .9rem 1rem !important; border: 2px solid var(--brand) !important; border-radius: 12px !important; }
.results { list-style: none; margin: .6rem 0 0; padding: 0; max-height: 360px; overflow-y: auto; }
.results:empty { display: none; }
.result {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap;
  padding: .65rem .9rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .4rem; cursor: pointer; background: #fff;
  transition: background .15s ease, border-color .15s ease;
}
.result:hover { background: #faf5fe; border-color: var(--line-strong); }
.result.active { background: var(--brand-soft); border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); }
.result.picked { background: var(--ok-soft); }
.result.none { color: var(--muted); cursor: default; background: transparent; border-style: dashed; }
.result-main { display: flex; flex-direction: column; line-height: 1.35; }
.result-name { font-weight: 600; }
.result-meta { color: var(--muted); font-size: .88rem; }
.roomlist { max-height: 420px; }

.chips { list-style: none; margin: .6rem 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; max-height: 260px; overflow-y: auto; }
.chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--brand-soft); border: 1px solid #dfcaf5; border-radius: 999px; padding: .3rem .35rem .3rem .85rem; font-size: .93rem; }
.chip.warn { background: var(--warn-soft); border-color: #f3d9b1; }
.chip-note { font-size: .78rem; color: var(--warn); font-weight: 600; }
.chip-x { border: 0; background: rgba(88, 28, 135, .12); width: 1.6rem; height: 1.6rem; border-radius: 50%; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--brand-dark); transition: background .15s ease, color .15s ease; }
.chip-x:hover { background: var(--danger); color: #fff; }

.dialog { border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem; width: 92%; max-width: 480px; box-shadow: 0 16px 48px rgba(43, 29, 58, .25); }
.dialog::backdrop { background: rgba(43, 29, 58, .45); backdrop-filter: blur(2px); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

/* ---------- แดชบอร์ด ---------- */
.period-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: .7rem 1rem; }
.segmented { display: inline-flex; background: #f3eafc; border-radius: 12px; padding: .22rem; gap: .15rem; flex-wrap: wrap; }
.segmented a { padding: .4rem 1rem; border-radius: 9px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; transition: all .15s ease; }
.segmented a:hover { background: #e6d5f7; }
.segmented a.active { background: linear-gradient(180deg, #9333ea, #7e22ce); color: #fff; box-shadow: 0 2px 6px rgba(126, 34, 206, .28); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem; display: flex; flex-direction: column; border-top: 4px solid var(--brand); }
.kpi:nth-child(2) { border-top-color: var(--accent); }
.kpi-num { font-size: 2.2rem; font-weight: 700; line-height: 1.15; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.kpi:nth-child(2) .kpi-num { color: var(--accent-dark); }
.kpi-label { font-weight: 600; }
.kpi-sub { color: var(--muted); font-size: .84rem; margin-top: .15rem; }

.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.dash-grid > .card { margin-bottom: 0; }
.dash-grid .wide { grid-column: 1 / -1; }

.bars { display: flex; flex-direction: column; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: minmax(6rem, 11rem) 1fr 3.8rem; align-items: center; gap: .7rem; }
.bar-label { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #efe4fa; border-radius: 999px; height: 16px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-light), var(--brand)); border-radius: 999px; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.cols { display: flex; align-items: stretch; gap: 4px; height: 210px; overflow-x: auto; padding-top: .3rem; }
.col { flex: 1 1 0; min-width: 24px; max-width: 70px; display: flex; flex-direction: column; height: 100%; }
.col-plot { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.col-val { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.3; }
.col-bar { display: block; width: 72%; background: linear-gradient(180deg, var(--brand-light), var(--brand)); border-radius: 6px 6px 0 0; transition: background .15s ease; }
.col:hover .col-bar { background: var(--accent); }
.col-label { text-align: center; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line-strong); padding-top: 2px; white-space: nowrap; }

/* ---------- หน้าพิมพ์สรุป ---------- */
body.print-page { background: #e8dcf5; }
.print-toolbar { position: sticky; top: 0; background: #4c1d95; padding: .6rem 1rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; color: #f3e8ff; z-index: 5; }
.print-toolbar .muted { color: #e9d5ff; font-size: .85rem; }
.print-toolbar .btn-ghost { background: transparent; color: #fff; border-color: rgba(253, 224, 71, .5); }
.report { background: #fff; max-width: 210mm; margin: 1.2rem auto 3rem; padding: 14mm 15mm; box-shadow: 0 2px 16px rgba(0, 0, 0, .15); font-size: .93rem; }
.report h1 { text-align: center; font-size: 1.5rem; margin: .2rem 0 .3rem; }
.report h2 { font-size: 1.05rem; border-bottom: 2px solid var(--brand); padding-bottom: .15rem; margin: 1.1rem 0 .55rem; color: var(--brand-dark); }
.report h3 { font-size: 1rem; margin: .8rem 0 .3rem; }
.report-head { text-align: center; }
.report-head p { margin: 0; }
.report-school { font-weight: 700; font-size: 1.05rem; }
.report-lib { color: var(--muted); }
.report-kpis { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line-strong); border-radius: 8px; margin-top: 1rem; }
.report-kpis div { display: flex; flex-direction: column; align-items: center; padding: .6rem .3rem; border-right: 1px solid var(--line); }
.report-kpis div:last-child { border-right: 0; }
.report-kpis b { font-size: 1.7rem; color: var(--brand-dark); line-height: 1.2; }
.report-kpis span { font-size: .82rem; color: var(--muted); }
.report-note { text-align: center; color: var(--muted); font-size: .88rem; margin: .5rem 0 0; }
.report-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.4rem; }
.report .cols { height: 150px; }
.table.compact { font-size: .86rem; }
.table.compact th, .table.compact td { padding: .22rem .5rem; }
.room-block small { color: var(--muted); font-weight: 400; }
.report-foot { margin-top: 1.6rem; }
.signs { display: flex; justify-content: space-around; text-align: center; margin-top: 2.4rem; gap: 1rem; }

/* ---------- จอเล็ก ---------- */
@media (max-width: 960px) {
  .login-wrap.login-right { justify-content: center; padding-right: 0; }
  .checkin-grid, .dash-grid, .report-cols { grid-template-columns: minmax(0, 1fr); }
  .checkin-grid > .card:last-child { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-inline-grid .grow { grid-column: auto; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ---------- การพิมพ์ ---------- */
@page { size: A4; margin: 12mm; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .no-print, .topbar, .print-toolbar { display: none !important; }
  body, body.print-page { background: #fff; font-size: 12.5px; }
  .container { max-width: none; padding: 0; }
  .card, .kpi { box-shadow: none; }
  .report { box-shadow: none; margin: 0; padding: 0; max-width: none; }
  .avoid-break, .card, .kpi, .room-block { break-inside: avoid; page-break-inside: avoid; }
  .page-break { break-before: page; page-break-before: always; }
  .table tbody tr:hover { background: none; }
}