/* ==========================================================
   ระบบลงเวลาปฏิบัติงานครู — ธีมสะอาด สว่าง มินิมอล
   พื้นฐาน Bootstrap 4 · ตัวแปรสี --brand* ตั้งจากหน้าตั้งค่า
   ========================================================== */
:root {
  --bg: #f7f8fb; --surface: #fff; --line: #e8eaf1; --line-2: #f0f2f7;
  --ink: #171b2e; --ink-2: #4f566d; --muted: #8a91a8;
  --ok: #16a34a; --warn: #d97706; --bad: #e11d48; --info: #0284c7;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .16);
  --r: 14px; --side: 268px;
}
* { -webkit-tap-highlight-color: transparent; }
body, h1, h2, h3, h4, h5, h6, .btn, input, select, textarea, .swal2-popup, .select2-container, table.dataTable, .dropdown-menu, .modal-content {
  font-family: 'Sarabun', sans-serif !important;
}
body { font-size: 1rem; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); } a:hover { color: var(--brand-dark); text-decoration: none; }
h1, h2, h3, h4, h5 { color: var(--ink); font-weight: 700; }
.text-brand { color: var(--brand) !important; } .text-muted { color: var(--muted) !important; }
hr { border-color: var(--line); }

/* ---------- โครงหน้า ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 1040; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; transition: transform .25s ease; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 1.15rem 1.2rem; text-decoration: none !important; }
.side-brand .mk { width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; overflow: hidden; }
.side-brand .mk img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.side-brand b { display: block; color: var(--ink); line-height: 1.2; font-size: 1rem; }
.side-brand small { color: var(--muted); }
.side-nav { padding: .4rem .8rem; flex: 1; overflow-y: auto; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: .62rem .85rem; margin-bottom: 3px; border-radius: 10px; color: var(--ink-2); font-weight: 500; }
.side-nav a i { width: 20px; text-align: center; color: var(--muted); font-size: 1rem; }
.side-nav a:hover { background: var(--bg); color: var(--ink); }
.side-nav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.side-nav a.active i { color: var(--brand); }
.side-nav .badge-count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: .75rem; padding: .05rem .5rem; font-weight: 700; }
.side-foot { padding: .9rem 1.2rem 1.1rem; border-top: 1px solid var(--line); }
.side-foot .st { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--ink-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }
.dot.off { background: #cbd5e1; box-shadow: none; }
.main { margin-left: var(--side); min-height: 100vh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 1030; height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 1.6rem; background: rgba(247, 248, 251, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .burger { display: none; border: 0; background: none; font-size: 1.2rem; color: var(--ink-2); padding: .3rem .5rem; margin-left: -.5rem; }
.top .crumb { color: var(--muted); font-size: .95rem; }
.top .crumb b { color: var(--ink); font-weight: 600; }
.top .sp { flex: 1; }
.nav-clock { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; font-size: .92rem; }
.user-btn { display: inline-flex; align-items: center; gap: .55rem; border: 0; background: none; padding: .2rem .3rem; border-radius: 999px; color: var(--ink-2); font-weight: 500; }
.user-btn:hover { background: var(--surface); }
.av, .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.avatar { width: 40px; height: 40px; margin-right: .75rem; }
.page { padding: 1.6rem 2rem 2.5rem; flex: 1; max-width: none; width: 100%; margin: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 1.4rem; }
.page-title { font-weight: 700; font-size: 1.65rem; margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.ph-sub { color: var(--muted); margin-top: .2rem; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.foot { padding: 1rem 1.6rem; color: var(--muted); font-size: .88rem; text-align: center; }
.scrim { display: none; }
.dropdown-menu { border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: .4rem; }
.dropdown-item { border-radius: 9px; padding: .5rem .8rem; }
.dropdown-item:active { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- การ์ด ปุ่ม ฟอร์ม ---------- */
.card { border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); background: var(--surface); margin-bottom: 1.2rem; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 1.02rem; font-weight: 700; margin: 0; }
.card-head h3 i { color: var(--brand); margin-right: .4rem; }
.card-head small { color: var(--muted); }
.card-body { padding: 1.2rem 1.25rem; }
.card-flush { padding: 0; }
.btn { border-radius: 10px; font-weight: 600; padding: .5rem 1rem; transition: background .15s, box-shadow .15s, border-color .15s, transform .08s; }
.btn:active { transform: translateY(1px); }
.btn:focus { box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .18); }
.btn-sm { padding: .3rem .72rem; border-radius: 9px; font-size: .9rem; }
.btn-lg { padding: .72rem 1.35rem; border-radius: 12px; font-size: 1.05rem; }
.btn-brand { background: linear-gradient(135deg, var(--brand), var(--brand-light)); border: 0; color: #fff; box-shadow: 0 8px 18px rgba(15, 20, 60, .2); }
.btn-brand:hover, .btn-brand:focus { background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff; box-shadow: 0 10px 22px rgba(15, 20, 60, .28); }
.btn-line { background: var(--surface); border: 1px solid #d9dce8; color: var(--ink-2); }
.btn-line:hover { background: var(--bg); color: var(--ink); border-color: #c8ccdc; }
.btn-soft { background: var(--brand-soft); border: 1px solid var(--brand-soft); color: var(--brand-dark); }
.btn-soft:hover { background: var(--brand-soft); filter: brightness(.97); color: var(--brand-dark); }
.btn-outline-secondary { border-color: #d9dce8; color: var(--ink-2); background: var(--surface); }
.btn-outline-secondary:hover { background: var(--bg); border-color: #c8ccdc; color: var(--ink); }
.btn-outline-primary { border-color: var(--brand); color: var(--brand); } .btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
label { font-weight: 600; color: var(--ink-2); font-size: .92rem; margin-bottom: .3rem; }
.form-control, .custom-select, .custom-file-label, .select2-container--bootstrap4 .select2-selection { border-radius: 10px !important; border-color: #d9dce8; min-height: 42px; color: var(--ink); }
.form-control:focus, .custom-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .14); }
.form-control-sm { min-height: 34px; }
.input-group-text { border-radius: 10px 0 0 10px; background: var(--bg); border-color: #d9dce8; color: var(--muted); }
.input-group > .form-control:not(:first-child) { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
.custom-file-label::after { border-radius: 0 10px 10px 0; background: var(--bg); color: var(--ink-2); content: "เลือก"; }
.custom-control-input:checked ~ .custom-control-label::before { background-color: var(--brand); border-color: var(--brand); }
.modal-content { border: 0; border-radius: 20px; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 0; padding: 1.3rem 1.5rem .2rem; }
.modal-title { font-weight: 700; font-size: 1.2rem; }
.modal-body { padding: 1rem 1.5rem; }
.modal-footer { border-top: 0; padding: .6rem 1.5rem 1.3rem; }
.alert { border: 0; border-radius: 12px; }
.alert-warning { background: #fff7e6; color: #8a4b00; }
.alert-info { background: #eaf4ff; color: #0b4a85; }
.alert-success { background: #e8f8ee; color: #14602f; }

/* แท็บ */
.tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 1.3rem; list-style: none; padding: 0; }
.tabs a, .tabs .nav-link { display: inline-flex; align-items: center; gap: .45rem; padding: .7rem 1rem; color: var(--muted); font-weight: 600; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; border-radius: 0; background: none; }
.tabs a:hover, .tabs .nav-link:hover { color: var(--ink); }
.tabs a.active, .tabs .nav-link.active { color: var(--brand); border-bottom-color: var(--brand); background: none; }

/* ป้ายสถานะ */
.badge { font-weight: 600; letter-spacing: .01em; padding: .38em .8em; }
.badge-success { background: #dcfce7; color: #166534; } .badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #ffe4e6; color: #9f1239; } .badge-info { background: #e0f2fe; color: #075985; }
.badge-primary { background: #e0e7ff; color: #3730a3; } .badge-secondary { background: #eef0f6; color: #4f566d; }
.badge-light { background: #f3f4f9; color: #6b7390; }
a.badge:hover { filter: brightness(.95); }
.chip { display: inline-block; padding: .15rem .75rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--ink-2); font-size: .86rem; }

/* ---------- KPI ---------- */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1.2rem; height: calc(100% - 1.2rem); }
.kpi .top-row { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 500; }
.kpi .ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: .95rem; }
.kpi .num { font-size: 2rem; font-weight: 700; line-height: 1.1; margin-top: .55rem; font-variant-numeric: tabular-nums; }
.kpi .num small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.kpi .bar { height: 6px; border-radius: 99px; background: var(--line-2); margin-top: .7rem; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.kpi.k-ok .ic { background: #dcfce7; color: #166534; } .kpi.k-warn .ic { background: #fef3c7; color: #92400e; }
.kpi.k-info .ic { background: #e0f2fe; color: #075985; } .kpi.k-bad .ic { background: #ffe4e6; color: #9f1239; } .kpi.k-brand .ic { background: var(--brand-soft); color: var(--brand-dark); }
/* กล่องสถิติแบบเก่า (ใช้ในรายงาน) */
.mini-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1rem; }
.mini-stats span { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .9rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 500; color: var(--ink-2); }
.mini-stats b { color: var(--ink); font-size: 1.05rem; }
.page-banner { width: 100%; max-height: 200px; object-fit: cover; border-radius: var(--r); margin-bottom: 1.2rem; border: 1px solid var(--line); }

/* ตัวช่วย / รายการ */
.callout { display: flex; align-items: center; gap: 14px; padding: 1rem 1.2rem; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); margin-bottom: 1.2rem; }
.callout .ci { width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.callout.c-brand { background: var(--brand-soft); border-color: transparent; } .callout.c-brand .ci { background: var(--brand); color: #fff; }
.callout.c-warn { background: #fff7e6; border-color: transparent; } .callout.c-warn .ci { background: #f59e0b; color: #fff; }
.callout.c-off { background: #f3edff; border-color: transparent; } .callout.c-off .ci { background: #7c3aed; color: #fff; }
.callout .grow { flex: 1; min-width: 0; } .callout b { display: block; }
.list-row { display: flex; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 2.2rem 1rem; }
.empty i { display: block; font-size: 2rem; color: #cbd0e2; margin-bottom: .6rem; }

/* ---------- พรีโหลดเดอร์ / สปินเนอร์ ---------- */
#pagePreloader, #appLoader { position: fixed; inset: 0; z-index: 99999; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(255,255,255,.95); color: var(--ink-2); font-weight: 600; }
#appLoader { display: none; background: rgba(16, 20, 40, .5); color: #fff; backdrop-filter: blur(2px); }
#appLoader.show { display: flex; }
.loader-box { text-align: center; padding: 1.5rem 2.3rem; border-radius: 20px; background: rgba(16, 20, 40, .78); }
.spinner-ring { width: 46px; height: 46px; border-radius: 50%; border: 5px solid var(--brand-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; margin: 0 auto; }
#appLoader .spinner-ring { border-color: rgba(255,255,255,.25); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- SweetAlert2 ---------- */
.swal2-popup { border-radius: 22px; padding: 1.6rem; }
.swal2-title { font-weight: 700; font-size: 1.4rem; }
.swal2-styled.swal2-confirm { background: var(--brand) !important; border-radius: 10px; font-weight: 600; }
.swal2-styled.swal2-cancel { border-radius: 10px; font-weight: 600; }

/* ---------- ตาราง / DataTables ---------- */
.table { margin-bottom: 0; color: var(--ink); }
.table thead th { border-top: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--muted); white-space: nowrap; font-weight: 600; font-size: .84rem; padding: .75rem 1rem; text-transform: none; }
.table td { vertical-align: middle; border-top: 1px solid var(--line-2); padding: .8rem 1rem; }
.table-hover tbody tr:hover { background: #fafbff; }
.table .who { display: flex; align-items: center; min-width: 0; }
.table .who b { display: block; font-weight: 600; } .table .who small { color: var(--muted); }
.dataTables_wrapper { padding: 0; }
.dataTables_wrapper .dataTables_filter input { border-radius: 10px; border: 1px solid #d9dce8; padding: .4rem .85rem .4rem 2.1rem; min-width: 240px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a91a8' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat .7rem center; }
.dataTables_wrapper .dataTables_filter input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(79,70,229,.14); }
.dataTables_wrapper .dataTables_filter label { font-size: 0; }
.dataTables_wrapper .dataTables_filter input { font-size: 1rem; margin-left: 0 !important; }
.dt-pad { padding: 1rem 1.25rem; }
.dataTables_info, .dataTables_paginate { padding: .9rem 1.25rem; }
.dataTables_wrapper .row:first-child { padding: 1rem 1.25rem 0; margin: 0; }
.dataTables_wrapper .row { margin: 0; }
.page-item .page-link { border: 0; border-radius: 9px; margin: 0 2px; color: var(--ink-2); }
.page-item.active .page-link { background: var(--brand); color: #fff; }
.page-item.disabled .page-link { background: transparent; color: #b6bcd6; }
.preview-box { background: var(--bg); border: 2px dashed #d5d9ea; border-radius: 14px; min-height: 110px; display: flex; align-items: center; justify-content: center; padding: .5rem; }
.preview-box img { max-width: 100%; max-height: 120px; border-radius: 10px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 3px; flex-wrap: wrap; gap: 2px; }
.seg button { border: 0; background: none; padding: .35rem .85rem; border-radius: 8px; font-weight: 600; color: var(--ink-2); font-size: .92rem; }
.seg button.active { background: var(--surface); color: var(--brand-dark); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.date-nav { display: inline-flex; align-items: center; gap: 6px; }
.date-nav .form-control { width: auto; }

/* ---------- กล้อง / ลงทะเบียนใบหน้า ---------- */
.cam-wrap { position: relative; width: 100%; max-width: 780px; margin: 0 auto; background: #0f1226; border-radius: 18px; overflow: hidden; aspect-ratio: 4 / 3; }
.cam-wrap video, .cam-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam-wrap video { transform: scaleX(-1); }
.cam-wrap .cam-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; text-align: center; padding: 1rem; }
.cam-prompt { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.1rem 1rem; text-align: center; color: #fff; font-size: 1.3rem; font-weight: 700; background: linear-gradient(0deg, rgba(0,0,0,.6), transparent); }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .35s; }
.cam-flash.on { opacity: .75; transition: none; }
.cam-oval { position: absolute; inset: 8% 28%; border: 3px dashed rgba(255,255,255,.55); border-radius: 50%; pointer-events: none; }
.pose-dots { display: flex; justify-content: center; gap: 8px; margin: .9rem 0; }
.pose-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); display: inline-block; transition: background .2s, transform .2s; }
.pose-dots i.on { background: var(--ok); transform: scale(1.15); }
.pose-dots i.now { background: var(--brand); transform: scale(1.25); }
.thumb { position: relative; display: inline-block; margin: 4px; }
.thumb img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 2px solid var(--line); }

/* ---------- จุดสแกน (โหมด kiosk เต็มจอ แบบสว่าง) ---------- */
body.kiosk { min-height: 100vh; background: var(--bg); color: var(--ink); }
.kiosk-wrap { max-width: 1480px; margin: 0 auto; padding: 18px 22px 28px; }
.kiosk-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.kiosk-brand { display: flex; align-items: center; }
.kiosk-brand img, .kiosk-brand .kb-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--brand); object-fit: contain; margin-right: 13px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.4rem; }
.kiosk-brand img { background: #fff; border: 1px solid var(--line); }
.kiosk-brand .t1 { font-size: 1.25rem; font-weight: 700; line-height: 1.15; }
.kiosk-brand .t2 { color: var(--muted); font-size: .95rem; }
.kiosk-clock { text-align: right; }
.kiosk-clock .time { font-size: 2.8rem; font-weight: 700; line-height: 1; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.kiosk-clock .date { color: var(--muted); }
.kiosk-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(310px, 1fr); gap: 20px; }
.glass { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 16px; }
.kiosk .cam-wrap { max-width: none; }
.kiosk .form-control { background: var(--surface); }
.btn-glass { background: var(--surface); border: 1px solid #d9dce8; color: var(--ink-2); }
.btn-glass:hover { background: var(--bg); color: var(--ink); }
.diag { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: .4rem; padding-top: .8rem; border-top: 1px solid var(--line-2); font-size: .88rem; }
.diag .dg { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .7rem; border-radius: 999px; font-weight: 600; }
.diag .dg.ok { background: #dcfce7; color: #166534; } .diag .dg.no { background: #ffe4e6; color: #9f1239; }
.diag .msg { flex-basis: 100%; color: var(--ink-2); } .diag .msg.bad { color: #be123c; font-weight: 600; }
.scan-idle { text-align: center; padding: 26px 10px; color: var(--ink-2); }
.scan-idle i { font-size: 3rem; margin-bottom: 8px; display: block; color: var(--brand); animation: pulse 2.2s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.1); opacity: 1; } }
.scan-result { display: none; border-radius: 20px; padding: 1.5rem 1rem; text-align: center; color: #fff; }
.scan-result .big-ico { font-size: 3rem; line-height: 1; margin-bottom: .3rem; }
.scan-result .rs-top { font-size: 1.1rem; font-weight: 600; }
.scan-result .nm { font-size: 1.85rem; font-weight: 700; line-height: 1.2; margin: .25rem 0; }
.scan-result .tm { font-size: 2.5rem; font-weight: 700; }
.scan-result .sub { opacity: .92; }
.scan-result.in-ok { background: #059669; } .scan-result.in-late { background: #d97706; }
.scan-result.out-ok { background: #0284c7; } .scan-result.out-early { background: #7c3aed; } .scan-result.already { background: #64748b; }
.kiosk-stat { display: flex; justify-content: space-between; align-items: center; }
.kiosk-stat .n { font-size: 2.2rem; font-weight: 700; }
.recent-list { max-height: 320px; overflow-y: auto; }
.recent-list .item { display: flex; justify-content: space-between; align-items: center; padding: .55rem .2rem; border-bottom: 1px solid var(--line-2); }
.recent-list .item small { color: var(--muted); }
.recent-list .rc-h { position: sticky; top: 0; z-index: 1; padding: .35rem .6rem; margin: .4rem 0 .1rem; font-size: .82rem; font-weight: 700; color: var(--muted); background: var(--line-2); border-radius: 6px; }
.recent-list .rc-day:first-child .rc-h { margin-top: 0; }
.recent-list .rc-b .item:last-child { border-bottom: 0; }
.tag { display: inline-block; padding: .1rem .65rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: #fff; }
.tag.in { background: #10b981; } .tag.out { background: #0ea5e9; } .tag.late { background: #f59e0b; }

/* ---------- เข้าสู่ระบบ / ติดตั้ง ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #fff; }
.auth-side { position: relative; overflow: hidden; color: #fff; padding: 3rem 3.2rem; display: flex; flex-direction: column; justify-content: space-between; background-color: #0b1020; background-size: cover; background-position: center;
  background-image: radial-gradient(60% 70% at 10% 6%, var(--brand-light) 0%, transparent 60%), radial-gradient(55% 60% at 100% 25%, var(--mesh1) 0%, transparent 58%), radial-gradient(50% 55% at 60% 105%, var(--mesh2) 0%, transparent 60%), linear-gradient(135deg, #0b1020 0%, var(--brand-dark) 55%, var(--brand) 100%); }
.auth-side::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 85% 10%, rgba(255,255,255,.16), transparent 45%), radial-gradient(circle at 5% 100%, rgba(255,255,255,.1), transparent 40%); }
.auth-side > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; font-weight: 700; font-size: 1.15rem; }
.auth-brand .lg { width: 44px; height: 44px; border-radius: 13px; background: #fff; margin-right: 12px; display: flex; align-items: center; justify-content: center; color: var(--brand); font-size: 1.3rem; overflow: hidden; }
.auth-brand .lg img { width: 100%; height: 100%; object-fit: contain; }
.auth-side h1 { color: #fff; font-weight: 700; font-size: 2.3rem; line-height: 1.25; margin-bottom: .8rem; }
.auth-side p.lead { opacity: .88; font-size: 1.08rem; max-width: 440px; }
.auth-feats { list-style: none; padding: 0; margin: 1.6rem 0 0; }
.auth-feats li { display: flex; align-items: center; margin-bottom: .85rem; font-weight: 500; }
.auth-feats i { width: 36px; height: 36px; border-radius: 11px; background: rgba(255,255,255,.16); display: inline-flex; align-items: center; justify-content: center; margin-right: .8rem; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.4rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 2rem 1.8rem; box-shadow: var(--shadow); }
.auth-card h3 { font-weight: 700; font-size: 1.55rem; }
.auth-card .form-control { min-height: 46px; }
/* หน้าเข้าสู่ระบบ (ปรับปรุงใหม่) */
.auth-body { background: #fff; }
.auth-brand { text-decoration: none !important; color: #fff !important; }
.auth-side .auth-vis { min-height: 420px; max-width: 440px; width: 100%; margin: 0 auto; }
.auth-side .lp-device { top: 0; }
.auth-side .lp-f-note { right: 6px; top: 40px; }
.auth-side h1 { font-size: clamp(1.9rem, 3vw, 2.5rem); }
.auth-side .lead { font-size: 1.05rem; }
.auth-main { flex-direction: column; background: linear-gradient(160deg, #f7f8fd 0%, #eef0fb 100%); }
.auth-wrap { width: 100%; max-width: 430px; }
.auth-back { display: inline-flex; align-items: center; color: var(--ink-2); font-weight: 600; margin-bottom: 1rem; padding: .3rem .2rem; }
.auth-back:hover { color: var(--brand); }
.auth-card { max-width: none; padding: 2.4rem 2.1rem; border-radius: 26px; border: 1px solid #e6e9f5; box-shadow: 0 30px 70px rgba(35, 40, 100, .14), 0 2px 6px rgba(35, 40, 100, .05); text-align: left; }
.auth-logo { width: 62px; height: 62px; border-radius: 18px; margin-bottom: 1.1rem; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: linear-gradient(135deg, var(--brand), var(--brand-light)); color: #fff; font-size: 1.7rem; box-shadow: 0 14px 28px rgba(79, 70, 229, .32); }
.auth-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.auth-field { position: relative; }
.auth-field > i:first-child { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); z-index: 2; pointer-events: none; }
.auth-field .form-control { padding-left: 2.7rem; padding-right: 2.9rem; min-height: 50px; border-radius: 14px !important; background: #f8f9fd; }
.auth-field .form-control:focus { background: #fff; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 12px; background: none; color: var(--muted); }
.pw-toggle:hover { background: #eef0f8; color: var(--ink); }
.auth-card .btn-lg { border-radius: 14px; padding: .85rem 1.4rem; }
.auth-note { display: flex; gap: .6rem; align-items: flex-start; margin-top: 1.5rem; padding: .85rem 1rem; border-radius: 14px; background: var(--brand-soft); color: var(--brand-dark); font-size: .9rem; line-height: 1.5; }
.auth-note i { margin-top: .2rem; }
@media (max-height: 820px) {
  .auth-side { padding-top: 1.8rem; padding-bottom: 1.8rem; }
  .auth-side .auth-vis { min-height: 400px; }
  .auth-feats { display: none; }
}
.auth-foot { text-align: center; color: var(--muted); font-size: .88rem; margin-top: 1.2rem; }
.login-page-bg { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); }

/* ---------- ตัวช่วยตั้งค่า (wizard) ---------- */
.wiz { max-width: 760px; margin: 0 auto; }
.wiz-steps { display: flex; align-items: center; justify-content: space-between; margin: 0 0 1.6rem; padding: 0; list-style: none; }
.wiz-steps li { flex: 1; text-align: center; position: relative; color: var(--muted); font-size: .85rem; font-weight: 600; }
.wiz-steps li::before { content: ''; position: absolute; top: 17px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.wiz-steps li:first-child::before { display: none; }
.wiz-steps li .n { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; margin: 0 auto .35rem; display: flex; align-items: center; justify-content: center; background: #fff; border: 2px solid var(--line); color: var(--muted); }
.wiz-steps li.done::before, .wiz-steps li.now::before { background: var(--brand); }
.wiz-steps li.done .n { background: var(--brand); border-color: var(--brand); color: #fff; }
.wiz-steps li.now .n { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.wiz-steps li.now { color: var(--ink); }
.wiz-card { padding: 2rem; }
.wiz-card h2 { font-size: 1.4rem; margin-bottom: .3rem; }
.wiz-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 1.5rem; }

/* ---------- ตั้งค่า: ตรวจความพร้อม / แผนที่ / วันทำงาน ---------- */
.chk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.chk-row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.chk-row .ic { width: 24px; height: 24px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: .7rem; color: #fff; margin-top: 2px; }
.chk-row.ok .ic { background: var(--ok); } .chk-row.warn .ic { background: #e9a23b; } .chk-row.bad .ic { background: var(--bad); }
.chk-row b { display: block; font-weight: 600; line-height: 1.35; } .chk-row small { color: var(--muted); } .chk-row.bad small { color: var(--bad); }
.chk-test { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); }
.daypick { display: flex; flex-wrap: wrap; gap: 6px; }
.daypick label { margin: 0; cursor: pointer; } .daypick input { position: absolute; opacity: 0; }
.daypick span { display: inline-block; min-width: 62px; text-align: center; padding: 6px 10px; border-radius: 10px; border: 1px solid #d9dce8; font-weight: 600; color: var(--ink-2); background: #fff; }
.daypick input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.exempt-box { border: 1px solid #d9dce8; border-radius: 12px; max-height: 240px; overflow: auto; padding: 6px 12px; }
.exempt-box label { display: flex; align-items: center; gap: 8px; padding: 5px 2px; margin: 0; font-weight: 400 !important; border-bottom: 1px solid var(--line-2); }
.exempt-box label:last-child { border-bottom: 0; } .exempt-box small { color: var(--muted); margin-left: auto; text-align: right; }
.ip-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); }
.ip-box code { font-size: 1.05rem; font-weight: 700; color: var(--ink); background: none; }
.zone-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.zone-mapcol { position: relative; border-right: 1px solid var(--line); }
.zone-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.zone-tools .sep { width: 1px; height: 26px; background: #d9dce8; margin: 0 4px; }
.zone-tools form { display: flex; gap: 6px; margin-left: auto; } .zone-tools input { width: 210px; }
#zoneMap { height: 520px; background: #dce6ef; }
#zoneMap.is-drawing, #zoneMap.is-drawing .leaflet-interactive { cursor: crosshair !important; }
.draw-hint { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border-radius: 14px; background: rgba(15,37,64,.92); color: #fff; font-size: .92rem; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.draw-hint[hidden] { display: none; } .draw-hint span { flex: 1; min-width: 220px; }
.draw-hint button { border: 0; border-radius: 9px; padding: 6px 12px; font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; background: rgba(255,255,255,.14); color: #fff; }
.draw-hint button:hover { background: rgba(255,255,255,.26); } .draw-hint #hintDone { background: #f4b400; color: #2a1c00; }
.zone-side { display: flex; flex-direction: column; min-height: 0; }
.zone-list { flex: 1; overflow: auto; max-height: 460px; padding: 12px; }
.zone-save { padding: 12px; border-top: 1px solid var(--line); background: var(--bg); }
.zl-empty { text-align: center; color: var(--muted); padding: 40px 16px; } .zl-empty i { font-size: 2rem; color: #b9bfe0; display: block; margin-bottom: 10px; }
.zl-empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.zl-item { --zc: #4f46e5; border: 1px solid #d9dce8; border-left: 4px solid var(--zc); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: #fff; cursor: pointer; }
.zl-item.is-sel { border-color: var(--zc); box-shadow: 0 0 0 3px rgba(79,70,229,.13); } .zl-item.is-off { opacity: .62; }
.zl-top { display: flex; align-items: center; gap: 8px; }
.zl-color { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer; flex: none; }
.zl-switch { position: relative; flex: none; margin: 0; cursor: pointer; } .zl-switch input { position: absolute; opacity: 0; }
.zl-switch span { display: block; width: 38px; height: 22px; border-radius: 99px; background: #cbd5e1; position: relative; transition: background .15s; }
.zl-switch span:after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.zl-switch input:checked + span { background: var(--ok); } .zl-switch input:checked + span:after { transform: translateX(16px); }
.zl-meta { font-size: .84rem; color: var(--muted); margin: 6px 0 4px; }
.zl-radius { display: flex; align-items: center; gap: 8px; font-size: .88rem; margin: 6px 0; } .zl-radius input[type=range] { flex: 1; } .zl-radius input[type=number] { width: 84px; }
.zl-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.zl-actions button { border: 1px solid #d9dce8; background: #fff; border-radius: 8px; padding: 3px 9px; font-size: .82rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.zl-actions button:hover { background: var(--brand-soft); color: var(--brand); } .zl-actions button.danger { color: var(--bad); margin-left: auto; }
.zv { display: flex !important; align-items: center; justify-content: center; border-radius: 50%; background: #fff; border: 3px solid #4f46e5; color: #0f2540; font-weight: 800; font-size: 11px; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.zv-first { background: #f4b400; border-color: #fff; } .zv-center { background: #4f46e5; color: #fff; border-color: #fff; font-size: 12px; } .zv-radius { background: #fff; border-color: #d97706; color: #d97706; font-size: 11px; }
.zmid { display: flex !important; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,.85); border: 2px dashed #4f46e5; color: #4f46e5; font-weight: 800; font-size: 12px; line-height: 1; }
.help-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); }
.help-steps div { display: flex; gap: 10px; font-size: .86rem; color: var(--ink-2); }
.help-steps b { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: .8rem; }

/* ---------- รายงานรายเดือนแบบตาราง ---------- */
.mx-wrap { overflow: auto; max-height: 70vh; }
.mx { border-collapse: separate; border-spacing: 0; font-size: .86rem; min-width: 100%; }
.mx th, .mx td { border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); padding: 0; text-align: center; white-space: nowrap; }
.mx thead th { position: sticky; top: 0; z-index: 2; background: #fafbfe; color: var(--muted); font-weight: 600; padding: 6px 0; }
.mx thead th .dn { display: block; font-size: .95rem; color: var(--ink); font-weight: 700; line-height: 1.2; } .mx thead th .wd { display: block; font-size: .72rem; }
.mx .c-day { width: 32px; min-width: 32px; }
.mx .off { background: repeating-linear-gradient(-45deg, #f6f7fb 0 4px, #eef0f6 4px 8px); }
.mx thead th.today .dn { color: #fff; background: var(--brand); border-radius: 50%; width: 24px; height: 24px; line-height: 24px; margin: 0 auto; }
.mx .name { position: sticky; left: 0; z-index: 1; background: #fff; text-align: left; padding: 7px 12px; min-width: 220px; max-width: 260px; white-space: normal; }
.mx thead .name { z-index: 3; background: #fafbfe; }
.mx .name b { display: block; font-weight: 600; line-height: 1.3; } .mx .name small { color: var(--muted); font-size: .76rem; }
.mx td.m { font-weight: 800; height: 38px; cursor: pointer; transition: background .1s; }
.mx td.m:hover { outline: 2px solid var(--brand); outline-offset: -2px; background-color: var(--brand-soft); }
.mx td.m-present { color: var(--ok); } .mx td.m-late { color: #b45309; background: #fff6e5; } .mx td.m-leave { color: #0369a1; background: #e8f4fb; }
.mx td.m-duty { color: #7c3aed; background: #f3edff; } .mx td.m-absent { color: var(--bad); background: #fdeded; } .mx td.m-waiting { color: #94a3b8; }
.mx .tot { min-width: 48px; padding: 0 6px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mx .t-present { color: var(--ok); } .mx .t-late { color: #b45309; } .mx .t-leave { color: #0369a1; } .mx .t-duty { color: #7c3aed; } .mx .t-absent { color: var(--bad); } .mx .t-early { color: #be185d; }
.mx .zero { color: #cbd5e1; font-weight: 500; }
.mx tfoot td { background: #fafbfe; font-weight: 800; padding: 8px 0; position: sticky; bottom: 0; } .mx tfoot .name { background: #fafbfe; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .86rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { display: inline-flex; width: 24px; height: 24px; border-radius: 8px; align-items: center; justify-content: center; font-weight: 800; }
.print-only { display: none; }

/* ---------- ตอบสนองต่ออุปกรณ์ ---------- */
@media (max-width: 1199px) {
  .zone-wrap { grid-template-columns: 1fr; } .zone-mapcol { border-right: 0; border-bottom: 1px solid var(--line); } .zone-list { max-height: none; } .help-steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 991px) {
  .side { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.side-open .side { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(16, 20, 40, .45); z-index: 1035; }
  .main { margin-left: 0; } .top { padding: 0 1rem; } .top .burger { display: inline-block; } .page { padding: 1.2rem 1rem 2rem; }
  .kiosk-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-main { min-height: 100vh; padding: 1.2rem 1rem; } .auth-card { padding: 1.8rem 1.4rem; }
}
@media (max-width: 767px) {
  #zoneMap { height: 400px; } .chk-grid, .help-steps { grid-template-columns: 1fr; }
  .zone-tools form { margin-left: 0; width: 100%; } .zone-tools input { flex: 1; width: auto; }
  .mx .name { min-width: 150px; } .page-title { font-size: 1.35rem; } .card-body { padding: 1rem; }
  .kpi .num { font-size: 1.7rem; } .kiosk-clock .time { font-size: 2rem; } .scan-result .nm { font-size: 1.45rem; }
  .wiz-card { padding: 1.3rem; } .wiz-steps li span.t { display: none; }
  .dataTables_wrapper .dataTables_filter input { min-width: 0; width: 100%; }
}
/* ==========================================================
   สีสันสดใส · ตัวเลือกธีม · การ์ดต้อนรับ · ทางลัด
   ========================================================== */
.top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: linear-gradient(90deg, var(--brand), var(--mesh1), var(--accent)); opacity: .9; }
.page-title::after { content: ''; display: block; width: 46px; height: 4px; border-radius: 4px; margin-top: .5rem; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.card-head h3 i { display: inline-flex; width: 30px; height: 30px; border-radius: 10px; align-items: center; justify-content: center; font-size: .85rem; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-light)); box-shadow: 0 6px 12px rgba(15, 20, 60, .18); }
.chip { background: var(--brand-soft); border-color: transparent; color: var(--brand-dark); font-weight: 600; }
.kpi { position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--kc, var(--brand)); }
.kpi.k-ok { --kc: #10b981; background: linear-gradient(160deg, #ecfdf5 0%, #fff 62%); } .kpi.k-warn { --kc: #f59e0b; background: linear-gradient(160deg, #fffbeb 0%, #fff 62%); }
.kpi.k-info { --kc: #0ea5e9; background: linear-gradient(160deg, #f0f9ff 0%, #fff 62%); } .kpi.k-bad { --kc: #f43f5e; background: linear-gradient(160deg, #fff1f2 0%, #fff 62%); }
.kpi.k-brand { --kc: var(--brand); background: linear-gradient(160deg, var(--brand-soft) 0%, #fff 62%); }
.kpi .ic { box-shadow: 0 6px 12px rgba(15, 20, 60, .1); }
.kpi.k-ok .ic { background: linear-gradient(135deg, #10b981, #34d399); color: #fff; } .kpi.k-warn .ic { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; }
.kpi.k-info .ic { background: linear-gradient(135deg, #0ea5e9, #38bdf8); color: #fff; } .kpi.k-bad .ic { background: linear-gradient(135deg, #f43f5e, #fb7185); color: #fff; }
.avatar, .av { background: linear-gradient(135deg, var(--brand), var(--mesh1)); color: #fff; }
.tabs a.active, .tabs .nav-link.active { color: var(--brand); border-bottom-width: 3px; }
.table thead th { background: linear-gradient(180deg, var(--brand-soft), transparent); }
.badge-brandsoft { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; padding: .38em .8em; }
.pill-accent { display: inline-flex; align-items: center; padding: .4rem .9rem; border-radius: 12px; font-weight: 700; background: linear-gradient(90deg, var(--accent-light), var(--accent)); color: var(--accent-ink); box-shadow: 0 6px 14px rgba(15, 20, 60, .18); }

/* ตัวเลือกธีม */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.preset { position: relative; display: flex; align-items: center; gap: 12px; padding: .75rem .9rem; border: 2px solid var(--line); border-radius: 16px; background: #fff; text-align: left; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.preset:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(15, 20, 60, .1); }
.preset .sw { width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06), 0 6px 12px rgba(15, 20, 60, .14); }
.preset .nm { font-weight: 600; line-height: 1.25; font-size: .95rem; color: var(--ink); }
.preset .ck { position: absolute; right: 10px; top: 10px; color: var(--brand); font-size: 1.1rem; opacity: 0; transform: scale(.6); transition: .15s; }
.preset.on { border-color: var(--brand); background: var(--brand-soft); }
.preset.on .ck { opacity: 1; transform: none; }
.color-input { width: 100%; height: 56px; padding: 4px; border: 2px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; }
.th-prev { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #fff; }
.th-prev .bar { height: 46px; background: linear-gradient(120deg, var(--brand-dark), var(--brand) 55%, var(--mesh1)); }
.th-prev .bd { padding: .9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* การ์ดต้อนรับ + ทางลัด (แดชบอร์ด) */
.welcome { position: relative; overflow: hidden; border-radius: 26px; color: #fff; padding: 1.7rem 1.9rem; margin-bottom: 1.2rem;
  background: radial-gradient(60% 120% at 90% 0%, var(--mesh1) 0%, transparent 60%), radial-gradient(50% 100% at 5% 110%, var(--mesh2) 0%, transparent 60%), linear-gradient(135deg, var(--brand-dark), var(--brand));
  box-shadow: 0 22px 44px rgba(15, 20, 60, .22); }
.welcome::after { content: ''; position: absolute; inset: 0; opacity: .35; background-image: radial-gradient(rgba(255,255,255,.35) 1px, transparent 1.2px); background-size: 24px 24px; pointer-events: none; -webkit-mask-image: linear-gradient(90deg, transparent, #000); mask-image: linear-gradient(90deg, transparent, #000); }
.welcome-in { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.welcome h2 { color: #fff; font-size: 1.65rem; margin: 0 0 .3rem; }
.welcome .sub { opacity: .92; }
.welcome .pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1rem; }
.welcome .pills span { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .85rem; border-radius: 999px; background: rgba(255,255,255,.18); font-weight: 600; font-size: .9rem; backdrop-filter: blur(6px); }
.welcome .ring { --p: 0; width: 116px; height: 116px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(255,255,255,.22) 0); }
.welcome .ring > div { width: 92px; height: 92px; border-radius: 50%; background: rgba(15, 20, 60, .55); backdrop-filter: blur(8px); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.welcome .ring b { font-size: 1.8rem; line-height: 1; } .welcome .ring small { font-size: .7rem; opacity: .85; }
.welcome .w-btn { display: inline-flex; align-items: center; gap: .5rem; padding: .7rem 1.3rem; border-radius: 14px; font-weight: 700; text-decoration: none !important; background: linear-gradient(135deg, var(--accent-light), var(--accent)); color: var(--accent-ink) !important; box-shadow: 0 12px 24px rgba(0,0,0,.25); }
.welcome .w-btn.ghost { background: rgba(255,255,255,.16); color: #fff !important; box-shadow: none; border: 1px solid rgba(255,255,255,.4); }
.quick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 1.2rem; }
.qt { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .55rem; padding: 1.1rem .6rem 1rem; border-radius: 20px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow);
  color: var(--ink) !important; font-weight: 600; text-decoration: none !important; transition: transform .18s, box-shadow .18s; }
.qt:hover { transform: translateY(-4px); box-shadow: 0 18px 34px rgba(15, 20, 60, .14); }
.qt .qi { width: 50px; height: 50px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: #fff; background: var(--qc); box-shadow: 0 10px 18px rgba(15, 20, 60, .2); }
.qt small { color: var(--muted); font-weight: 400; display: block; line-height: 1.3; }
.qt .sl-badge { position: absolute; right: 12px; top: 10px; }
@media (max-width: 1199px) { .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 575px) { .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } .welcome { padding: 1.3rem 1.2rem; border-radius: 22px; } .welcome h2 { font-size: 1.35rem; } }

/* ==========================================================
   เมนูข้างโทนเข้ม (แบบระบบ HR) · แถบบน · แดชบอร์ดแบบแบนเนอร์
   ========================================================== */
.main { background-color: var(--bg); background-image: linear-gradient(rgba(60, 70, 180, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(60, 70, 180, .045) 1px, transparent 1px); background-size: 30px 30px; }
.side.side-ref { background: linear-gradient(185deg, var(--brand-dark) 0%, #0e1646 58%, #090f33 100%); border-right: 0; color: #fff; box-shadow: 6px 0 34px rgba(8, 12, 50, .3); }
.side-ref .side-brand { padding: 1.15rem 1.15rem .95rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-ref .side-brand .mk { width: 46px; height: 46px; border-radius: 14px; background: #fff; color: var(--brand); box-shadow: 0 8px 18px rgba(0,0,0,.3); }
.side-ref .side-brand .mk img { background: #fff; object-fit: contain; }
.side-ref .side-brand b { color: #fff; font-size: 1.02rem; }
.side-ref .side-brand small { color: rgba(255,255,255,.62); display: block; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-ref .side-brand > span:last-child { min-width: 0; }
.sr-user { display: flex; align-items: center; gap: 12px; margin: 1rem 1rem .3rem; padding: .8rem .9rem; border-radius: 18px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); }
.sr-user .av { width: 46px; height: 46px; background: linear-gradient(135deg, var(--accent-light), var(--accent)); color: var(--accent-ink); box-shadow: 0 0 0 3px rgba(255,255,255,.25); font-size: 1.15rem; }
.sr-user .who { min-width: 0; } .sr-user .who b { display: block; color: #fff; line-height: 1.2; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-user .role { display: inline-block; margin-top: .25rem; padding: .05rem .7rem; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--accent); color: var(--accent-ink); }
.sr-scroll { flex: 1; overflow-y: auto; padding: .2rem .85rem 1.2rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
.sr-scroll::-webkit-scrollbar { width: 6px; } .sr-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 6px; }
.sr-label { padding: 1.15rem .6rem .45rem; font-size: .7rem; letter-spacing: .14em; color: rgba(255,255,255,.4); font-weight: 700; }
.sr-group { margin-bottom: 5px; }
.sr-item { display: flex; align-items: center; gap: 12px; padding: .5rem .7rem; border-radius: 16px; color: #fff !important; text-decoration: none !important; position: relative; transition: background .15s; }
.sr-item .ic { width: 42px; height: 42px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; color: var(--c); background: rgba(255,255,255,.1); flex-shrink: 0; transition: background .2s, color .2s, box-shadow .2s; }
.sr-item .tx { flex: 1; min-width: 0; line-height: 1.2; }
.sr-item .tx b { display: block; font-size: 1.02rem; font-weight: 700; }
.sr-item .tx small { display: block; font-size: .72rem; color: rgba(255,255,255,.5); font-weight: 500; }
.sr-item:hover { background: rgba(255,255,255,.08); }
.sr-group.active > .sr-item { background: rgba(255,255,255,.14); box-shadow: inset 3px 0 0 var(--accent); }
.sr-group.active > .sr-item .ic { background: var(--c); color: #fff; box-shadow: 0 8px 16px rgba(0,0,0,.35); }
.sr-item.danger .tx b { color: #fecaca; }
.sr-badge { background: linear-gradient(135deg, #fb923c, #f59e0b); color: #fff; border-radius: 999px; font-size: .74rem; padding: .05rem .55rem; font-weight: 700; line-height: 1.55; box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.sr-ext { font-size: .7rem; color: rgba(255,255,255,.45); }
.sr-toggle { border: 0; background: none; color: rgba(255,255,255,.62); width: 24px; height: 30px; display: flex; align-items: center; justify-content: center; font-size: .7rem; padding: 0; cursor: pointer; }
.sr-toggle i { transition: transform .22s; } .sr-group.open .sr-toggle i { transform: rotate(-90deg); }
.sr-sub { max-height: 0; overflow: hidden; transition: max-height .3s ease; margin: 0 0 0 2.4rem; border-left: 1px solid rgba(255,255,255,.16); }
.sr-group.open .sr-sub { max-height: 520px; padding: .3rem 0 .4rem; }
.sr-sub a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: .42rem .8rem; margin: 0 0 2px .5rem; border-radius: 11px; color: rgba(255,255,255,.72) !important; font-size: .94rem; text-decoration: none !important; position: relative; }
.sr-sub a:hover { color: #fff !important; background: rgba(255,255,255,.08); }
.sr-sub a.on { color: #fff !important; font-weight: 700; background: rgba(255,255,255,.14); }
.sr-sub a.on::before { content: ''; position: absolute; left: -.97rem; top: 50%; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); transform: translateY(-50%); box-shadow: 0 0 0 4px rgba(255,255,255,.14); }
.top-link { align-items: center; gap: .45rem; color: var(--ink-2) !important; font-weight: 600; padding: .38rem .75rem; border-radius: 11px; text-decoration: none !important; }
.top-link:hover { background: #fff; }
.bell { position: relative; width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--ink-2) !important; font-size: 1.1rem; text-decoration: none !important; }
.bell:hover { background: #fff; }
.bell .bn { position: absolute; right: 1px; top: 1px; background: #f43f5e; color: #fff; font-size: .68rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; box-shadow: 0 3px 8px rgba(244, 63, 94, .45); }

/* แดชบอร์ดแบบแบนเนอร์ */
.subnav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 1.1rem; }
.subnav .ttl { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--brand); margin-right: .7rem; font-size: 1.05rem; }
.subnav a { padding: .5rem 1.1rem; border-radius: 999px; font-weight: 600; color: var(--ink-2) !important; text-decoration: none !important; }
.subnav a:hover { background: #fff; }
.subnav a.on { background: var(--brand); color: #fff !important; box-shadow: 0 8px 18px rgba(15, 20, 60, .25); }
.subnav .ct, .sec-h .ct { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 .55rem; font-size: .75rem; font-weight: 700; margin-left: .35rem; line-height: 1.6; display: inline-block; }
.hero-ref { position: relative; overflow: hidden; border-radius: 26px; color: #fff; margin-bottom: 1.1rem; min-height: 176px; background-size: cover; background-position: center; background-color: var(--brand-dark); box-shadow: 0 22px 46px rgba(15, 20, 60, .26); }
.hero-ref::before { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, var(--brand-dark), var(--brand) 55%, var(--mesh2)); }
.hero-ref.has-img::before { opacity: .82; }
.hero-ref::after { content: ''; position: absolute; inset: 0; opacity: .3; background-image: radial-gradient(rgba(255,255,255,.4) 1px, transparent 1.2px); background-size: 24px 24px; pointer-events: none; }
.hero-in { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 22px; padding: 1.5rem 1.7rem; }
.h-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.h-av { width: 86px; height: 86px; border-radius: 50%; border: 4px solid rgba(255,255,255,.88); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-light), var(--accent)); color: var(--accent-ink); font-size: 2.1rem; font-weight: 700; box-shadow: 0 14px 28px rgba(0,0,0,.3); }
.h-day { opacity: .92; font-size: .95rem; }
.hero-ref h2 { color: #fff; font-size: 1.95rem; margin: .1rem 0 .55rem; text-shadow: 0 3px 14px rgba(0,0,0,.3); }
.h-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.h-chips span { display: inline-flex; align-items: center; gap: .45rem; padding: .28rem .85rem; border-radius: 999px; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3); font-weight: 600; font-size: .88rem; backdrop-filter: blur(6px); }
.h-stats { display: flex; gap: 12px; }
.h-stat { min-width: 112px; text-align: center; padding: .85rem 1rem; border-radius: 20px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.32); backdrop-filter: blur(10px); }
.h-stat b { display: block; font-size: 1.95rem; line-height: 1.1; font-variant-numeric: tabular-nums; text-shadow: 0 2px 10px rgba(0,0,0,.25); }
.h-stat small { opacity: .92; font-weight: 600; }
.qa { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: .6rem; }
.qa a { display: flex; align-items: center; gap: 12px; padding: .85rem 1rem; border-radius: 20px; background: linear-gradient(135deg, var(--qs), #fff 78%); border: 1px solid #fff; box-shadow: 0 10px 24px rgba(15, 20, 60, .09);
  color: var(--ink) !important; font-weight: 700; text-decoration: none !important; transition: transform .18s, box-shadow .18s; }
.qa a:hover { transform: translateY(-3px); box-shadow: 0 18px 34px rgba(15, 20, 60, .16); }
.qa .qi { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.15rem; background: var(--qc); box-shadow: 0 8px 16px rgba(15, 20, 60, .2); flex-shrink: 0; }
.sec-h { display: flex; align-items: center; gap: .7rem; margin: 1.4rem 0 .8rem; font-size: 1.28rem; font-weight: 700; }
.sec-h .shi { width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 1rem; background: linear-gradient(135deg, var(--brand), var(--mesh2)); box-shadow: 0 8px 16px rgba(15, 20, 60, .2); }
.tasks { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.task { display: flex; align-items: center; gap: 10px; padding: .8rem .85rem; border-radius: 18px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink) !important; text-decoration: none !important; transition: transform .18s, box-shadow .18s; }
.task:hover { transform: translateY(-3px); box-shadow: 0 16px 30px rgba(15, 20, 60, .13); }
.task .ti { width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--tc); flex-shrink: 0; box-shadow: 0 8px 14px rgba(15, 20, 60, .18); }
.task .tt { flex: 1; min-width: 0; line-height: 1.25; } .task .tt b { display: block; font-size: .9rem; } .task .tt small { color: var(--muted); font-size: .78rem; } .task .tt small.need { color: var(--brand); font-weight: 700; }
.task .n { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; background: var(--bg); color: var(--muted); flex-shrink: 0; }
.task.hot { border-color: var(--brand-light); background: linear-gradient(135deg, var(--brand-soft), #fff 75%); box-shadow: 0 12px 26px rgba(15, 20, 60, .12); }
.task.hot .n { background: var(--brand); color: #fff; box-shadow: 0 6px 12px rgba(15, 20, 60, .28); }
.card.rb { position: relative; overflow: hidden; }
.card.rb::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: linear-gradient(90deg, #14b8a6, var(--brand) 55%, #f59e0b); }
.card.rb .card-head { padding-top: 1.35rem; }
.today-grid { display: flex; align-items: center; gap: 18px; }
.ring-s { --p: 0; width: 118px; height: 118px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: conic-gradient(var(--brand) calc(var(--p) * 1%), #e8ebf5 0); }
.ring-s > div { width: 92px; height: 92px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px var(--line); }
.ring-s b { font-size: 1.8rem; line-height: 1; color: var(--brand-dark); } .ring-s b small { font-size: .9rem; } .ring-s span { font-size: .72rem; color: var(--muted); }
.cells { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cell { padding: .65rem .85rem; border-radius: 14px; background: #fafbff; border: 1px solid var(--line); }
.cell b { display: block; font-size: 1.5rem; line-height: 1.15; font-variant-numeric: tabular-nums; } .cell span { font-size: .78rem; color: var(--muted); }
.cell.ok b { color: #10b981; } .cell.warn b { color: #f59e0b; } .cell.bad b { color: #f43f5e; }
.more-link { display: inline-flex; align-items: center; gap: .45rem; margin-top: 1rem; font-weight: 700; color: var(--brand); }
.more-link:hover { gap: .7rem; }
@media (max-width: 1399px) { .tasks, .qa { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 991px) { .h-stats { width: 100%; } .h-stat { flex: 1; min-width: 0; } .top-link { display: none !important; } }
@media (max-width: 575px) { .tasks, .qa { grid-template-columns: repeat(2, minmax(0, 1fr)); } .h-av { width: 64px; height: 64px; font-size: 1.5rem; } .hero-ref h2 { font-size: 1.45rem; } .today-grid { flex-direction: column; align-items: stretch; } .ring-s { margin: 0 auto; } }

@page { size: A4 landscape; margin: 8mm; }
@media print {
  .side, .top, .foot, .page-head, .no-print, .tabs, .dataTables_filter, .dataTables_length, .dataTables_paginate, .dataTables_info { display: none !important; }
  .main { margin: 0 !important; } body { background: #fff !important; } .page { padding: 0; max-width: none; }
  .print-only { display: block; } .card { box-shadow: none !important; border: 0; }
  .mx-wrap { overflow: visible; max-height: none; } .mx { font-size: 7pt; } .mx th, .mx td { border: 1px solid #94a3b8 !important; }
  .mx .name { position: static; min-width: 0; max-width: none; padding: 2px 4px; } .mx .name small { display: none; }
  .mx thead th { position: static; padding: 2px 0; } .mx td.m { height: auto; padding: 2px 0; } .mx tfoot td { position: static; }
}

/* ===== เมนูข้างแบบใหม่: แผงสีขาวลอย + ปุ่มไล่เฉดสีเมื่อเลือก ===== */
:root { --side: 282px; }
.side.side-ref { inset: 12px auto 12px 12px; width: 258px; border-radius: 26px; background: #fff; color: var(--ink); border: 1px solid rgba(80, 90, 170, .1); box-shadow: 0 24px 60px rgba(20, 28, 90, .14), 0 2px 6px rgba(20, 28, 90, .05); overflow: hidden; }
.side-ref .side-brand { margin: 8px 8px 0; padding: .95rem 1rem; border: 0; border-radius: 20px; background: linear-gradient(135deg, var(--brand-dark), var(--brand) 60%, var(--mesh2)); position: relative; overflow: hidden; }
.side-ref .side-brand::after { content: ''; position: absolute; width: 120px; height: 120px; right: -40px; top: -50px; border-radius: 50%; background: rgba(255,255,255,.14); }
.side-ref .side-brand .mk { width: 42px; height: 42px; border-radius: 13px; box-shadow: 0 6px 14px rgba(0,0,0,.25); position: relative; z-index: 1; }
.side-ref .side-brand > span:last-child { position: relative; z-index: 1; }
.side-ref .side-brand small { color: rgba(255,255,255,.78); max-width: 140px; }
.sr-user { margin: .7rem .8rem .1rem; padding: .55rem .7rem; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); }
.sr-user .av { width: 38px; height: 38px; font-size: 1rem; box-shadow: 0 0 0 3px #fff; }
.sr-user .who b { color: var(--ink); font-size: .95rem; }
.sr-user .role { font-size: .68rem; margin-top: .15rem; }
.sr-scroll { padding: .1rem .7rem .6rem; scrollbar-color: #d6d9ea transparent; }
.sr-scroll::-webkit-scrollbar-thumb { background: #d6d9ea; }
.sr-label { color: var(--muted); display: flex; align-items: center; gap: .6rem; padding: 1rem .5rem .4rem; font-size: .68rem; }
.sr-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.sr-item { color: var(--ink) !important; padding: .42rem .55rem; border-radius: 15px; gap: 11px; }
.sr-item .ic { width: 38px; height: 38px; border-radius: 12px; font-size: .98rem; position: relative; background: transparent; overflow: hidden; }
.sr-item .ic::before { content: ''; position: absolute; inset: 0; background: var(--c); opacity: .15; transition: opacity .2s; }
.sr-item .ic i { position: relative; }
.sr-item .tx b { font-size: .98rem; font-weight: 600; }
.sr-item .tx small { color: var(--muted); }
.sr-item:hover { background: var(--bg); }
.sr-item:hover .ic::before { opacity: .26; }
.sr-group.active > .sr-item { background: linear-gradient(100deg, var(--brand), var(--mesh2)); box-shadow: 0 12px 24px rgba(30, 40, 120, .28); }
.sr-group.active > .sr-item .tx b { color: #fff; }
.sr-group.active > .sr-item .tx small { color: rgba(255,255,255,.78); }
.sr-group.active > .sr-item .ic { background: rgba(255,255,255,.22); color: #fff; box-shadow: none; }
.sr-group.active > .sr-item .ic::before { opacity: 0; }
.sr-group.active > .sr-item .sr-toggle, .sr-group.active > .sr-item .sr-ext { color: rgba(255,255,255,.85); }
.sr-item.danger .tx b { color: #e11d48; }
.sr-badge { box-shadow: 0 4px 10px rgba(245, 158, 11, .35); }
.sr-toggle { color: var(--muted); }
.sr-sub { border-left: 2px solid var(--line); margin-left: 1.65rem; }
.sr-sub a { color: var(--ink-2) !important; font-size: .92rem; margin-left: .4rem; }
.sr-sub a:hover { color: var(--brand) !important; background: var(--brand-soft); }
.sr-sub a.on { color: var(--brand-dark) !important; background: var(--brand-soft); font-weight: 700; }
.sr-sub a.on::before { left: -.78rem; box-shadow: 0 0 0 4px var(--brand-soft); background: var(--brand); }
.sr-cta { margin: 0 .8rem .8rem; padding: .85rem; border-radius: 18px; color: #fff; background: linear-gradient(135deg, #f59e0b, #f43f5e); position: relative; overflow: hidden; box-shadow: 0 14px 28px rgba(244, 63, 94, .3); }
.sr-cta::after { content: ''; position: absolute; width: 90px; height: 90px; right: -28px; bottom: -36px; border-radius: 50%; background: rgba(255,255,255,.2); }
.sr-cta b { display: block; font-size: .98rem; } .sr-cta small { display: block; opacity: .92; margin-bottom: .55rem; }
.sr-cta a { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: .45rem; background: #fff; color: #e11d48 !important; font-weight: 700; padding: .32rem .9rem; border-radius: 999px; text-decoration: none !important; font-size: .88rem; }
@media (max-width: 1199px) { .side.side-ref { transform: translateX(-120%); } body.side-open .side.side-ref { transform: none; } }

/* ===== แบนเนอร์หน้าลงเวลา ===== */
.att-hero .hero-in { padding: 1.7rem 1.9rem; }
.att-ico { font-size: 2rem; background: rgba(255,255,255,.2) !important; color: #fff !important; backdrop-filter: blur(8px); }
.att-hero h2 { margin-bottom: .6rem; }
.att-stats .h-stat { min-width: 124px; position: relative; }
.att-stats .h-stat i { display: block; font-size: 1.05rem; opacity: .85; margin-bottom: .2rem; }
.att-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 1rem; }
.att-bar .subnav { background: #fff; padding: 5px; border-radius: 999px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.att-bar .subnav a { padding: .45rem 1.2rem; }
.att-bar .ph-actions .btn { box-shadow: var(--shadow); }
.att-hero ~ .card, .att-bar ~ .card { border-radius: 22px; box-shadow: 0 14px 34px rgba(20, 28, 90, .08); border: 1px solid #fff; }
.att-bar ~ .card .card-head { padding: 1rem 1.25rem; background: linear-gradient(180deg, #fafbff, #fff); border-radius: 22px 22px 0 0; }
.att-bar ~ .card .table thead th { background: var(--brand-soft); color: var(--brand-dark); border-bottom: 0; font-weight: 700; white-space: nowrap; }
.att-bar ~ .card .table tbody tr:hover { background: #fafbff; }
@media (max-width: 991px) { .att-stats { display: grid; grid-template-columns: repeat(2, 1fr); width: 100%; } .att-hero .hero-in { padding: 1.3rem 1.2rem; } }
@media print { .att-hero, .att-bar { display: none !important; } }

/* ไม่ให้เมนูกระพริบเมื่อเปลี่ยนหน้า */
body:not(.ready) .side *, body:not(.ready) .side { transition: none !important; }
.sr-cta { display: none; }

/* ===== หน้าตั้งค่า (ดีไซน์ใหม่) ===== */
.set-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 1.1rem; }
.set-tabs { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.set-tabs .nav-link { display: inline-flex; align-items: center; gap: .55rem; padding: .35rem .95rem .35rem .4rem; border-radius: 15px; color: var(--ink-2); font-weight: 600; background: none; border: 0; }
.set-tabs .nav-link:hover { background: var(--bg); color: var(--ink); }
.set-tabs .si { width: 30px; height: 30px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; color: var(--c); position: relative; overflow: hidden; }
.set-tabs .si::before { content: ''; position: absolute; inset: 0; background: var(--c); opacity: .15; }
.set-tabs .si i { position: relative; }
.set-tabs .nav-link.active { background: linear-gradient(100deg, var(--brand), var(--mesh2)); color: #fff; box-shadow: 0 10px 20px rgba(30, 40, 120, .25); }
.set-tabs .nav-link.active .si { color: #fff; } .set-tabs .nav-link.active .si::before { background: #fff; opacity: .24; }
.tab-content > .tab-pane > .card, .tab-content > .tab-pane .row > [class*="col-"] > .card, .tab-content > .tab-pane form > .row .card { border-radius: 22px; border: 1px solid #fff; box-shadow: 0 14px 34px rgba(20, 28, 90, .08); }
.chk-row { padding: 13px 14px; margin: 0 -14px; border-radius: 14px; border-bottom: 0; }
.chk-row:hover { background: var(--bg); }
.chk-row .ic { width: 28px; height: 28px; font-size: .78rem; box-shadow: 0 6px 12px rgba(15, 20, 60, .18); }
.chk-row.bad { background: #fff1f2; } .chk-row.warn { background: #fffaf0; }
.preview-box { border-radius: 16px; }

/* ตัวเลือกธีมสี */
.preset-grid.pg2 { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.preset.pr2 { flex-direction: column; align-items: stretch; gap: 10px; padding: .7rem; border-radius: 20px; }
.pr2 .mini { display: flex; height: 92px; border-radius: 13px; overflow: hidden; background: #f3f5fb; border: 1px solid rgba(0,0,0,.06); }
.pr2 .ms { width: 26%; background: linear-gradient(180deg, var(--pb), color-mix(in srgb, var(--pb) 70%, #000)); display: block; }
.pr2 .mb { flex: 1; padding: 7px; display: flex; flex-direction: column; gap: 5px; }
.pr2 .mh { display: block; height: 30px; border-radius: 8px; background: linear-gradient(100deg, var(--pb), var(--pa)); }
.pr2 .mc { display: block; height: 10px; border-radius: 5px; background: #dde1ee; width: 80%; }
.pr2 .mp { display: block; height: 12px; width: 38%; border-radius: 999px; background: var(--pa); }
.pr2 .nm { font-size: .92rem; padding: 0 .2rem; }
.pr2 .dots { position: absolute; right: 14px; bottom: 12px; display: flex; gap: 4px; }
.pr2 .dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
.preset.pr2 .ck { right: 14px; top: 14px; font-size: 1.3rem; background: #fff; border-radius: 50%; }
.preset.pr2.on { box-shadow: 0 14px 28px rgba(20, 28, 90, .16); }
.th-sticky { position: sticky; top: 80px; }
.th-demo { display: flex; height: 150px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.td-side { width: 52px; background: linear-gradient(185deg, var(--brand-dark), var(--brand)); display: flex; flex-direction: column; align-items: center; gap: 9px; padding-top: 12px; color: #fff; }
.td-side span { width: 28px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.28); } .td-side span.on { background: var(--accent); height: 10px; }
.td-main { flex: 1; padding: 10px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.td-hero { border-radius: 12px; padding: .7rem .8rem; color: #fff; background: linear-gradient(100deg, var(--brand-dark), var(--brand) 55%, var(--mesh2)); }
.td-hero b { display: block; } .td-hero small { opacity: .85; }
.td-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.th-shades { display: flex; border-radius: 12px; overflow: hidden; height: 26px; border: 1px solid var(--line); } .th-shades i { flex: 1; display: block; }
@media (max-width: 767px) { .set-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; } .set-tabs .nav-link { white-space: nowrap; } .set-bar > .btn { width: 100%; } }
@media print { .set-bar { display: none !important; } }

/* ===== โทนสีเดียว: ไอคอนเมนู/แท็บและแถบรุ้งใช้เฉดของสีหลักเท่านั้น ===== */
.card.rb::before { background: linear-gradient(90deg, var(--brand-dark), var(--brand) 55%, var(--brand-light)); }
.pr2 .ms { background: linear-gradient(180deg, var(--pb), color-mix(in srgb, var(--pb) 72%, #000)); }
.pr2 .mh { background: linear-gradient(100deg, color-mix(in srgb, var(--pb) 78%, #000), var(--pb) 60%, color-mix(in srgb, var(--pb) 70%, #fff)); }
.pr2 .mp { background: color-mix(in srgb, var(--pb) 55%, #fff); }

/* ไอคอนเมนูคนละสี: ปุ่มไล่เฉดสีสดพร้อมไอคอนสีขาว (สีของระบบยังเป็นสีเดียว) */
.sr-item .ic { color: #fff; box-shadow: 0 8px 16px -4px var(--c); }
.sr-item .ic::before { background: linear-gradient(135deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); opacity: 1; }
.sr-item:hover .ic::before { opacity: 1; filter: brightness(1.08); }
.sr-group.active > .sr-item .ic { box-shadow: 0 0 0 2px rgba(255,255,255,.55); }
.sr-group.active > .sr-item .ic::before { opacity: 1; }
.set-tabs .si { color: #fff; }
.set-tabs .si::before { background: linear-gradient(135deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); opacity: 1; }
.set-tabs .nav-link.active .si::before { background: rgba(255,255,255,.26); }

/* ===== เมนูแบบ AdminLTE: แถบข้างสีเข้ม เต็มความสูง ไอคอนเรียบ ===== */
:root { --side: 250px; --lte: #343a40; --lte-2: #3f474e; }
.side.side-ref { inset: 0 auto 0 0; width: var(--side); border-radius: 0; background: var(--lte); color: #c2c7d0; border: 0; box-shadow: 0 14px 28px rgba(0,0,0,.25), 0 10px 10px rgba(0,0,0,.22); }
.side-ref .side-brand { margin: 0; padding: .8rem .95rem; height: 57px; border-radius: 0; background: transparent; border-bottom: 1px solid #4b545c; gap: 10px; }
.side-ref .side-brand::after { display: none; }
.side-ref .side-brand .mk { width: 33px; height: 33px; border-radius: 50%; background: #fff; box-shadow: 0 3px 6px rgba(0,0,0,.3); }
.side-ref .side-brand b { color: #fff; font-size: 1.05rem; font-weight: 300; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.side-ref .side-brand small { display: none; }
.sr-user { margin: 0 .5rem; padding: .8rem .4rem; border-radius: 0; background: transparent; border: 0; border-bottom: 1px solid #4b545c; gap: 10px; }
.sr-user .av { width: 34px; height: 34px; font-size: .95rem; box-shadow: none; }
.sr-user .who b { color: #c2c7d0; font-weight: 400; font-size: 1rem; }
.sr-user .role { background: none; color: #8a929a; padding: 0; font-weight: 400; font-size: .75rem; }
.sr-scroll { padding: .5rem .5rem 1rem; scrollbar-color: #5b646c transparent; }
.sr-scroll::-webkit-scrollbar-thumb { background: #5b646c; }
.sr-label { display: block; padding: .9rem .6rem .35rem; color: #8a929a; font-size: .72rem; letter-spacing: .08em; font-weight: 600; }
.sr-label::after { display: none; }
.sr-group { margin-bottom: 2px; }
.sr-item { color: #c2c7d0 !important; padding: .5rem .8rem; border-radius: 4px; gap: 10px; }
.sr-item .ic, .sr-item .ic::before { background: none !important; box-shadow: none !important; }
.sr-item .ic { width: 1.6rem; height: auto; border-radius: 0; font-size: 1rem; color: #c2c7d0 !important; overflow: visible; }
.sr-item .ic::before { display: none; }
.sr-item .tx b { font-size: .98rem; font-weight: 400; color: #c2c7d0; }
.sr-item .tx small { display: none; }
.sr-item:hover { background: rgba(255,255,255,.1); }
.sr-item:hover .tx b, .sr-item:hover .ic { color: #fff !important; }
.sr-group.active > .sr-item { background: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.sr-group.active > .sr-item .tx b, .sr-group.active > .sr-item .ic { color: #fff !important; font-weight: 400; }
.sr-group.active > .sr-item .ic { box-shadow: none !important; }
.sr-item.danger .tx b { color: #ff8a8a; }
.sr-toggle { color: #c2c7d0; width: 20px; height: 22px; }
.sr-group.active > .sr-item .sr-toggle { color: #fff; }
.sr-sub { border: 0; margin: 0; }
.sr-group.open .sr-sub { padding: .15rem 0 .1rem; }
.sr-sub a { margin: 0 0 1px 0; padding: .4rem .8rem .4rem 2.35rem; border-radius: 4px; color: #c2c7d0 !important; font-size: .92rem; }
.sr-sub a::after { content: ''; position: absolute; left: 1.05rem; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; border: 1px solid #8a929a; }
.sr-sub a:hover { background: rgba(255,255,255,.1); color: #fff !important; }
.sr-sub a.on { background: rgba(255,255,255,.16); color: #fff !important; font-weight: 400; }
.sr-sub a.on::before { display: none; }
.sr-sub a.on::after { background: #fff; border-color: #fff; }
.sr-badge { box-shadow: none; }
.top { height: 57px; background: #fff; border-bottom: 1px solid #dee2e6; backdrop-filter: none; }
.set-tabs .si { color: var(--c); } .set-tabs .si::before { background: var(--c); opacity: .15; }
.set-tabs .nav-link.active .si { color: #fff; } .set-tabs .nav-link.active .si::before { background: #fff; opacity: .25; }
@media (max-width: 1199px) { .side.side-ref { transform: translateX(-105%); } body.side-open .side.side-ref { transform: none; } }

/* ===== ปรับตามอุปกรณ์ (Responsive) ===== */
html, body { overflow-x: hidden; }
img, canvas, video { max-width: 100%; }
.card-body.card-flush, .table-responsive, .mx-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card-body.card-flush > table, .card-body.card-flush .dataTables_wrapper { min-width: 640px; }
@media (max-width: 1399px) { .qa { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 991px) {
  .page { padding: 1rem .9rem 2rem; }
  .hero-in { padding: 1.2rem 1.1rem; gap: 14px; }
  .h-left { gap: 12px; } .hero-ref h2 { font-size: 1.5rem; }
  .h-stats, .att-stats { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .h-stat { min-width: 0; padding: .6rem .5rem; } .h-stat b { font-size: 1.45rem; }
  .card-head { padding: .85rem 1rem; }
  .att-bar, .set-bar { flex-direction: column; align-items: stretch; }
  .att-bar .ph-actions { display: flex; } .att-bar .ph-actions .btn { flex: 1; }
  .date-nav { width: 100%; } .date-nav .form-control { flex: 1; }
  .mini-stats { width: 100%; }
  .chk-grid { grid-template-columns: 1fr; }
  .zone-wrap { display: block; }
  .top .crumb { display: none; }
}
@media (max-width: 575px) {
  .page { padding: .8rem .7rem 1.6rem; }
  .hero-ref { border-radius: 20px; } .h-av { width: 56px; height: 56px; font-size: 1.3rem; }
  .h-chips span { font-size: .78rem; }
  .qa, .tasks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .qa a { padding: .65rem; gap: 8px; } .qa .qi { width: 36px; height: 36px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .modal-dialog { margin: .6rem; }
  .preset-grid.pg2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .th-sticky { position: static; }
  .btn-lg { padding: .6rem 1rem; }
  .user-btn span.d-lg-inline { display: none !important; }
  .swal2-popup { width: 92% !important; }
}

/* ===== จุดสแกนแบบใหม่ (kiosk มืออาชีพ) ===== */
body.kiosk.k2b { background: #0b1230; color: #fff; min-height: 100vh; }
.k2-bg { position: fixed; inset: 0; z-index: 0; background-size: cover; background-position: center; background-color: var(--brand-dark); }
.k2-bg::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(8,12,40,.9), color-mix(in srgb, var(--brand-dark) 80%, #000) 55%, rgba(8,12,40,.92)); }
.k2-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(60% 50% at 85% 0%, color-mix(in srgb, var(--brand) 55%, transparent), transparent 70%), radial-gradient(50% 45% at 0% 100%, color-mix(in srgb, var(--mesh2) 40%, transparent), transparent 70%); }
.kiosk-wrap.k2 { position: relative; z-index: 1; max-width: 1560px; padding: 18px 24px 26px; }
.k2-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.k2 .kiosk-brand .t1 { color: #fff; font-size: 1.35rem; } .k2 .kiosk-brand .t2 { color: rgba(255,255,255,.7); }
.k2 .kiosk-brand img { background: #fff; border: 0; box-shadow: 0 8px 20px rgba(0,0,0,.35); } .k2 .kiosk-brand .kb-ico { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); }
.k2-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.k2-tools .form-control { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 12px; max-width: 220px; height: 40px; }
.k2-tools .form-control option { color: #111; }
.k2 .btn-glass { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 12px; backdrop-filter: blur(8px); }
.k2 .btn-glass:hover { background: rgba(255,255,255,.22); color: #fff; }
.k2-grid { grid-template-columns: minmax(0, 1.75fr) minmax(330px, 1fr); gap: 22px; align-items: start; }
.k2-cam { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); border-radius: 28px; padding: 14px; backdrop-filter: blur(14px); box-shadow: 0 30px 70px rgba(0,0,0,.4); }
.k2-frame { border-radius: 20px; overflow: hidden; background: #05081c; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.k2-c { position: absolute; width: 46px; height: 46px; z-index: 3; pointer-events: none; border: 0 solid var(--accent-light); }
.k2-c.tl { left: 16px; top: 16px; border-width: 4px 0 0 4px; border-top-left-radius: 14px; } .k2-c.tr { right: 16px; top: 16px; border-width: 4px 4px 0 0; border-top-right-radius: 14px; }
.k2-c.bl { left: 16px; bottom: 16px; border-width: 0 0 4px 4px; border-bottom-left-radius: 14px; } .k2-c.br { right: 16px; bottom: 16px; border-width: 0 4px 4px 0; border-bottom-right-radius: 14px; }
.k2-scanline { position: absolute; left: 6%; right: 6%; height: 3px; z-index: 3; top: 8%; border-radius: 3px; pointer-events: none; background: linear-gradient(90deg, transparent, var(--accent-light), transparent); box-shadow: 0 0 18px 4px color-mix(in srgb, var(--accent-light) 60%, transparent); animation: k2scan 3.2s ease-in-out infinite; }
@keyframes k2scan { 0%, 100% { top: 8%; opacity: .2; } 50% { top: 90%; opacity: 1; } }
.k2-live { position: absolute; left: 22px; top: 70px; z-index: 3; display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 700; letter-spacing: .1em; padding: .15rem .7rem; border-radius: 999px; background: rgba(0,0,0,.5); color: #fff; }
.k2-live i { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: pulse 1.4s infinite; }
.k2 .diag { border-top-color: rgba(255,255,255,.14); color: rgba(255,255,255,.85); margin: .8rem .3rem .2rem; }
.k2 .diag .msg { color: rgba(255,255,255,.85); } .k2 .diag .msg.bad { color: #fecdd3; }
.k2-side { display: flex; flex-direction: column; gap: 14px; }
.k2-clock { text-align: center; padding: 1.1rem 1rem; border-radius: 26px; background: linear-gradient(135deg, var(--brand), var(--mesh2)); box-shadow: 0 24px 50px rgba(0,0,0,.38); position: relative; overflow: hidden; }
.k2-clock::after { content: ''; position: absolute; width: 180px; height: 180px; right: -60px; top: -80px; border-radius: 50%; background: rgba(255,255,255,.14); }
.k2-clock .time { font-size: 3.6rem; font-weight: 700; line-height: 1; letter-spacing: 2px; font-variant-numeric: tabular-nums; text-shadow: 0 4px 18px rgba(0,0,0,.3); position: relative; }
.k2-clock .date { opacity: .92; margin-top: .3rem; position: relative; }
.k2-rule { display: inline-block; margin-top: .6rem; padding: .2rem .9rem; border-radius: 999px; background: rgba(255,255,255,.2); font-size: .85rem; font-weight: 600; position: relative; }
.k2-card { border-radius: 24px; background: rgba(255,255,255,.95); color: var(--ink); box-shadow: 0 20px 44px rgba(0,0,0,.3); padding: 1rem; }
.k2-status { min-height: 210px; display: flex; flex-direction: column; justify-content: center; padding: .6rem; }
.k2-status .scan-idle { padding: 18px 10px; } .k2-status .idle-t { font-size: 1.3rem; font-weight: 700; color: var(--ink); }
.k2-status .scan-result { padding: 1.3rem 1rem; border-radius: 18px; }
.k2-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.k2-stat { border-radius: 20px; padding: .8rem .5rem; text-align: center; color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(10px); }
.k2-stat i { opacity: .8; display: block; margin-bottom: .15rem; } .k2-stat b { display: block; font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; } .k2-stat small { opacity: .85; font-size: .78rem; }
.k2-stat.s1 { background: linear-gradient(135deg, rgba(16,185,129,.55), rgba(16,185,129,.2)); }
.k2-prog { height: 8px; border-radius: 8px; background: rgba(255,255,255,.15); overflow: hidden; margin-top: -4px; } .k2-prog i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, #34d399, #10b981); transition: width .6s; }
.k2-recentbox { padding: .9rem 1rem; }
.k2-h { font-weight: 700; margin-bottom: .3rem; } .k2-h i { color: var(--brand); margin-right: .4rem; }
.k2 .recent-list { max-height: 260px; }
@media (max-width: 1199px) { .k2-grid { grid-template-columns: 1fr; } .k2-clock .time { font-size: 2.8rem; } }
@media (max-width: 575px) { .kiosk-wrap.k2 { padding: 12px; } .k2-tools .form-control { max-width: 100%; flex: 1; } .k2-stat b { font-size: 1.5rem; } .k2-cam { padding: 8px; border-radius: 20px; } }

/* ===== หน้าบุคลากร ===== */
.pp-actions { display: flex; flex-wrap: wrap; gap: 8px; position: relative; z-index: 1; }
.pp-actions .btn-glass { background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4); color: #fff; backdrop-filter: blur(8px); border-radius: 12px; }
.pp-actions .btn-glass:hover { background: rgba(255,255,255,.32); color: #fff; }
.btn-gold { background: linear-gradient(135deg, var(--accent-light), var(--accent)); color: var(--accent-ink) !important; border: 0; font-weight: 700; border-radius: 12px; box-shadow: 0 10px 22px rgba(0,0,0,.25); }
.btn-gold:disabled { opacity: .55; }
.pp-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.pp-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 1rem; border-radius: 20px; background: #fff; border: 1px solid #fff; box-shadow: 0 12px 28px rgba(20, 28, 90, .09); overflow: hidden; }
.pp-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--pc); }
.pp-card .pi { width: 48px; height: 48px; border-radius: 15px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.2rem; background: var(--pc); box-shadow: 0 10px 18px -4px var(--pc); flex-shrink: 0; }
.pp-card b { display: block; font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; } .pp-card small { color: var(--muted); }
.pp-card .pp-pct { margin-left: auto; font-weight: 700; color: var(--pc); background: color-mix(in srgb, var(--pc) 14%, #fff); padding: .1rem .6rem; border-radius: 999px; font-size: .85rem; }
.pp-card.c1 { --pc: #3b82f6; } .pp-card.c2 { --pc: #10b981; } .pp-card.c3 { --pc: #f59e0b; } .pp-card.c4 { --pc: #8b5cf6; } .pp-card.c5 { --pc: #ec4899; }
.pp-bar { height: 6px; border-radius: 6px; background: #e6e9f5; margin: .7rem 0 1.1rem; overflow: hidden; } .pp-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand), #10b981); }
.hero-ref + .pp-cards, .att-hero + .pp-cards { margin-top: 0; }
.pp-cards ~ .card { border-radius: 22px; border: 1px solid #fff; box-shadow: 0 14px 34px rgba(20, 28, 90, .08); }
.pp-cards ~ .card .card-head { padding: 1rem 1.25rem; background: linear-gradient(180deg, #fafbff, #fff); border-radius: 22px 22px 0 0; }
.pp-cards ~ .card .table thead th { background: var(--brand-soft); color: var(--brand-dark); border-bottom: 0; font-weight: 700; white-space: nowrap; }
.pp-cards ~ .card .table tbody tr:hover { background: #fafbff; }
.pp-cards ~ .card .avatar { width: 40px; height: 40px; background: linear-gradient(135deg, var(--brand), var(--mesh2)); color: #fff; }
@media (max-width: 1199px) { .pp-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 575px) { .pp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .pp-card { padding: .7rem; gap: 8px; } .pp-card .pi { width: 38px; height: 38px; font-size: 1rem; } .pp-card b { font-size: 1.4rem; } .pp-actions .btn { flex: 1 1 100%; } }

/* ===== รอบปรับ: หน้าบุคลากร + จุดสแกน แบบสว่าง เรียบ สะอาด ===== */
.pp-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 1.2rem; }
.pp-head .page-title { margin: 0; }
.pp-actions .btn-line { background: #fff; }
.pp-cards { gap: 14px; }
.pp-card { padding: .9rem 1rem; border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(20, 28, 90, .06); }
.pp-card::before { display: none; }
.pp-card .pi { width: 52px; height: 52px; border-radius: 12px; box-shadow: none; background: color-mix(in srgb, var(--pc) 14%, #fff); color: var(--pc); font-size: 1.3rem; }
.pp-card b { font-size: 1.7rem; color: var(--ink); }
.pp-card .pp-pct { background: none; padding: 0; font-size: .9rem; }
.pp-bar { height: 4px; margin: .9rem 0 1.2rem; background: var(--line); } .pp-bar i { background: var(--brand); }
.pp-cards ~ .card { border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(20, 28, 90, .06); }
.pp-cards ~ .card .card-head { background: #fff; border-radius: 12px 12px 0 0; }
.pp-cards ~ .card .table thead th { background: #f8f9fc; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--line); }
.pp-cards ~ .card .avatar { background: var(--brand-soft); color: var(--brand-dark); }

/* จุดสแกนแบบสว่าง */
body.kiosk.k2b { background: #f4f6f9; color: var(--ink); }
.k2-bg { opacity: .1; } .k2-bg::before, .k2-bg::after { display: none; } .k2-bg { background-color: transparent; }
.k2 .kiosk-brand .t1 { color: var(--ink); } .k2 .kiosk-brand .t2 { color: var(--muted); }
.k2 .kiosk-brand img { box-shadow: none; border: 1px solid var(--line); } .k2 .kiosk-brand .kb-ico { background: var(--brand); border: 0; }
.k2-top { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .65rem 1rem; box-shadow: 0 1px 3px rgba(20, 28, 90, .06); }
.k2-tools .form-control { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.k2 .btn-glass { background: #fff; border: 1px solid var(--line); color: var(--ink-2); backdrop-filter: none; }
.k2 .btn-glass:hover { background: var(--bg); color: var(--ink); }
.k2-cam { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 3px rgba(20, 28, 90, .06); backdrop-filter: none; }
.k2-frame { border-radius: 10px; box-shadow: none; }
.k2-c { border-color: #fff; opacity: .9; } .k2-scanline { display: none; }
.k2 .diag { border-top-color: var(--line-2); color: var(--ink-2); } .k2 .diag .msg { color: var(--ink-2); } .k2 .diag .msg.bad { color: #be123c; }
.k2-clock { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 3px rgba(20, 28, 90, .06); border-top: 4px solid var(--brand); }
.k2-clock::after { display: none; }
.k2-clock .time { color: var(--brand); text-shadow: none; font-size: 3.4rem; }
.k2-clock .date { color: var(--muted); }
.k2-rule { background: var(--brand-soft); color: var(--brand-dark); }
.k2-card { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 3px rgba(20, 28, 90, .06); }
.k2-stat { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: none; box-shadow: 0 1px 3px rgba(20, 28, 90, .06); }
.k2-stat i { opacity: 1; color: var(--brand); } .k2-stat small { color: var(--muted); opacity: 1; }
.k2-stat.s1 { background: #ecfdf5; border-color: #a7f3d0; } .k2-stat.s1 i, .k2-stat.s1 b { color: #059669; }
.k2-prog { background: var(--line); }

/* ===== รายงานสรุปรายเดือน (พิมพ์) ===== */
.rpt-foot { display: none; }
@page { size: A4 landscape; margin: 9mm 8mm; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body, .main { background: #fff !important; background-image: none !important; }
  .main { margin: 0 !important; }
  .page { padding: 0 !important; }
  .rpt-head.print-only { display: block; margin-bottom: 8px; }
  .rpt-title { display: flex; align-items: center; gap: 12px; padding-bottom: 6px; border-bottom: 2.5px solid var(--brand); }
  .rpt-logo { width: 54px; height: 54px; object-fit: contain; }
  .rpt-school { font-size: 10pt; color: #475569; font-weight: 600; }
  .rpt-title h1 { font-size: 16pt; font-weight: 700; margin: 0; color: #111827; line-height: 1.2; }
  .rpt-sub { font-size: 10.5pt; color: var(--brand-dark); font-weight: 600; }
  .rpt-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 7px; }
  .rpt-kpis div { border: 1px solid #cbd5e1; border-top: 3px solid var(--brand); border-radius: 4px; padding: 3px 6px; text-align: center; }
  .rpt-kpis b { display: block; font-size: 13pt; line-height: 1.15; color: #111827; } .rpt-kpis span { font-size: 7.5pt; color: #64748b; }
  .card { border: 0 !important; margin: 0 !important; border-radius: 0 !important; background: none !important; }
  .mx { font-size: 7pt; counter-reset: rw; width: 100%; }
  .mx th, .mx td { border: 0.6px solid #94a3b8 !important; }
  .mx thead th { background: var(--brand) !important; color: #fff !important; }
  .mx thead th .dn { color: #fff !important; } .mx thead th .wd { color: rgba(255,255,255,.85) !important; }
  .mx thead th.off { background: #64748b !important; }
  .mx thead th.today .dn { background: none !important; width: auto; height: auto; line-height: inherit; }
  .mx tbody tr { counter-increment: rw; page-break-inside: avoid; }
  .mx tbody tr:nth-child(even) td.name { background: #f8fafc !important; }
  .mx tbody td.name { text-align: left; }
  .mx tbody td.name::before { content: counter(rw) '.'; display: inline-block; width: 16px; color: #64748b; }
  .mx .name b { display: inline; font-weight: 600; }
  .mx td.m:hover { outline: 0; }
  .mx tfoot td { background: #e2e8f0 !important; color: #111827; }
  .mx thead { display: table-header-group; } .mx tfoot { display: table-row-group; }
  .rpt-foot { display: block; margin-top: 8px; page-break-inside: avoid; }
  .rpt-legend { font-size: 8pt; color: #475569; margin-bottom: 8px; }
  .rpt-sign { display: flex; justify-content: space-around; text-align: center; font-size: 9.5pt; margin-top: 18px; }
  .rpt-sign > div { width: 28%; } .rpt-sign .ln { display: block; border-bottom: 1px dotted #475569; height: 26px; margin: 0 10% 4px; } .rpt-sign small { color: #64748b; }
  .rpt-meta { text-align: right; font-size: 7.5pt; color: #94a3b8; margin-top: 8px; }
}

/* ===== พิมพ์: แก้ตารางที่ถูกบีบ/มีแถบเลื่อน ให้เต็มความกว้างกระดาษ ===== */
@media print {
  .card-body.card-flush, .table-responsive, .mx-wrap { overflow: visible !important; max-height: none !important; }
  .mx-wrap { width: 100% !important; }
  .mx { width: 100% !important; table-layout: fixed; font-size: 8pt; border-collapse: collapse !important; }
  .mx th, .mx td { border: .6px solid #9aa5b4 !important; }
  .mx .name, .mx thead .name { width: 52mm !important; min-width: 52mm !important; max-width: 52mm !important; white-space: normal !important; text-align: left !important; padding: 3px 6px !important; position: static !important; }
  .mx .name b { display: block !important; font-size: 8.5pt; line-height: 1.25; }
  .mx .name small { display: block !important; font-size: 6.8pt; color: #64748b; line-height: 1.2; }
  .mx tbody td.name::before { display: none; }
  .mx tbody td.name b::before { content: counter(rw) '. '; color: #64748b; font-weight: 400; }
  .mx .c-day { width: auto !important; min-width: 0 !important; }
  .mx thead th { padding: 4px 0 !important; font-size: 7pt; }
  .mx thead th .dn { font-size: 8.5pt !important; } .mx thead th .wd { font-size: 6pt !important; }
  .mx td.m { height: 22px !important; font-size: 8.5pt; padding: 0 !important; }
  .mx .tot { width: 11mm !important; min-width: 11mm !important; font-size: 8.5pt; }
  .mx thead th.tot { font-size: 6.8pt; line-height: 1.15; background: #334155 !important; }
  .mx tfoot td { font-size: 8pt; padding: 4px 0 !important; }
  .mx tfoot td.name { text-align: right !important; }
  .mx td.m-present { color: #059669 !important; } .mx td.m-late { background: #fff1d6 !important; color: #b45309 !important; }
  .mx td.m-absent { background: #fde2e2 !important; color: #dc2626 !important; } .mx td.m-waiting, .mx td.m-future { color: #cbd5e1 !important; }
  .mx td.off { background: repeating-linear-gradient(-45deg, #f1f5f9 0 3px, #e2e8f0 3px 6px) !important; }
  .rpt-title h1 { font-size: 18pt; } .rpt-kpis b { font-size: 14pt; }
}

/* ===== ระบบใบลา ===== */
.lv-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .75rem; border-radius: 999px; font-weight: 600; font-size: .88rem; color: var(--c); background: color-mix(in srgb, var(--c) 13%, #fff); border: 1px solid color-mix(in srgb, var(--c) 30%, #fff); white-space: nowrap; }
.lv-chip::before, .lv-dot { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; }
.lv-dot { margin-right: .4rem; }
.lv-reason { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.btn-ok, .btn-no { border: 0; color: #fff !important; border-radius: 10px; }
.btn-ok { background: #10b981; } .btn-ok:hover { background: #059669; }
.btn-no { background: #f43f5e; } .btn-no:hover { background: #e11d48; }
.lv-days { height: calc(1.5em + .75rem + 2px); display: flex; align-items: center; padding: 0 .75rem; border-radius: .25rem; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: .92rem; }
.lv-num { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; } .lv-num.zero { color: #cbd5e1; font-weight: 500; } .lv-num.over { color: #e11d48; }
.lv-bar { height: 5px; border-radius: 5px; background: #e6e9f5; margin: 3px auto 1px; max-width: 90px; overflow: hidden; } .lv-bar i { display: block; height: 100%; border-radius: 5px; } .lv-bar i.over { box-shadow: inset 0 0 0 1px #e11d48; }
.lv-type-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.lv-type-row.off { opacity: .55; }
.lv-type-row .form-control { flex: 1; min-width: 0; } .lv-type-row .lv-max { max-width: 130px; flex: none; } .lv-type-row .lv-act { max-width: 100px; flex: none; }
.lv-color { width: 38px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: #fff; flex: none; cursor: pointer; }
.mx td.m-leave { color: #0369a1; background: #e8f4fb; }
@media (max-width: 575px) { .lv-type-row { flex-wrap: wrap; } .lv-type-row .lv-max, .lv-type-row .lv-act { max-width: none; flex: 1; } }

/* ===== ใบลา: พอร์ทัลบุคลากร / พิจารณาใบลา / ลายมือชื่อ ===== */
.lv-bal { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 1.2rem; }
.lv-bcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1rem; border-top: 4px solid var(--c); box-shadow: 0 1px 3px rgba(20, 28, 90, .06); }
.lv-bcard .nm { font-weight: 600; } .lv-bcard .big { font-size: 1.6rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; } .lv-bcard .big small { font-size: .85rem; color: var(--muted); font-weight: 500; }
.lv-bar2 { display: flex; height: 6px; border-radius: 6px; background: #e6e9f5; overflow: hidden; margin: 4px 0; } .lv-bar2 .u { background: var(--c); } .lv-bar2 .p { background: repeating-linear-gradient(45deg, var(--c) 0 3px, transparent 3px 6px); opacity: .6; }
.lv-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lv-steps span { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; color: #94a3b8; }
.lv-steps span i { font-size: .62rem; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #e2e8f0; color: #fff; }
.lv-steps span em { font-style: normal; }
.lv-steps span.done { color: #059669; } .lv-steps span.done i { background: #10b981; }
.lv-steps span.now { color: #d97706; font-weight: 700; } .lv-steps span.now i { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.lv-steps span.bad { color: #e11d48; font-weight: 700; } .lv-steps span.bad i { background: #f43f5e; }
.sig-wrap { position: relative; border: 1px solid #c5cde0; border-radius: 12px; background: #fff; overflow: hidden; }
.sig-pad { display: block; width: 100%; height: 150px; touch-action: none; cursor: crosshair; }
.sig-line { position: absolute; left: 22px; right: 22px; bottom: 32px; border-bottom: 1px dashed #b9c4dd; pointer-events: none; }
.lv-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0 0 .8rem; } .lv-dl div { min-width: 0; } .lv-dl .w { grid-column: 1 / -1; }
.lv-dl dt { font-weight: 400; color: var(--muted); font-size: .84rem; } .lv-dl dd { margin: 0; word-wrap: break-word; }
.lv-alert { padding: .5rem .8rem; border-radius: 10px; background: #ecfdf5; color: #047857; font-size: .92rem; } .lv-alert.over { background: #fff1f2; color: #be123c; }
.decision { display: flex; gap: 10px; } .decision label { flex: 1; margin: 0; cursor: pointer; } .decision input { position: absolute; opacity: 0; }
.decision span { display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: .7rem; font-weight: 600; color: var(--ink-2); }
.decision input:checked + span.ok { border-color: #10b981; background: #ecfdf5; color: #047857; box-shadow: inset 0 0 0 1px #10b981; }
.decision input:checked + span.no { border-color: #f43f5e; background: #fff1f2; color: #be123c; box-shadow: inset 0 0 0 1px #f43f5e; }
@media (max-width: 575px) { .lv-dl { grid-template-columns: 1fr; } }

/* ===== กระดิ่งแจ้งเตือน ===== */
button.bell { border: 0; background: none; cursor: pointer; padding: 0; }
.notif-menu { width: 360px; max-width: calc(100vw - 24px); padding: 0; border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(20, 28, 90, .2); overflow: hidden; }
.nf-h { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--line-2); background: #fafbff; }
.nf-h small { color: var(--brand); font-weight: 700; }
.nf-list { max-height: 380px; overflow-y: auto; }
.nf-item { display: flex; gap: 12px; padding: .7rem 1rem; border-bottom: 1px solid var(--line-2); color: var(--ink) !important; text-decoration: none !important; }
.nf-item:hover { background: var(--bg); }
.nf-item.new { background: var(--brand-soft); }
.nf-ic { width: 38px; height: 38px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--c); box-shadow: 0 6px 12px -4px var(--c); }
.nf-tx { min-width: 0; line-height: 1.35; } .nf-tx b { display: block; font-size: .93rem; } .nf-tx small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nf-tx em { font-style: normal; font-size: .75rem; color: #94a3b8; } .nf-item.new .nf-tx em { color: var(--brand); font-weight: 600; }
.nf-empty { text-align: center; padding: 2rem 1rem; color: var(--muted); } .nf-empty i { display: block; font-size: 1.8rem; margin-bottom: .4rem; opacity: .5; }
.sig-pad { height: 150px; }

/* ===== ฟอร์มใบลา (โมดัล) ===== */
.lv-modal { border: 0; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(20, 28, 90, .3); }
.lv-modal .modal-header { align-items: center; gap: 14px; padding: 1.1rem 1.4rem; border: 0; color: #fff; background: linear-gradient(120deg, var(--brand-dark), var(--brand) 60%, var(--mesh2)); position: relative; overflow: hidden; }
.lv-modal .modal-header::after { content: ''; position: absolute; width: 150px; height: 150px; right: -40px; top: -70px; border-radius: 50%; background: rgba(255,255,255,.14); }
.lv-modal .modal-header .modal-title { color: #fff; font-weight: 700; } .lv-modal .modal-header .text-muted { color: rgba(255,255,255,.8) !important; }
.lv-modal .modal-header .close { color: #fff; opacity: .85; text-shadow: none; margin-left: auto; position: relative; z-index: 1; }
.lv-modal .mh-ic { width: 46px; height: 46px; border-radius: 14px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35); position: relative; z-index: 1; }
.lv-modal .modal-header > div { position: relative; z-index: 1; }
.lv-modal .modal-body { padding: 1.3rem 1.4rem; background: #fafbff; }
.lv-modal label { font-weight: 600; font-size: .88rem; color: var(--ink-2); margin-bottom: .3rem; }
.lv-modal .form-control, .lv-modal .custom-select { border-radius: 12px; border-color: #dfe3f1; background-color: #fff; min-height: 42px; }
.lv-modal .form-control:focus, .lv-modal .custom-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.lv-modal textarea.form-control { min-height: 0; }
.lv-modal .lv-days { border-radius: 12px; min-height: 42px; height: auto; font-size: 1rem; }
.lv-modal .sig-wrap { border-radius: 14px; border: 2px dashed #cfd6ea; background: #fff; }
.lv-modal .modal-footer { border: 0; background: #fff; padding: .9rem 1.4rem; }
.lv-modal .callout { border-radius: 14px; }

.lv-preset { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: .7rem .9rem; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); margin-bottom: 1rem; font-size: .9rem; }
.lv-preset .btn { white-space: nowrap; }
@media (max-width: 575px) { .lv-preset { flex-direction: column; align-items: stretch; } }

/* ลาที่ยื่นแล้วรออนุมัติ: ลายทแยงเตือนว่ายังไม่อนุมัติ */
.mx td.m-leave.lv-pend { background-image: repeating-linear-gradient(-45deg, rgba(245,158,11,.22) 0 4px, transparent 4px 8px); color: #b45309; }

.av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.av { overflow: hidden; }
.pf-av { width: 110px; height: 110px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, var(--brand), var(--mesh2)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; font-weight: 700; box-shadow: 0 14px 28px rgba(20,28,90,.25); border: 4px solid #fff; }
.pf-av img { width: 100%; height: 100%; object-fit: cover; }

/* ฟอร์มใบลาบนมือถือ: เต็มจอแบบแผ่นหน้าต่าง หัว/ท้ายตรึง ช่องวันที่เรียง 2 คอลัมน์ */
@media (max-width: 575.98px) {
  .modal-dialog.lv-dialog { margin: 0; max-width: 100%; min-height: 100%; display: flex; align-items: stretch; }
  .lv-dialog .lv-modal { border-radius: 0; min-height: 100vh; width: 100%; }
  .lv-modal .modal-header { position: sticky; top: 0; z-index: 6; padding: .85rem 1rem; }
  .lv-modal .modal-header .modal-title { font-size: 1.05rem; }
  .lv-modal .modal-header .small { display: none; }
  .lv-modal .mh-ic { width: 38px; height: 38px; font-size: 1rem; border-radius: 12px; }
  .lv-modal .modal-body { padding: 1rem; flex: 1 1 auto; }
  .lv-modal .form-group { margin-bottom: .8rem; }
  .lv-modal .modal-footer { position: sticky; bottom: 0; z-index: 6; padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom)); box-shadow: 0 -8px 20px rgba(20, 28, 90, .08); flex-wrap: nowrap; }
  .lv-modal .modal-footer .btn { flex: 1; margin: 0 !important; }
  .lv-modal .modal-footer .mr-auto { flex: 0 0 auto; }
  .lv-modal .form-row { margin-left: -6px; margin-right: -6px; }
  .lv-modal .form-row > [class*="col"] { padding-left: 6px; padding-right: 6px; }
  .lv-modal .callout { font-size: .85rem; }
  .lv-modal .sig-pad { height: 130px; }
}

/* ---------- แดชบอร์ด: สรุปใบลา ---------- */
.sec-h .btn { font-size: .85rem; white-space: nowrap; }
.lvs-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 1rem; }
.lvs-tile { position: relative; overflow: hidden; display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'ti n' 'ti s' 'em em'; column-gap: 14px; align-items: center; padding: 1rem 1.1rem; border-radius: 20px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink) !important; text-decoration: none !important; transition: transform .18s, box-shadow .18s; }
.lvs-tile::after { content: ''; position: absolute; right: -34px; top: -34px; width: 110px; height: 110px; border-radius: 50%; background: var(--tc); opacity: .09; }
.lvs-tile:hover { transform: translateY(-3px); box-shadow: 0 16px 30px rgba(15, 20, 60, .13); }
.lvs-tile .ti { grid-area: ti; width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: #fff; background: var(--tc); box-shadow: 0 10px 20px color-mix(in srgb, var(--tc) 38%, transparent); }
.lvs-tile b { grid-area: n; font-size: 2rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.lvs-tile small { grid-area: s; color: var(--muted, #64748b); font-weight: 600; }
.lvs-tile em { grid-area: em; font-style: normal; margin-top: .65rem; padding-top: .55rem; border-top: 1px dashed var(--line); font-size: .85rem; color: var(--muted, #64748b); }
.lvs-type { margin-bottom: .95rem; }
.lvs-type:last-child { margin-bottom: 0; }
.lvs-tn { display: flex; align-items: center; gap: .55rem; margin-bottom: .3rem; }
.lvs-tn i { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.lvs-tn span { margin-left: auto; font-size: .86rem; color: var(--muted, #64748b); white-space: nowrap; }
.lvs-bar { height: 9px; border-radius: 99px; background: #eef1f8; overflow: hidden; }
.lvs-bar span { display: block; height: 100%; border-radius: 99px; }
.lvs-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin: 0 .5rem; }
@media (max-width: 991.98px) { .lvs-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .lvs-tile { padding: .85rem; column-gap: 10px; } .lvs-tile .ti { width: 42px; height: 42px; font-size: 1.05rem; } .lvs-tile b { font-size: 1.6rem; } .sec-h { flex-wrap: wrap; } .sec-h .ml-auto { margin-left: 0 !important; } }
/* ===== แดชบอร์ด: สว่าง เรียบ สะอาด ===== */
.dsh .subnav a.on { box-shadow: none; }
.dsh .hero-ref { color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: none; min-height: 0; }
.dsh .hero-ref::before { background: linear-gradient(100deg, var(--brand-soft), #fff 70%); opacity: 1; }
.dsh .hero-ref.has-img::before { opacity: .94; background: linear-gradient(100deg, #fff 30%, rgba(255,255,255,.7)); }
.dsh .hero-ref::after { opacity: .5; background-image: radial-gradient(var(--brand-light) 1px, transparent 1.2px); -webkit-mask-image: linear-gradient(90deg, transparent 40%, #000); mask-image: linear-gradient(90deg, transparent 40%, #000); }
.dsh .hero-ref h2 { color: var(--ink); text-shadow: none; }
.dsh .hero-ref .h-day { color: var(--brand); font-weight: 700; opacity: 1; }
.dsh .hero-ref .h-av { background: var(--brand); color: #fff; box-shadow: none; border-color: #fff; }
.dsh .hero-ref .h-chips span { background: #fff; color: var(--ink-2); border: 1px solid var(--line); box-shadow: none; }
.dsh .hero-ref .h-chips i { color: var(--brand); }
.dsh .h-stat { background: #fff; border: 1px solid var(--line); backdrop-filter: none; border-radius: 16px; }
.dsh .h-stat b { color: var(--brand); text-shadow: none; }
.dsh .h-stat small { color: var(--muted); opacity: 1; }
.dsh .qa a { background: #fff; border: 1px solid var(--line); box-shadow: none; }
.dsh .qa a:hover { border-color: var(--qc); box-shadow: 0 8px 20px rgba(15, 23, 42, .07); }
.dsh .qa .qi { background: var(--qs); color: var(--qc); box-shadow: none; }
.dsh .task { box-shadow: none; }
.dsh .task:hover { box-shadow: 0 8px 20px rgba(15, 23, 42, .07); }
.dsh .task .ti { background: color-mix(in srgb, var(--tc) 14%, #fff); color: var(--tc); box-shadow: none; }
.dsh .task.hot { background: #fff; border-color: var(--tc); box-shadow: none; }
.dsh .task.hot .n { background: var(--tc); box-shadow: none; }
.dsh .sec-h { font-size: 1.15rem; }
.dsh .sec-h .shi { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.dsh .card { box-shadow: none; border-radius: 18px; }
.dsh .card-head { border-bottom: 0; padding-bottom: .4rem; }
.dsh .card-head h3 i { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.dsh .lvs-tile { box-shadow: none; }
.dsh .lvs-tile:hover { box-shadow: 0 8px 20px rgba(15, 23, 42, .07); }
.dsh .lvs-tile::after { display: none; }
.dsh .lvs-tile .ti { background: color-mix(in srgb, var(--tc) 14%, #fff); color: var(--tc); box-shadow: none; }
/* ===== แดชบอร์ด v2: จัดระเบียบการ์ดและกราฟ ===== */
.dsh .card.rb::before { display: none; }
.dsh .card.rb .card-head { padding-top: 1rem; }
.dsh .chart-box { position: relative; height: 230px; }
.dsh .col-xl-3 .chart-box { height: 230px; }
.dsh .ring-s { width: 104px; height: 104px; background: conic-gradient(var(--brand) calc(var(--p) * 1%), #eef1f8 0); }
.dsh .ring-s > div { width: 80px; height: 80px; box-shadow: none; }
.dsh .ring-s b { font-size: 1.5rem; color: var(--brand); }
.dsh .cell { background: #fff; }
.dsh .more-link { display: inline-block; margin-top: 1rem; font-weight: 700; color: var(--brand); }
.dsh .sec-h { margin-top: 1.8rem; }
.dsh .sec-h .btn { margin-left: auto; }
.dsh .tasks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dsh .empty { padding: 1.6rem 0; color: var(--muted); text-align: center; }
.dsh .empty i { display: block; font-size: 1.8rem; margin-bottom: .4rem; opacity: .5; }
@media (max-width: 575.98px) { .dsh .tasks { grid-template-columns: 1fr; } .dsh .chart-box { height: 200px; } }
/* ===== แบนเนอร์แดชบอร์ด v2 ===== */
.dsh .hero-ref { min-height: 210px; border: 0; border-radius: 26px; box-shadow: 0 18px 40px rgba(15, 23, 42, .12); display: flex; align-items: center; }
.dsh .hero-ref::before { background: linear-gradient(100deg, #fff 0%, rgba(255,255,255,.96) 34%, rgba(255,255,255,.55) 60%, rgba(255,255,255,0) 82%), linear-gradient(135deg, var(--brand-soft), #fff); opacity: 1; }
.dsh .hero-ref.has-img::before { opacity: 1; background: linear-gradient(100deg, #fff 0%, rgba(255,255,255,.95) 32%, rgba(255,255,255,.5) 58%, rgba(255,255,255,0) 80%); }
.dsh .hero-ref::after { display: none; }
.dsh .hero-ref .hero-in { position: relative; z-index: 1; width: 100%; padding: 1.7rem 2rem; gap: 1.5rem; }
.dsh .hero-ref .h-av { width: 84px; height: 84px; font-size: 2.1rem; border: 4px solid #fff; box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 35%, transparent); }
.dsh .hero-ref .h-day { display: inline-block; padding: .2rem .8rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: .85rem; margin-bottom: .35rem; }
.dsh .hero-ref h2 { font-size: 2.2rem; font-weight: 700; letter-spacing: -.01em; margin: 0 0 .7rem; }
.dsh .hero-ref .h-chips span { background: rgba(255,255,255,.92); border-radius: 999px; font-weight: 600; }
.dsh .h-stats { gap: 12px; }
.dsh .h-stat { min-width: 118px; background: rgba(255,255,255,.82); border: 1px solid rgba(255,255,255,.9); backdrop-filter: blur(12px); box-shadow: 0 10px 24px rgba(15, 23, 42, .12); border-radius: 18px; }
.dsh .h-stat b { font-size: 2rem; }
.dsh .callout { border-radius: 18px; border: 1px solid var(--line); }
@media (max-width: 767.98px) {
  .dsh .hero-ref { min-height: 0; }
  .dsh .hero-ref::before, .dsh .hero-ref.has-img::before { background: linear-gradient(180deg, rgba(255,255,255,.97), rgba(255,255,255,.88)); }
  .dsh .hero-ref .hero-in { padding: 1.2rem; flex-direction: column; align-items: stretch; }
  .dsh .hero-ref .h-av { width: 64px; height: 64px; font-size: 1.6rem; }
  .dsh .hero-ref h2 { font-size: 1.6rem; }
  .dsh .h-stats { display: grid; grid-template-columns: repeat(3, 1fr); } .dsh .h-stat { min-width: 0; padding: .6rem .3rem; } .dsh .h-stat b { font-size: 1.4rem; }
}
/* ===== การ์ดสีสันสดใส + ลวดลายไอคอน (ทุกหน้า) ===== */
.card.cc { position: relative; overflow: hidden; --cc: var(--brand); border: 1px solid color-mix(in srgb, var(--cc) 22%, #fff); border-top: 4px solid var(--cc); background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 5%, #fff), #fff 160px); }
.card.cc::before { display: none !important; }
.card.cc > .card-head { position: relative; z-index: 1; background: linear-gradient(100deg, color-mix(in srgb, var(--cc) 16%, #fff), transparent 75%); border-bottom: 1px solid color-mix(in srgb, var(--cc) 14%, #fff); }
.card.cc > .card-head h3 i { background: linear-gradient(135deg, var(--cc), color-mix(in srgb, var(--cc) 55%, #fff)); color: #fff; box-shadow: 0 6px 14px color-mix(in srgb, var(--cc) 35%, transparent); }
.card.cc > .card-body, .card.cc > .table-responsive, .card.cc > table, .card.cc > form { position: relative; z-index: 1; }
.wm { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; color: var(--cc, var(--tc, var(--qc, var(--brand)))); }
.wm i { position: absolute; opacity: .075; font-size: 6.5rem; }
.wm i:nth-child(1) { right: -14px; bottom: -22px; transform: rotate(-14deg); }
.wm i:nth-child(2) { right: 92px; top: -26px; font-size: 3.2rem; opacity: .09; transform: rotate(16deg); }
.wm i:nth-child(3) { left: 38%; bottom: -12px; font-size: 2.6rem; opacity: .06; transform: rotate(-8deg); }
.wm-s i:nth-child(1) { font-size: 4.4rem; right: -8px; bottom: -14px; opacity: .13; }
.wm-s i:nth-child(2) { font-size: 1.8rem; right: 54px; top: -6px; opacity: .12; }
.wm-s i:nth-child(3) { display: none; }
.task, .lvs-tile, .qa a { position: relative; overflow: hidden; }
.task > :not(.wm), .lvs-tile > :not(.wm), .qa a > :not(.wm) { position: relative; z-index: 1; }

/* การ์ดตัวเลข/ปุ่มลัดบนแดชบอร์ด: สีสดขึ้น */
.dsh .task { background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 17%, #fff), #fff 85%); border-color: color-mix(in srgb, var(--tc) 32%, #fff); }
.dsh .task .ti { background: linear-gradient(135deg, var(--tc), color-mix(in srgb, var(--tc) 60%, #fff)); color: #fff; box-shadow: 0 8px 16px color-mix(in srgb, var(--tc) 35%, transparent); }
.dsh .task.hot { background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 28%, #fff), color-mix(in srgb, var(--tc) 8%, #fff)); }
.dsh .qa a { background: linear-gradient(135deg, color-mix(in srgb, var(--qc) 18%, #fff), #fff 88%); border-color: color-mix(in srgb, var(--qc) 30%, #fff); }
.dsh .qa .qi { background: linear-gradient(135deg, var(--qc), color-mix(in srgb, var(--qc) 60%, #fff)); color: #fff; box-shadow: 0 8px 16px color-mix(in srgb, var(--qc) 35%, transparent); }
.dsh .lvs-tile { background: linear-gradient(135deg, var(--tc), color-mix(in srgb, var(--tc) 62%, #fff)); border: 0; color: #fff !important; box-shadow: 0 14px 26px color-mix(in srgb, var(--tc) 32%, transparent); }
.dsh .lvs-tile .ti { background: rgba(255,255,255,.26); color: #fff; box-shadow: none; }
.dsh .lvs-tile small, .dsh .lvs-tile em { color: rgba(255,255,255,.92); }
.dsh .lvs-tile em { border-top-color: rgba(255,255,255,.4); }
.dsh .lvs-tile .wm { color: #fff; }
.dsh .lvs-tile:hover { box-shadow: 0 18px 32px color-mix(in srgb, var(--tc) 42%, transparent); }
@media print { .wm { display: none; } .card.cc { border-top-width: 1px; background: #fff; } }
/* ===== แถบเครดิตท้ายหน้า + ปุ่มกลับขึ้นบน ===== */
.credit-bar { display: flex; align-items: center; justify-content: center; gap: .7rem; padding: .85rem 1rem; color: #e6ecff; font-weight: 600; font-size: .95rem; border-top: 3px solid #f5b301; background: linear-gradient(100deg, #0b1d3a 0%, #17406b 60%, #0f6a85 100%); }
.credit-bar b { color: #fcd34d; }
.credit-bar .cb-ic { width: 28px; height: 28px; border-radius: 8px; background: #f5b301; color: #1c2a4a; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; }
.to-top { position: fixed; right: 18px; bottom: 18px; z-index: 1040; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #0b1d3a; color: #fff; box-shadow: 0 8px 20px rgba(11, 29, 58, .35); opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .2s, transform .2s, visibility .2s; }
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--brand); }
@media print { .credit-bar, .to-top { display: none !important; } }
/* ===== มือถือ: ออกแบบใหม่ทั้งระบบ ===== */
@media (max-width: 767.98px) {
  main { padding-left: 12px !important; padding-right: 12px !important; }
  .date-nav .form-control { width: 100%; min-width: 0; }
  .card { border-radius: 18px; margin-bottom: 1rem; }
  .card-head { padding: .85rem 1rem; flex-direction: column; align-items: stretch; gap: 10px; }
  .card-head h3 { font-size: 1rem; }
  .card-body { padding: 1rem; }
  .card-body.card-flush { padding: .6rem; background: transparent; }
  .wm i:nth-child(1) { font-size: 4.2rem; } .wm i:nth-child(2), .wm i:nth-child(3) { display: none; }

  /* แถบแท็บ + ปุ่มด้านบนตาราง */
  .att-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .att-bar .subnav { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
  .att-bar .subnav a { text-align: center; padding: .6rem .4rem; border-radius: 12px; font-size: .95rem; }
  .att-bar .ph-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .att-bar .ph-actions .btn { width: 100%; }
  .callout { padding: .85rem 1rem; border-radius: 16px; }

  /* ตัวกรองวันที่ / กลุ่มสาระ */
  .card-head form { flex-direction: column; align-items: stretch !important; width: 100%; }
  .date-nav { display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; width: 100%; }
  .date-nav .btn-soft { grid-column: 1 / -1; }
  .card-head .custom-select { width: 100% !important; min-width: 0 !important; }
  .mini-stats { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
  .mini-stats span { justify-content: space-between; width: 100%; }

  /* ตารางแบบการ์ด */
  .dataTables_wrapper .row { margin: 0; } .dataTables_wrapper .row > div { padding: 0; width: 100%; max-width: 100%; flex: 0 0 100%; text-align: center; }
  .dataTables_filter { margin: .2rem 0 .6rem; } .dataTables_filter label { display: block; width: 100%; } .dataTables_filter input { width: 100% !important; margin: 0 !important; }
  .dataTables_paginate { margin-top: .6rem; } .dataTables_info { padding: .4rem 0; font-size: .85rem; color: var(--muted); }
  table.tbl-stack { border: 0 !important; }
  table.tbl-stack thead { display: none; }
  table.tbl-stack, table.tbl-stack tbody { display: block; width: 100% !important; }
  table.tbl-stack tbody tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 10px; padding: .25rem 0 .4rem; box-shadow: 0 4px 12px rgba(15, 23, 42, .05); }
  table.tbl-stack tbody tr.odd, table.tbl-stack tbody tr.even { background: #fff; }
  table.tbl-stack td { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; border: 0 !important; padding: .4rem 1rem !important; text-align: right; }
  table.tbl-stack td::before { content: attr(data-label); flex-shrink: 0; color: var(--muted); font-weight: 600; font-size: .85rem; text-align: left; padding-top: .1rem; }
  table.tbl-stack td[data-label=""]::before { display: none; }
  table.tbl-stack td:first-child { display: block; text-align: left; padding-top: .7rem !important; padding-bottom: .6rem !important; margin-bottom: .2rem; border-bottom: 1px dashed var(--line) !important; }
  table.tbl-stack td:first-child::before { display: none; }
  table.tbl-stack td:last-child:empty { display: none; }
  table.tbl-stack td:last-child[data-label=""] { justify-content: flex-end; }
  table.tbl-stack .who { gap: 12px; } table.tbl-stack .who b { white-space: normal; word-break: break-word; }
  table.tbl-stack .chip { white-space: normal; text-align: right; }
  table.tbl-stack td.dataTables_empty { display: block; text-align: center; padding: 1.5rem 1rem !important; }
  table.tbl-stack td.dataTables_empty::before { display: none; }

  /* ตารางสรุปรายเดือน: เลื่อนแนวนอนในกรอบ */
  .card .mx { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .table-responsive, .tbl-scroll { -webkit-overflow-scrolling: touch; }
  .to-top { right: 12px; bottom: 12px; width: 40px; height: 40px; }
}
/* ===== มือถือ: ตารางแบบกะทัดรัด เลื่อนซ้าย-ขวาในกรอบ ===== */
@media (max-width: 767.98px) {
  .card-body.card-flush { padding: 0 !important; }
  .dataTables_wrapper { padding: .6rem .6rem .4rem; overflow: hidden; }
  .dataTables_scrollBody { border-radius: 12px; border: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
  .dataTables_scrollHead { border-radius: 12px 12px 0 0; overflow: hidden !important; }
  .dataTables_wrapper table.table { font-size: .84rem; margin: 0 !important; }
  .dataTables_wrapper table.table th, .dataTables_wrapper table.table td { padding: .5rem .6rem !important; white-space: nowrap; vertical-align: middle; }
  .dataTables_wrapper table.table .who { gap: 8px; } .dataTables_wrapper table.table .who .avatar { width: 30px; height: 30px; font-size: .8rem; }
  .dataTables_wrapper table.table .who b { white-space: nowrap; font-size: .86rem; }
  .dataTables_wrapper table.table .btn-icon { width: 32px; height: 32px; padding: 0; }
}
/* ===== ตารางใบลา (leaves.php) ===== */
.lv-table { border-collapse: separate !important; border-spacing: 0 6px; }
.lv-table thead th { background: transparent !important; color: var(--muted) !important; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; border: 0 !important; padding: .4rem .9rem !important; white-space: nowrap; }
.lv-table tbody tr { background: #fff; box-shadow: 0 1px 0 var(--line), 0 0 0 1px var(--line); border-radius: 14px; transition: box-shadow .15s, transform .15s; }
.lv-table tbody tr:hover { background: #fff !important; box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 35%, #fff), 0 8px 18px rgba(15, 23, 42, .07); }
.lv-table tbody td { border: 0 !important; padding: .8rem .9rem !important; vertical-align: middle !important; }
.lv-table tbody td:first-child { border-radius: 14px 0 0 14px; } .lv-table tbody td:last-child { border-radius: 0 14px 14px 0; }
.lv-table .who { display: flex; align-items: center; gap: 10px; } .lv-table .who b { display: block; line-height: 1.25; } .lv-table .who small { color: var(--muted); }
.lv-table .lv-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .8rem; border-radius: 999px; font-weight: 700; font-size: .85rem; color: var(--c); background: color-mix(in srgb, var(--c) 13%, #fff); border: 1px solid color-mix(in srgb, var(--c) 28%, #fff); white-space: nowrap; }
.lv-table .lv-reason { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); max-width: 240px; line-height: 1.4; }
.lv-table td:nth-child(4) b { display: inline-flex; min-width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); font-size: 1.05rem; }
.lv-act { white-space: nowrap; }
.lv-act .btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 10px; margin-left: 3px; }
.lv-act .btn-brand { border-radius: 10px; margin-right: 4px; }
.lv-bal tbody td.text-center { min-width: 92px; }
.lv-bal .lv-num { display: inline-flex; min-width: 40px; height: 34px; padding: 0 .6rem; align-items: center; justify-content: center; border-radius: 10px; background: #f1f5f9; font-weight: 700; font-size: 1rem; }
.lv-bal .lv-num.zero { background: transparent; color: #cbd5e1; } .lv-bal .lv-num.over { background: #fee2e2; color: #b91c1c; }
.card-body.card-flush .dataTables_wrapper { padding: .4rem 1rem 1rem; }
@media (max-width: 767.98px) {
  .lv-table { border-spacing: 0 4px; }
  .lv-table tbody td { padding: .55rem .6rem !important; }
  .lv-table .lv-reason { max-width: 160px; }
  .lv-act .btn-brand { padding: .3rem .6rem; font-size: .8rem; }
}
/* ===== ตารางใบลา v2: แก้การจัดวางเพี้ยน (ใช้เส้นคั่นแถวแบบปกติ) ===== */
.lv-table { border-collapse: collapse !important; border-spacing: 0 !important; width: 100% !important; }
.lv-table thead th { background: var(--brand-soft) !important; color: var(--brand-dark) !important; text-transform: none; letter-spacing: 0; font-size: .88rem; padding: .7rem .9rem !important; vertical-align: middle; }
.lv-table thead th small { font-weight: 500; color: var(--muted); }
.lv-table tbody tr, .lv-table tbody tr:hover { background: #fff !important; box-shadow: none !important; border-radius: 0; transform: none; border-bottom: 1px solid var(--line); }
.lv-table tbody tr:hover { background: #fafbff !important; }
.lv-table tbody td:first-child, .lv-table tbody td:last-child { border-radius: 0; }
.lv-table tbody td { padding: .75rem .9rem !important; }
.lv-table .who { min-width: 190px; } .lv-table .who b { white-space: nowrap; }
.card-body.card-flush .table-responsive, .card-body.card-flush .dataTables_wrapper { overflow-x: auto; }
.dsh, main { min-width: 0; }
/* ===== สรุปสิทธิ์การลา (ตารางเรียบ ไม่ใช้ DataTables) ===== */
.bt2-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 1rem 1.25rem .6rem; }
.bt2-search { position: relative; flex: 1; max-width: 360px; }
.bt2-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.bt2-search input { width: 100%; height: 42px; padding: 0 14px 0 40px; border: 1px solid var(--line); border-radius: 999px; background: #fff; outline: 0; }
.bt2-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.bt2-count { color: var(--muted); } .bt2-count b { color: var(--brand); font-size: 1.1rem; }
.bt2-wrap { overflow-x: auto; padding: 0 1.25rem 1.25rem; -webkit-overflow-scrolling: touch; }
.bt2 { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fff; }
.bt2 thead th { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: .88rem; text-align: center; padding: .75rem .8rem; white-space: nowrap; vertical-align: middle; }
.bt2 thead th small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; }
.bt2 thead th.bt2-name { text-align: left; }
.bt2 tbody td { padding: .7rem .8rem; text-align: center; border-top: 1px solid var(--line-2, #eef1f8); vertical-align: middle; }
.bt2 tbody tr:hover td { background: #fafbff; }
.bt2 td small { display: block; color: var(--muted); font-size: .76rem; line-height: 1.3; }
.bt2 td.bt2-name { text-align: left; min-width: 210px; }
.bt2 .who { display: flex; align-items: center; gap: 10px; } .bt2 .who b { display: block; line-height: 1.25; white-space: nowrap; }
.bt2 .lv-num { display: inline-flex; min-width: 40px; height: 34px; padding: 0 .6rem; align-items: center; justify-content: center; border-radius: 10px; background: #f1f5f9; font-weight: 700; }
.bt2 .lv-num.zero { background: transparent; color: #cbd5e1; } .bt2 .lv-num.over { background: #fee2e2; color: #b91c1c; }
.bt2 .lv-bar { height: 5px; width: 70px; margin: 5px auto 2px; border-radius: 9px; background: #eef1f8; overflow: hidden; } .bt2 .lv-bar i { display: block; height: 100%; border-radius: 9px; } .bt2 .lv-bar i.over { background: #ef4444 !important; }
.bt2-sum { display: inline-flex; min-width: 42px; height: 36px; align-items: center; justify-content: center; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 700; padding: 0 .6rem; }
.bt2-empty { padding: 2rem !important; color: var(--muted); }
@media (max-width: 767.98px) { .bt2-tools { padding: .8rem 1rem .5rem; } .bt2-search { max-width: none; } .bt2-wrap { padding: 0 .7rem 1rem; } .bt2 td.bt2-name { min-width: 180px; } }
/* ===== ภาพ 3 มิติหน้าเสาธง ===== */
.f3 { position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); background: #e8edf5; margin-bottom: 1rem; box-shadow: 0 10px 30px rgba(15, 23, 42, .08); }
.f3-stage { height: 480px; } .f3-stage canvas { display: block; touch-action: none; cursor: grab; }
.f3-fb { display: flex; height: 100%; align-items: center; justify-content: center; padding: 1rem; text-align: center; color: #475569; }
.f3-top { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; pointer-events: none; }
.f3-legend, .f3-btns { display: flex; flex-wrap: wrap; gap: 6px; pointer-events: auto; }
.f3-legend span { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border-radius: 999px; background: rgba(255,255,255,.92); box-shadow: 0 4px 12px rgba(15,23,42,.1); font-weight: 600; font-size: .88rem; }
.f3-legend i { width: 10px; height: 10px; border-radius: 50%; } .f3-legend b { font-size: 1rem; }
.f3-btns button { border: 0; display: inline-flex; align-items: center; gap: .4rem; height: 36px; padding: 0 .9rem; border-radius: 999px; background: rgba(255,255,255,.92); color: var(--ink-2); font-weight: 600; font-size: .85rem; box-shadow: 0 4px 12px rgba(15,23,42,.1); }
.f3-btns button:hover, .f3-btns button.on { background: var(--brand); color: #fff; }
.f3-hint { position: absolute; left: 12px; bottom: 12px; padding: .3rem .8rem; border-radius: 999px; background: rgba(255,255,255,.88); color: #475569; font-size: .8rem; pointer-events: none; }
.f3-tip { position: absolute; display: none; min-width: 150px; max-width: 220px; padding: .5rem .75rem; border-radius: 12px; background: #fff; box-shadow: 0 10px 24px rgba(15,23,42,.22); pointer-events: none; z-index: 5; }
.f3-tip b { display: block; line-height: 1.25; } .f3-tip span { display: block; color: var(--muted); font-size: .8rem; }
.f3-tip i { display: inline-block; margin-top: .25rem; padding: .05rem .6rem; border-radius: 99px; color: #fff; font-style: normal; font-size: .75rem; font-weight: 700; }
.f3:fullscreen { border-radius: 0; } .f3:fullscreen .f3-stage { height: 100vh; }
@media (max-width: 767.98px) { .f3-stage { height: 400px; } .f3-btns button span { display: none; } .f3-btns button { width: 36px; padding: 0; justify-content: center; } .f3-hint { display: none; } }
@media print { .f3 { display: none; } }
/* 3D เต็มพื้นที่ */
.f3-stage { height: clamp(520px, 82vh, 880px); }
.f3 { margin-left: 0; margin-right: 0; border-radius: 22px; }
@media (max-width: 767.98px) { .f3-stage { height: 70vh; min-height: 440px; } }

/* ===== 3D โรงเรียน: แถบควบคุมแบบลอย + เต็มหน้า ===== */
.f3-stage { height: calc(100vh - 110px); min-height: 560px; }
.f3-top { display: none !important; }
.f3-legend { position: absolute; right: 14px; top: 14px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; padding: .55rem 1rem; border-radius: 999px; background: rgba(255,255,255,.94); box-shadow: 0 6px 18px rgba(15,23,42,.12); font-weight: 600; font-size: .86rem; }
.f3-legend span { display: inline-flex; align-items: center; gap: .4rem; background: none; box-shadow: none; padding: 0; } .f3-legend i { width: 9px; height: 9px; border-radius: 50%; } .f3-legend b { color: var(--ink); }
.f3-hint { left: 14px; bottom: 74px; }
.f3-bar { position: absolute; left: 14px; bottom: 14px; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 28px); padding: 6px; border-radius: 18px; background: rgba(255,255,255,.96); box-shadow: 0 10px 28px rgba(15,23,42,.18); }
.f3-grp { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; } .f3-grp::-webkit-scrollbar { display: none; }
.f3-bar button { flex: none; border: 0; background: transparent; color: var(--ink-2); height: 38px; padding: 0 .75rem; border-radius: 12px; font-weight: 600; font-size: .86rem; display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.f3-bar button:hover { background: var(--brand-soft); } .f3-bar button.on { background: var(--brand); color: #fff; box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 35%, transparent); }
.f3-bar .f3-c { width: 38px; padding: 0; justify-content: center; color: var(--muted); }
.f3-bar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.f3.f3-fold .f3-grp { display: none; } .f3.f3-fold .f3-c i { transform: rotate(180deg); }
.f3.f3-min .f3-legend, .f3.f3-min .f3-hint { display: none; }
@media (max-width: 767.98px) { .f3-stage { height: 72vh; min-height: 460px; } .f3-bar button span { display: none; } .f3-bar button { padding: 0 .6rem; } .f3-legend { left: 14px; justify-content: center; border-radius: 16px; } .f3-hint { display: none; } }
/* ===== พอร์ทัลครู: ลงเวลาของฉัน / ใบลาของฉัน ===== */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-h { text-align: center; font-weight: 700; font-size: .82rem; color: var(--muted); padding-bottom: .2rem; }
.cal-d { position: relative; min-height: 64px; border-radius: 14px; padding: .4rem .5rem; background: color-mix(in srgb, var(--c) 16%, #fff); border: 1px solid color-mix(in srgb, var(--c) 34%, #fff); display: flex; flex-direction: column; justify-content: space-between; transition: transform .15s, box-shadow .15s; }
.cal-d:hover { transform: translateY(-2px); box-shadow: 0 8px 18px color-mix(in srgb, var(--c) 30%, transparent); }
.cal-d b { font-size: 1.05rem; line-height: 1; color: color-mix(in srgb, var(--c) 70%, #0f172a); }
.cal-d small { font-size: .74rem; font-weight: 700; color: color-mix(in srgb, var(--c) 75%, #0f172a); font-variant-numeric: tabular-nums; }
.cal-d.today { outline: 3px solid var(--brand); outline-offset: 1px; }
.cal-d.today::after { content: 'วันนี้'; position: absolute; right: 6px; top: 5px; font-size: .62rem; font-weight: 700; background: var(--brand); color: #fff; padding: 0 .4rem; border-radius: 99px; }
.cal-e { min-height: 64px; }
.cal-key span { padding: .2rem .7rem; font-size: .8rem; }
.pt .att-bar .subnav { display: none; }
.pt table.table thead th { background: var(--brand-soft); color: var(--brand-dark); border: 0; font-weight: 700; font-size: .88rem; white-space: nowrap; }
.pt table.table tbody td { vertical-align: middle; border-color: var(--line-2, #eef1f8); }
.pt table.table tbody tr:hover { background: #fafbff; }
.pt .lv-bal { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.pt .lv-bcard { position: relative; overflow: hidden; border-radius: 22px; padding: 1.1rem 1.2rem; background: linear-gradient(150deg, color-mix(in srgb, var(--c) 14%, #fff), #fff 75%); border: 1px solid color-mix(in srgb, var(--c) 30%, #fff); border-top: 4px solid var(--c); box-shadow: none; }
.pt .lv-bcard::after { content: ''; position: absolute; right: -28px; top: -28px; width: 100px; height: 100px; border-radius: 50%; background: var(--c); opacity: .09; }
.pt .lv-bcard .nm { font-weight: 700; display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.pt .lv-bcard .big { font-size: 2.1rem; font-weight: 700; line-height: 1.1; color: color-mix(in srgb, var(--c) 72%, #0f172a); font-variant-numeric: tabular-nums; } .pt .lv-bcard .big small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.pt .lv-bcard .lv-bar2 { height: 9px; border-radius: 99px; background: #eef1f8; overflow: hidden; display: flex; margin: .55rem 0; }
.pt .lv-bcard .lv-bar2 .u { background: var(--c); } .pt .lv-bcard .lv-bar2 .p { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--c) 45%, #fff), color-mix(in srgb, var(--c) 45%, #fff) 4px, #fff 4px, #fff 8px); }
.pt .hero-ref .h-stat { min-width: 104px; }
@media (max-width: 575.98px) { .cal-grid { gap: 5px; } .cal-d { min-height: 52px; padding: .3rem .35rem; border-radius: 11px; } .cal-d small { font-size: .62rem; } .cal-d.today::after { display: none; } .cal-e { min-height: 52px; } }
/* ===== ลงเวลาของฉัน v2 ===== */
.pt .cal-grid { gap: 10px; }
.pt .cal-h { text-transform: none; padding: .3rem 0 .5rem; }
.pt .cal-h:nth-child(6), .pt .cal-h:nth-child(7) { color: #f43f5e; }
.pt .cal-d { min-height: 78px; border-radius: 16px; padding: .5rem .65rem; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 24%, #fff), color-mix(in srgb, var(--c) 10%, #fff)); }
.pt .cal-d b { font-size: 1.2rem; } .pt .cal-d small { font-size: .8rem; }
.pt .cal-d[style*="#eef2f7"], .pt .cal-d[style*="#cbd5e1"] { background: #fafbfd; border: 1px dashed #d9dfeb; } .pt .cal-d[style*="#eef2f7"] b, .pt .cal-d[style*="#cbd5e1"] b { color: #94a3b8; }
.pt .cal-d[style*="#e2e8f0"] { background: repeating-linear-gradient(135deg, #f4f6fa, #f4f6fa 6px, #eef1f6 6px, #eef1f6 12px); border-color: #e5e9f2; } .pt .cal-d[style*="#e2e8f0"] b { color: #94a3b8; }
.pt .cal-e { min-height: 78px; }
.td-status { margin-bottom: .8rem; }
.td-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.td-times > div { position: relative; padding: .8rem 1rem; border-radius: 16px; background: var(--brand-soft); } .td-times > div:nth-child(2) { background: #eff6ff; }
.td-times i { position: absolute; right: .9rem; top: .8rem; color: var(--brand); opacity: .55; } .td-times > div:nth-child(2) i { color: #3b82f6; }
.td-times small { display: block; color: var(--muted); font-weight: 600; } .td-times b { font-size: 1.7rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.td-hours { margin-top: .8rem; padding: .6rem .9rem; border-radius: 14px; background: #f8fafc; border: 1px dashed var(--line); color: var(--ink-2); } .td-hours b { float: right; color: var(--brand-dark); }
.td-leave { margin-top: .6rem; padding: .55rem .9rem; border-radius: 14px; background: #e0f2fe; color: #0369a1; font-weight: 600; }
.my-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; } .my-mid b { font-size: 2rem; line-height: 1; color: var(--brand-dark); } .my-mid b small { font-size: .9rem; } .my-mid span { color: var(--muted); font-size: .8rem; font-weight: 600; }
.my-leg { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; } .my-leg li { display: flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--ink-2); } .my-leg i { width: 10px; height: 10px; border-radius: 4px; } .my-leg b { margin-left: auto; }
@media (max-width: 575.98px) { .pt .cal-grid { gap: 5px; } .pt .cal-d { min-height: 54px; padding: .3rem .35rem; } .pt .cal-d b { font-size: .95rem; } .pt .cal-e { min-height: 54px; } .td-times b { font-size: 1.4rem; } }
.h-av { overflow: hidden; }
.h-av img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }

/* ===== ใบลาของฉัน v2: วงแหวนสิทธิ์ + รายการใบลาแบบตั๋ว ===== */
.pt .lv-bal { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pt .lv-bcard { display: flex; align-items: center; gap: 16px; }
.pt .lv-bcard .rg { --u: 0; --p: 0; width: 92px; height: 92px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--u) * 1%), color-mix(in srgb, var(--c) 38%, #fff) 0 calc((var(--u) + var(--p)) * 1%), #eef1f8 0); }
.pt .lv-bcard .rg > div { width: 70px; height: 70px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; box-shadow: inset 0 0 0 1px #eef1f8; }
.pt .lv-bcard .rg b { font-size: 1.45rem; color: color-mix(in srgb, var(--c) 75%, #0f172a); } .pt .lv-bcard .rg small { font-size: .62rem; color: var(--muted); font-weight: 600; }
.pt .lv-bcard .tx { min-width: 0; } .pt .lv-bcard .big { font-size: 1.5rem; margin: .1rem 0 .25rem; } .pt .lv-bcard .pend { color: #b45309; font-weight: 600; }
.tk-filter { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.tk-filter button { border: 0; background: transparent; padding: .3rem .85rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.tk-filter button.on { background: var(--brand); color: #fff; } .tk-filter button b { margin-left: .25rem; opacity: .85; }
.tk-list { display: grid; gap: 12px; margin-bottom: 1.5rem; }
.tk { position: relative; display: flex; align-items: flex-start; gap: 16px; padding: 1rem 1.2rem; border-radius: 20px; background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--c); transition: transform .15s, box-shadow .15s; }
.tk:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(15,23,42,.09); }
.tk-days { flex-shrink: 0; width: 68px; height: 68px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 78%, #0f172a); } .tk-days b { font-size: 1.7rem; line-height: 1; } .tk-days small { font-weight: 600; }
.tk-main { flex: 1; min-width: 0; }
.tk-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: .35rem; } .tk-top .badge { padding: .35rem .8rem !important; font-size: .78rem; }
.tk-date { font-weight: 700; } .tk-date i { color: var(--c); margin-right: .3rem; } .tk-date em { font-style: normal; font-weight: 500; color: var(--muted); }
.tk-reason { color: var(--ink-2); margin-top: .15rem; }
.tk-note { margin-top: .35rem; padding: .35rem .7rem; border-radius: 10px; background: #f8fafc; color: var(--muted); font-size: .88rem; }
.tk .lv-steps { margin-top: .6rem; }
.tk-act { display: flex; gap: 6px; flex-shrink: 0; }
.tk-empty { text-align: center; padding: 2.5rem 1rem; border-radius: 20px; border: 2px dashed var(--line); color: var(--muted); background: #fff; } .tk-empty i { display: block; font-size: 2.2rem; margin-bottom: .5rem; opacity: .5; }
@media (max-width: 575.98px) { .tk { flex-wrap: wrap; padding: .9rem; } .tk-days { width: 56px; height: 56px; } .tk-days b { font-size: 1.4rem; } .tk-act { width: 100%; justify-content: flex-end; } .tk-filter { width: 100%; justify-content: space-between; margin-top: .5rem; } .pt .lv-bal { grid-template-columns: 1fr; } }
/* ===== ประวัติการลา: ตารางสวย (ไม่ใช้ DataTables) ===== */
.pt .hist { border-top-width: 4px; }
.pt .hist .bt2-wrap { padding: .9rem; }
.hist-t { min-width: 820px; }
.hist-t thead th { text-align: left; background: linear-gradient(180deg, var(--brand-soft), #fff); border-bottom: 2px solid color-mix(in srgb, var(--brand) 25%, #fff); }
.hist-t thead th.text-right { text-align: right; }
.hist-t tbody td { text-align: center; padding: .85rem .9rem; }
.hist-t tbody td.tl { text-align: left; } .hist-t tbody td.text-right { text-align: right; }
.hist-t tbody tr.hr { transition: background .15s; } .hist-t tbody tr.hr:hover td { background: color-mix(in srgb, var(--c) 6%, #fff); }
.hist-t tbody tr.hr td:first-child { box-shadow: inset 5px 0 0 var(--c); padding-left: 1.1rem; }
.hist-t td b { display: block; } .hist-t td small { display: block; color: var(--muted); }
.hist-days { display: inline-flex; min-width: 42px; height: 42px; padding: 0 .5rem; align-items: center; justify-content: center; border-radius: 13px; font-weight: 700; font-size: 1.15rem; background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 78%, #0f172a); }
.hist-reason { max-width: 260px; line-height: 1.4; } .hist-reason .note { margin-top: .3rem; padding: .2rem .55rem; border-radius: 8px; background: #f8fafc; display: inline-block; }
.hist-t .lv-steps { margin: 0; }
.hist-t .btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 11px; margin-left: 3px; }
/* การ์ดสิทธิ์การลา: ขยายเต็มแถว */
.pt .lv-bal { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.pt .lv-bcard { justify-content: flex-start; padding: 1.2rem 1.4rem; }
.pt .lv-bcard .tx { flex: 1; }
@media (max-width: 575.98px) { .pt .lv-bal { grid-template-columns: 1fr; } }

/* ไปราชการ: สถานะในตารางลงเวลา */
.badge-primary { background: #ede9fe; color: #5b21b6; }
.mx td.m-duty { color: #6d28d9; background: #ede9fe; font-weight: 700; }
.mx .t-duty { color: #6d28d9; }
/* ===== ไปราชการ: ฟอร์มขออนุญาต ===== */
.tf-radio { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: .8rem; }
.tf-radio label { margin: 0; cursor: pointer; } .tf-radio input { position: absolute; opacity: 0; }
.tf-radio span { display: block; padding: .7rem 1rem; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 600; text-align: center; transition: .15s; }
.tf-radio input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.est-head, .est-row { display: grid; grid-template-columns: 170px 1fr 130px 36px; gap: 8px; align-items: center; }
.est-head { padding: 0 2px .35rem; font-size: .8rem; font-weight: 700; color: var(--muted); }
.est-row { margin-bottom: 8px; } .est-amt { text-align: right; }
.est-total { display: flex; align-items: baseline; justify-content: flex-end; gap: .6rem; margin-top: .8rem; padding: .7rem 1rem; border-radius: 14px; background: var(--brand-soft); } .est-total b { font-size: 1.6rem; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.tf-cmp { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tf-cmp span { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: .85rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tf-att { margin-bottom: .7rem; } .tf-att label { display: flex; align-items: center; gap: .5rem; padding: .4rem .7rem; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; font-weight: 500; }
.tf-att em { margin-left: auto; font-style: normal; font-size: .78rem; color: #dc2626; }
.tf-save { display: flex; justify-content: flex-end; gap: 10px; margin: .5rem 0 1.5rem; }
@media (max-width: 767.98px) { .est-head { display: none; } .est-row { grid-template-columns: 1fr 110px 34px; } .est-row select { grid-column: 1 / -1; } .tf-save { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--bg) 40%); padding: .8rem 0; margin: 0; } .tf-save .btn { flex: 1; } }
/* รูปโปรไฟล์ในฟอร์มบุคลากร */
.pf-upl { display: flex; align-items: center; gap: 16px; margin-bottom: 1rem; padding: .8rem; border-radius: 16px; background: var(--brand-soft); }
.pf-upl .grow { flex: 1; min-width: 0; }
.pf-prev { width: 76px; height: 76px; border-radius: 50%; flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #fff; color: var(--brand); font-size: 1.8rem; border: 3px solid #fff; box-shadow: 0 6px 16px rgba(15, 23, 42, .15); }
.pf-prev img { width: 100%; height: 100%; object-fit: cover; }
.who .avatar { overflow: hidden; } .who .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
/* สแกน: ป้ายเข้า/ออก + ไทม์ไลน์ */
.scan-result .rs-badge { display: none; margin: 0 auto .5rem; padding: .25rem 1.1rem; border-radius: 999px; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.45); font-size: 1.15rem; font-weight: 700; width: max-content; }
.scan-result .rs-tl { display: flex; gap: 8px; margin: .8rem 0 .3rem; }
.scan-result .rs-tl .c { flex: 1; padding: .45rem .3rem; border-radius: 14px; background: rgba(0,0,0,.14); opacity: .6; }
.scan-result .rs-tl .c.on { background: rgba(255,255,255,.22); opacity: 1; }
.scan-result .rs-tl small { display: block; font-size: .78rem; opacity: .9; }
.scan-result .rs-tl b { display: block; font-size: 1.2rem; line-height: 1.2; font-variant-numeric: tabular-nums; }

/* สแกน: การ์ดผลลัพธ์แบบใหม่ (หัวสีตามสถานะ + ตัวการ์ดขาว) */
.k2-status .scan-result { --rc: #059669; padding: 0; overflow: hidden; text-align: left; background: #fff !important; color: var(--ink, #1e293b); border: 1px solid #e6e9f2; box-shadow: 0 16px 36px -14px color-mix(in srgb, var(--rc) 55%, transparent); }
.scan-result.in-ok { --rc: #059669; } .scan-result.in-late { --rc: #d97706; } .scan-result.out-ok { --rc: #0284c7; } .scan-result.out-early { --rc: #7c3aed; } .scan-result.already { --rc: #64748b; }
.k2-status .scan-result .rs-head { display: flex; align-items: center; gap: .8rem; padding: .9rem 1.1rem; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--rc) 78%, #fff), var(--rc)); position: relative; overflow: hidden; }
.k2-status .scan-result .rs-head::after { content: ''; position: absolute; right: -30px; top: -40px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.14); }
.scan-result .rs-ic { width: 52px; height: 52px; border-radius: 16px; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; flex-shrink: 0; position: relative; z-index: 1; }
.scan-result .rs-head > div { position: relative; z-index: 1; min-width: 0; }
.k2-status .scan-result .rs-badge { display: block; margin: 0; padding: 0; background: none; border: 0; width: auto; font-size: 1.45rem; font-weight: 800; line-height: 1.1; }
.scan-result .rs-top { font-size: .9rem; opacity: .95; font-weight: 600; }
.k2-status .scan-result .tm { margin-left: auto; position: relative; z-index: 1; font-size: 1.9rem; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.k2-status .scan-result .tm::after { content: ' น.'; font-size: .8rem; font-weight: 600; opacity: .9; }
.scan-result .rs-body { padding: 1rem 1.1rem 1.1rem; }
.scan-result .rs-who { display: flex; align-items: center; gap: .85rem; }
.scan-result .rs-av { width: 62px; height: 62px; border-radius: 50%; flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--rc) 70%, #fff), var(--rc)); box-shadow: 0 0 0 4px #fff, 0 0 0 6px color-mix(in srgb, var(--rc) 45%, #fff); }
.scan-result .rs-av img { width: 100%; height: 100%; object-fit: cover; }
.k2-status .scan-result .nm { font-size: 1.35rem; margin: 0; color: #0f172a; }
.k2-status .scan-result .rs-who .sub { color: #64748b; font-size: .9rem; opacity: 1; }
.scan-result .rs-tl { display: flex; align-items: center; margin: 1rem 0 .2rem; }
.scan-result .rs-tl .nd { flex: 0 0 auto; min-width: 92px; text-align: center; padding: .55rem .5rem; border-radius: 16px; background: #f1f5f9; color: #94a3b8; }
.scan-result .rs-tl .nd.on { background: color-mix(in srgb, #10b981 12%, #fff); color: #047857; }
.scan-result .rs-tl .nd.out.on { background: color-mix(in srgb, #0ea5e9 12%, #fff); color: #0369a1; }
.scan-result .rs-tl .nd i { font-size: .9rem; } .scan-result .rs-tl .nd small { display: block; font-size: .72rem; font-weight: 600; }
.scan-result .rs-tl .nd b { display: block; font-size: 1.3rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.scan-result .rs-tl .ln { flex: 1; position: relative; height: 2px; margin: 0 .3rem; background: repeating-linear-gradient(90deg, #cbd5e1 0 6px, transparent 6px 11px); text-align: center; }
.scan-result .rs-tl .ln.on { background: linear-gradient(90deg, #10b981, #0ea5e9); }
.scan-result .rs-tl .ln span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; padding: .12rem .6rem; border-radius: 999px; background: #fff; border: 1px solid #e2e8f0; color: #475569; font-size: .76rem; font-weight: 700; }
.scan-result .rs-note { margin-top: .6rem; color: #64748b; font-size: .85rem; text-align: center; }
.scan-result .rs-note:empty { display: none; }

/* สถิติการลาตามรอบการประเมิน (ครั้ง / วัน) */
.tk-filter a { padding: .3rem .85rem; border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--muted, #64748b); text-decoration: none !important; }
.tk-filter a.on { background: var(--brand); color: #fff; }
.ls-wrap { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; margin-bottom: 1.4rem; }
.ls-total { border-radius: 22px; padding: 1.2rem 1.3rem; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 78%, #fff), var(--brand)); box-shadow: 0 14px 28px -14px var(--brand); position: relative; overflow: hidden; }
.ls-total::after { content: ''; position: absolute; right: -40px; top: -50px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.14); }
.ls-total .ls-lbl { font-weight: 700; opacity: .95; position: relative; z-index: 1; }
.ls-big { display: flex; gap: 1.6rem; margin: .6rem 0; position: relative; z-index: 1; }
.ls-big b { display: block; font-size: 3rem; line-height: 1; font-variant-numeric: tabular-nums; } .ls-big small { font-size: .95rem; opacity: .9; }
.ls-total .ls-sub { font-size: .8rem; opacity: .88; position: relative; z-index: 1; }
.ls-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; align-content: start; }
.ls-t { padding: .8rem 1rem; border-radius: 18px; background: #fff; border: 1px solid color-mix(in srgb, var(--c) 28%, #fff); border-left: 5px solid var(--c); }
.ls-t.zero { opacity: .6; }
.ls-t .nm { font-weight: 700; display: flex; align-items: center; gap: .45rem; } .ls-t .nm .lv-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.ls-t .nm em { font-style: normal; font-size: .7rem; font-weight: 600; background: #f1f5f9; color: #64748b; border-radius: 999px; padding: .05rem .5rem; }
.ls-t .v { margin-top: .25rem; color: #64748b; } .ls-t .v b { color: #0f172a; font-size: 1.3rem; }
@media (max-width: 767px) { .ls-wrap { grid-template-columns: 1fr; } .ls-big b { font-size: 2.4rem; } .ls-types { grid-template-columns: 1fr 1fr; } }
