/* PANN HR — mobile-first · ฟอนต์ Sarabun · ไม่มี build step */
:root {
  --brand: #1f5eff;
  --brand-dark: #1747c4;
  --brand-soft: #e8efff;
  --ink: #1b2233;
  --ink-soft: #5b6478;
  --line: #e3e7ef;
  --bg: #f5f7fb;
  --card: #ffffff;
  --ok: #138a52;
  --ok-soft: #e3f6ec;
  --warn: #b26a00;
  --warn-soft: #fff4de;
  --bad: #c62828;
  --bad-soft: #fdecec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 2px 8px rgba(20, 30, 60, .05);
  --tap: 48px;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
small, .muted { color: var(--ink-soft); }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- เปลือกหน้า */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  min-height: 56px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: .8rem; font-weight: 800; letter-spacing: -.5px;
}
.topbar .spacer { flex: 1; }
.emp-switch { max-width: 52vw; }
.emp-switch select {
  width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 10px;
  padding: 4px 8px; font: inherit; font-size: .9rem; background: var(--bg); color: var(--ink);
}
.emp-name { font-size: .9rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-menu { display: none; }
.main { max-width: 960px; margin: 0 auto; padding: 16px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-around; background: var(--card);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: .72rem; color: var(--ink-soft); padding: 4px 2px; min-height: var(--tap); position: relative;
}
.bottom-nav a.active { color: var(--brand); font-weight: 600; }
.bottom-nav svg { width: 22px; height: 22px; }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad);
  color: #fff; font-size: .7rem; line-height: 18px; text-align: center; font-weight: 700;
}
.bottom-nav .badge { position: absolute; top: 0; right: calc(50% - 22px); }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .layout { display: grid; grid-template-columns: 220px 1fr; max-width: 1200px; margin: 0 auto; }
  .side-menu { display: block; padding: 16px 8px; position: sticky; top: 56px; align-self: start; }
  .side-menu a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink);
  }
  .side-menu a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
  .side-menu svg { width: 20px; height: 20px; }
  .main { margin: 0; max-width: none; padding: 24px; }
}

/* ---------------------------------------------------------------- การ์ด ปุ่ม ฟอร์ม */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.card.center { text-align: center; }
.grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .05s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--bad); border-color: #f3c4c4; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.huge { min-height: 96px; font-size: 1.4rem; border-radius: 20px; }
.btn[disabled], .btn.busy { opacity: .6; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

label { display: block; font-weight: 600; margin: 12px 0 6px; font-size: .95rem; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.code-input { letter-spacing: .5em; text-align: center; font-size: 1.4rem; }

.msg { padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-size: .95rem; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.info { background: var(--brand-soft); color: var(--brand-dark); }

.pill {
  display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .8rem; background: var(--bg);
  border: 1px solid var(--line); color: var(--ink-soft); white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }

/* ---------------------------------------------------------------- ตาราง รายการ แท็บ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-soft); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; }
.tabs button {
  flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px;
  font: inherit; font-size: .92rem; cursor: pointer; color: var(--ink-soft); min-height: 40px;
}
.tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }

/* ---------------------------------------------------------------- หน้า login */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; padding-bottom: 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; }
.auth-logo .brand-mark { width: 56px; height: 56px; border-radius: 16px; font-size: 1.2rem; }
.auth-logo .name { font-size: 1.4rem; font-weight: 700; }

.skeleton { background: linear-gradient(90deg, #eef1f6, #f7f9fc, #eef1f6); background-size: 200% 100%;
  animation: sk 1.2s infinite linear; border-radius: 8px; min-height: 18px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: 90vw;
  box-shadow: var(--shadow); font-size: .95rem;
}
.stat { font-size: 1.6rem; font-weight: 700; }

.more-sheet {
  position: fixed; right: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 30; background: var(--card);
  border-radius: 14px; box-shadow: 0 8px 30px rgba(20, 30, 60, .18); padding: 6px; min-width: 200px;
}
.more-sheet a { display: flex; align-items: center; gap: 10px; padding: 12px; color: var(--ink); border-radius: 10px; position: relative; }
.more-sheet a.active { background: var(--brand-soft); color: var(--brand); }
.more-sheet svg { width: 20px; height: 20px; }
.more-sheet .badge { margin-left: auto; }
@media (min-width: 900px) { .more-sheet { display: none; } }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip { flex: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-width: 110px; }
.chip b { display: block; font-size: 1.2rem; }
.req-card { border-left: 4px solid var(--line); }
.req-card.pending { border-left-color: var(--warn); }
.req-card.approved { border-left-color: var(--ok); }
.req-card.rejected, .req-card.cancelled { border-left-color: var(--bad); }
.cal td, .cal th { padding: 4px 6px; text-align: center; font-size: .82rem; }
.cal td:first-child, .cal th:first-child { text-align: left; position: sticky; left: 0; background: var(--card); white-space: nowrap; }

/* ---------------------------------------------------------------- กล่องโต้ตอบของแอป (แทน prompt/confirm) */
.modal-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(20, 28, 48, .45);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
.modal {
  background: var(--card); width: 100%; max-width: 460px; max-height: 92vh; overflow: auto;
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 30px rgba(20, 30, 60, .25);
}
.modal h2 { margin-bottom: 6px; }
.modal-msg { margin: 0 0 6px; white-space: pre-line; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
@media (min-width: 600px) {
  .modal-back { align-items: center; padding: 16px; }
  .modal { border-radius: 18px; padding: 20px; }
}

/* ---------------------------------------------------------------- เลื่อนหน้าแล้วหัวยังเห็น
   แถบบน: ตัวที่ต้อง sticky คือ #app-header (ลูกของ body) — เดิมใส่ไว้ที่ .topbar ซึ่งอยู่ในกล่องสูงเท่าตัวเอง จึงเลื่อนหายไปกับกล่อง */
:root { --topbar-h: 57px; }
#app-header { position: sticky; top: 0; z-index: 25; background: var(--card); }
#app-header .topbar { position: static; }

/* หัวตารางค้าง: จอเล็ก = ตารางเลื่อนในกรอบของตัวเอง (หัวค้างบนสุดของกรอบ) · จอใหญ่ = หัวค้างใต้แถบบนตอนเลื่อนทั้งหน้า */
.sticky-head, .sticky-box { overflow: auto; max-height: calc(100vh - var(--topbar-h) - 96px); max-height: calc(100dvh - var(--topbar-h) - 96px); }
.sticky-head thead th, .sticky-box thead th {
  position: sticky; top: 0; z-index: 3; background: var(--card); box-shadow: inset 0 -1px 0 var(--line);
}
.sticky-box thead th:first-child { left: 0; z-index: 4; }
@media (min-width: 900px) {
  .sticky-head { overflow: visible; max-height: none; }
  .sticky-head thead th { top: var(--topbar-h); }
}
td.pick-cell, th.pick-cell { width: 34px; padding-right: 0; }
td.pick-cell input, th.pick-cell input { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- ใช้เต็มความกว้างจอ (งาน 011)
   เมนูซ้ายชิดขอบซ้าย เนื้อหาใช้ที่เหลือทั้งหมด · ฟอร์ม/ข้อความกว้างสุด 1600px กันบรรทัดยาวเกินอ่าน · บล็อกที่มีตารางใช้เต็มจอ */
.main { max-width: none; }
@media (min-width: 900px) {
  .layout { max-width: none; margin: 0; grid-template-columns: 220px minmax(0, 1fr); }
  .side-menu { top: var(--topbar-h); max-height: calc(100vh - var(--topbar-h)); overflow-y: auto; }
  .tabs { flex-wrap: wrap; overflow-x: visible; }
  /* หน้าที่ไม่มีตารางเลย (ฟอร์ม/ข้อความล้วน) = กว้างสุด 1600px · หน้าที่มีตาราง = ทั้งหน้าเต็มจอ (ขอบขวาของการ์ดเสมอกัน) */
  .main:not(:has(table)) > *:not(.tabs) { max-width: 1600px; }
}

/* ---------------------------------------------------------------- แถบปุ่ม/ค้นหาค้างใต้แถบบน (งาน 012)
   .sticky-tools = ชื่อหน้า + ปุ่ม + ค้นหา/ตัวกรอง · app.js วัดความสูงจริงใส่ --tools-h แล้วหัวตารางค้างต่อใต้แถบนี้ (ไม่ซ้อนกัน)
   มือถือ: ค้างแค่ .tools-main (ค้นหา + ปุ่มหลัก) · ของรองอยู่ใน .tools-extra เปิดด้วยปุ่ม ⋯ */
:root { --tools-h: 0px; }
.sticky-tools {
  position: sticky; top: var(--topbar-h); z-index: 15; background: var(--bg);
  padding: 8px 0; margin-bottom: 8px; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}
.tools-main, .tools-extra { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tools-title { margin: 0 8px 0 0; font-size: 1.25rem; white-space: nowrap; }
.sticky-tools input:not([type=checkbox]), .sticky-tools select { width: auto; flex: 1 1 170px; min-width: 0; max-width: 360px; }
.sticky-tools .tabs { margin: 0; padding: 0; flex: 1 1 100%; }
.sticky-tools .btn { flex: none; }
.tools-grow { flex: 1 1 auto; }
.tools-more { display: none; }
.sticky-tools .tabs:empty, .tools-extra:empty { display: none; }

/* หัวตารางค้างต่อใต้แถบเครื่องมือ */
.sticky-head, .sticky-box {
  max-height: calc(100vh - var(--topbar-h) - var(--tools-h) - 96px);
  max-height: calc(100dvh - var(--topbar-h) - var(--tools-h) - 96px);
}
@media (min-width: 900px) {
  .sticky-head { max-height: none; }
  .sticky-head thead th { top: calc(var(--topbar-h) + var(--tools-h)); }
}
@media (min-width: 700px) {
  .main.has-tools > h1:first-child { display: none; }   /* ชื่อหน้าย้ายเข้าไปอยู่ในแถบค้าง */
}
@media (max-width: 699px) {
  .tools-title { display: none; }                        /* มือถือ: ชื่อหน้าอยู่ที่หัวข้อปกติ (เลื่อนไปกับหน้า) */
  .tools-extra { display: none; }
  .sticky-tools.open .tools-extra { display: flex; }
  .tools-more { display: inline-flex; padding: 8px 14px; font-size: 1.2rem; line-height: 1; }
  .sticky-tools .btn { min-height: 44px; padding: 8px 12px; }
  .sticky-tools input:not([type=checkbox]), .sticky-tools select { min-height: 44px; max-width: none; }
  .sticky-tools .tabs { flex-wrap: nowrap; }
}
#tab-tools:empty { display: none; }

/* การ์ด "เริ่มใช้งาน" (web/onboarding.js) */
.onboarding .ob-item { flex-wrap: wrap; }
.onboarding .ob-mark { flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 1.5px solid var(--line); color: var(--muted); }
.onboarding .ob-item.done .ob-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.onboarding .ob-item.done .grow { color: var(--muted); }

/* แถบบอกว่ากำลังดูแบบอ่านอย่างเดียว (ผู้ให้บริการ / สำนักงานบัญชี) */
.readonly-banner { padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; font-weight: 600; color: #fff; background: #b45309; }
.readonly-banner.support { background: #b91c1c; }

/* ปุ่มสลับภาษา TH | EN */
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-left: 8px; flex: 0 0 auto; }
.lang-switch button { border: 0; background: transparent; padding: 6px 10px; font: inherit; font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 32px; }
.lang-switch button.active { background: var(--brand, #1f5eff); color: #fff; }
.lang-float { position: fixed; top: 10px; right: 12px; z-index: 30; background: var(--card, #fff); border-radius: 999px; }
.lang-float .lang-switch { margin-left: 0; }

/* หน้าตั้งค่า: ช่องตัวเลขมีหน่วย · คำอธิบายใต้ติ๊กบ็อกซ์ · หัวข้อ "ขั้นสูง" พับไว้ · แถบบันทึกค้างด้านล่าง */
.set-field { margin-bottom: 4px; }
.set-field small { display: block; margin-top: 4px; }
.set-field .check { margin-top: 12px; font-weight: 600; }
.check-hint { padding-left: 26px; }
.unit-input { display: flex; align-items: center; gap: 8px; }
.unit-input input { max-width: 140px; }
.unit-input span { color: var(--ink-soft); white-space: nowrap; }
details.advanced { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
details.advanced summary { cursor: pointer; font-weight: 600; min-height: var(--tap); display: flex; align-items: center; gap: 6px; color: var(--ink-soft); list-style: none; }
details.advanced summary::-webkit-details-marker { display: none; }
details.advanced summary::before { content: "\25B8"; }
details.advanced[open] summary::before { content: "\25BE"; }
.save-bar {
  position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 15; display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; box-shadow: 0 -2px 10px rgba(20, 28, 48, .06);
}
.save-bar .save-note { color: var(--ink-soft); font-size: .92rem; margin-right: auto; }
.save-bar.dirty { border-color: var(--warn); }
.save-bar.dirty .save-note { color: var(--warn); font-weight: 600; }
@media (min-width: 900px) { .save-bar { bottom: 12px; } }

/* เส้นคั่นเหนือ "หน้าผู้ดูแลระบบ" (รายการสุดท้ายของเมนู — เห็นเฉพาะผู้ให้บริการ) */
.menu-sep { border: 0; border-top: 1px solid var(--line); margin: 8px 6px; }

/* ช่องรหัสผ่าน (password-ui.js): กรอบเป็นของตัวห่อ ปุ่มตาอยู่ขวาในกรอบแต่นอกช่องพิมพ์ — ไอคอนของตัวจัดการรหัสผ่านจึงไม่ทับปุ่มตา */
.pw-wrap { display: flex; align-items: center; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pw-wrap:focus-within { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.pw-wrap input { flex: 1; min-width: 0; border: 0; background: transparent; }
.pw-wrap input:focus { outline: 0; }
.pw-wrap.pw-bad { border-color: var(--bad); }
.pw-eye {
  flex: none; width: 44px; height: 44px; margin-right: 2px; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink-soft); display: grid; place-items: center; cursor: pointer;
}
.pw-eye:hover { color: var(--ink); }
.pw-eye:focus-visible { outline: 2px solid var(--brand); }
.pw-eye svg { width: 22px; height: 22px; }
.pw-note { display: block; margin-top: 4px; font-size: .9rem; min-height: 1.2em; }
.pw-note.bad { color: var(--bad); font-weight: 600; }
.pw-note.ok { color: var(--ok); }
.pw-checks { list-style: none; padding: 0; margin: 6px 0 2px; font-size: .9rem; color: var(--ink-soft); }
.pw-checks li::before { content: "\25CB"; display: inline-block; width: 1.4em; }
.pw-checks li.ok { color: var(--ok); }
.pw-checks li.ok::before { content: "\2713"; font-weight: 700; }

/* ---------------------------------------------------------------- หน้าเข้าสู่ระบบ/สมัคร แบบการ์ดกลางจอ (งาน 024) */
.auth-body { background: linear-gradient(160deg, var(--brand-soft) 0%, var(--bg) 45%, var(--bg) 100%); padding-bottom: 0; min-height: 100vh; }
.auth-card { position: relative; max-width: 420px; padding: 22px 20px; }
#lang-slot { position: absolute; top: 12px; right: 12px; }
#lang-slot .lang-switch { margin-left: 0; }
.auth-head { text-align: center; margin: 0 0 10px; font-size: 1.35rem; }
.auth-points { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.auth-points li { position: relative; padding-left: 30px; color: var(--ink); }
.auth-points li::before {
  content: "\2713"; position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ok-soft); color: var(--ok); font-weight: 700; font-size: .85rem; display: grid; place-items: center;
}
.btn.social { gap: 10px; font-weight: 600; }
.btn.social svg { width: 22px; height: 22px; flex: none; }
.btn.social.line { background: #06c755; border-color: #06c755; color: #fff; }
.btn.social.line:hover { background: #05b34c; }
.btn.social.google { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.social.google:hover { background: var(--bg); }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 12px 0; color: var(--ink-soft); font-size: .9rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-terms { margin: 14px 0 0; font-size: .85rem; color: var(--ink-soft); text-align: center; }
.auth-alt { margin: 10px 0 0; text-align: center; font-size: .95rem; }
@media (max-width: 480px) {
  .auth-page { padding: 0; place-items: start stretch; }
  .auth-card { max-width: none; min-height: 100vh; border-radius: 0; margin: 0; box-shadow: none; padding-top: 28px; }
}

/* ---------------------------------------------------------------- เอกสารทางกฎหมาย: เงื่อนไขการใช้งาน / นโยบายความเป็นส่วนตัว (งาน 025) */
.legal-page { place-items: start center; }
.legal-card { position: relative; width: 100%; max-width: 820px; margin: 16px auto; padding: 22px 20px; }
.legal { line-height: 1.7; overflow-wrap: anywhere; }
.legal h1 { font-size: 1.5rem; margin: 0 0 12px; }
.legal h2 { font-size: 1.15rem; margin: 26px 0 8px; padding-top: 6px; scroll-margin-top: 12px; }
.legal h3 { font-size: 1rem; margin: 16px 0 6px; }
.legal p { margin: 8px 0; }
.legal ul, .legal ol { margin: 8px 0; padding-left: 22px; }
.legal li { margin: 4px 0; }
.legal section { scroll-margin-top: 12px; }
.legal-meta { color: var(--ink-soft); font-size: .92rem; }
.legal-toc { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 16px 0; }
.legal-toc h2 { margin: 0 0 6px; padding: 0; font-size: 1rem; }
.legal-toc ol { margin: 0; columns: 2; column-gap: 28px; }
.legal-toc li { break-inside: avoid; }
.legal-toc a { display: inline-block; padding: 3px 0; }
.legal-table th, .legal-table td { font-size: .92rem; min-width: 120px; }
.legal-top { margin: 10px 0 0; font-size: .85rem; text-align: right; }
.legal-foot { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .95rem; }
@media (max-width: 600px) {
  .legal-card { margin: 0; border-radius: 0; box-shadow: none; padding-top: 28px; }
  .legal-toc ol { columns: 1; }
  .legal-toc a { padding: 6px 0; }
}

/* ---------------------------------------------------------------- แถบยินยอมคุกกี้ + กล่องตั้งค่า (งาน 026) */
.consent-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--card); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(20, 28, 48, .10); padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: center;
}
.consent-text { flex: 1 1 320px; max-width: 720px; font-size: .92rem; }
.consent-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; flex: 1 1 420px; max-width: 560px; }
@media (max-width: 520px) { .consent-actions { grid-template-columns: 1fr; } }
/* สามปุ่มหน้าตาเดียวกัน ขนาดเท่ากัน — ไม่มีปุ่มไหนเด่นหรือด้อยกว่า */
.consent-btn { width: 100%; min-height: 44px; padding-left: 8px; padding-right: 8px; background: var(--card); border: 1.5px solid var(--ink); color: var(--ink); font-weight: 600; }
.consent-btn:hover { background: var(--bg); }
.consent-modal h2 { margin-top: 0; }
.consent-cat { border-top: 1px solid var(--line); padding: 10px 0; }
.consent-cat p { margin: 4px 0 0 30px; font-size: .9rem; }
.consent-switch { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 400; cursor: pointer; }
.consent-switch input { width: 20px; height: 20px; flex: none; }
.cookie-foot { text-align: center; font-size: .85rem; margin: 18px 0 4px; }
.cookie-foot a { color: var(--ink-soft); text-decoration: underline; }

/* ---------------------------------------------------------------- เอกสารพนักงานแบบกรอบ + ลิงก์สมัครงาน (งาน 029) */
.doc-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-title h2 { margin: 0; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-top: 10px; }
.doc-slot { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; background: var(--card); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.doc-slot.missing { border-color: var(--bad); background: var(--bad-soft); }
.doc-slot.over { border-color: var(--brand); background: var(--brand-soft); }
.doc-slot.busy { opacity: .6; pointer-events: none; }
.doc-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.doc-file { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 6px; }
.doc-file .grow { flex: 1 1 140px; min-width: 0; }
.doc-name { word-break: break-all; }
.doc-fix { color: var(--bad); }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.doc-drop {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 56px; margin: auto 0 0; padding: 8px;
  border: 1.5px dashed var(--line); border-radius: 10px; color: var(--ink-soft); font-weight: 400; font-size: .92rem; cursor: pointer; background: var(--card);
}
.doc-drop:hover { border-color: var(--brand); color: var(--brand); }
.doc-camera { justify-content: center; }
.doc-preview .modal { max-width: min(92vw, 900px); }
.doc-preview img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: 8px; }
.doc-alert a { color: inherit; font-weight: 600; }
.btn.current { border-color: var(--brand); color: var(--brand); font-weight: 700; }
.lk-url { margin-top: 6px; font-size: .85rem; color: var(--ink-soft); }
.lk-row { align-items: flex-start; flex-wrap: wrap; }
.lk-row .grow { flex: 1 1 260px; }

/* ---------------------------------------------------------------- เงินเดือน (งาน 031) */
.pay-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.pay-stat { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card); display: flex; flex-direction: column; gap: 2px; }
.pay-stat b { font-size: 1.1rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-table td, .pay-table th { font-size: .9rem; }
.pay-manual { background: var(--warn-soft); }
.pay-h { margin: 16px 0 4px; font-size: 1rem; }
.pin-input { -webkit-text-security: disc; letter-spacing: .35em; font-size: 1.3rem; }
.pay-net { font-size: 1.2rem; color: var(--brand); }
.pay-drawer { max-width: min(94vw, 640px); max-height: 90vh; overflow-y: auto; }
.slip { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 12px; padding: 20px; max-width: 800px; margin: 0 auto; }
.slip-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid #111; padding-bottom: 8px; }
.slip-head h2 { margin: 0; }
.slip-date { text-align: right; display: flex; flex-direction: column; }
.slip-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 12px 0; }
.slip-info div { display: flex; flex-direction: column; }
.slip-info small, .slip-date small { color: #555; }
.slip-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.slip-cols table { width: 100%; border-collapse: collapse; }
.slip-cols th, .slip-cols td { padding: 5px 6px; border-bottom: 1px solid #ddd; text-align: left; font-size: .92rem; }
.slip-cols th.num, .slip-cols td.num { text-align: right; }
.slip-cols tfoot td { font-weight: 700; border-top: 2px solid #111; border-bottom: 0; }
.slip-net { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 8px; padding: 10px 12px; border: 2px solid #111; border-radius: 8px; font-size: 1.15rem; }
.slip-ytd { font-size: .88rem; margin: 4px 0; }
.slip-foot { font-size: .8rem; color: #555; margin: 12px 0 0; }
@media (max-width: 600px) { .slip-cols { grid-template-columns: 1fr; } }
@media print {
  #app-header, #app-side, #app-nav, .more-sheet, .slip-tools, .cookie-foot, .consent-banner, .lang-float, .toast, #app-main > h1, .readonly-banner { display: none !important; }
  body, .layout, .main { background: #fff !important; padding: 0 !important; margin: 0 !important; display: block !important; }
  .slip { border: 0; padding: 0; max-width: none; }
  .pd-noprint { display: none !important; }
  .pd-page { border: 0; padding: 0; max-width: none; margin: 0; page-break-after: always; }
  .pd-page:last-child { page-break-after: auto; }
}

/* งาน 034: อันดับของเดือน (หน้าแรก) · คะแนนเข้างานของฉัน */
.rank-h { margin: 12px 0 2px; font-size: .95rem; }
.score-bad { color: var(--bad); }
.score-ok { color: var(--ok); }

/* งาน 034: ประกาศ · หนังสือเตือน/หนังสือรับรองแบบพิมพ์ */
.ann-h { margin: 18px 0 8px; font-size: 1.05rem; }
.ann-body { margin: 10px 0; }
.ann-body p { margin: 0 0 8px; }
.ann-body ul { margin: 0 0 8px; padding-left: 22px; }
.ann-pick { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 8px; display: grid; gap: 4px; }
.lt-page { line-height: 1.7; }
.lt-head { text-align: center; margin-bottom: 14px; }
.lt-head h2, .lt-head h3 { margin: 0; }
.lt-date { text-align: right; }
.lt-detail { border-left: 3px solid #bbb; padding-left: 12px; }
.lt-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 28px; }

/* เอกสารเงินเดือนพร้อมพิมพ์ (งาน 032): สปส.1-10 · ใบแนบ ภ.ง.ด.1/1ก · 50 ทวิ · รายงานจ่ายเงินสด · สมุดรายวัน */
.pd-page { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 12px; padding: 20px; max-width: 900px; margin: 0 auto 16px; }
.pd-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 12px; }
.pd-head h2, .pd-wht h2 { margin: 0; }
.pd-head small, .pd-co small { color: #555; display: block; }
.pd-co { text-align: right; }
.pd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin: 0 0 12px; }
.pd-grid div { display: flex; flex-direction: column; }
.pd-grid small { color: #555; }
.pd-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.pd-table th, .pd-table td { padding: 5px 6px; border-bottom: 1px solid #ddd; text-align: left; }
.pd-table th.num, .pd-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pd-table tfoot td { font-weight: 700; border-top: 2px solid #111; border-bottom: 0; }
.pd-table td.pd-blank { min-width: 120px; height: 34px; }
.pd-table td.pd-cr { padding-left: 28px; }
.pd-copy { font-size: .82rem; color: #555; text-align: right; }
.pd-party { border: 1px solid #bbb; border-radius: 8px; padding: 8px 10px; margin: 10px 0; display: flex; flex-direction: column; gap: 2px; }
.pd-party small { color: #333; }
.pd-id { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.pd-box { display: inline-block; width: 15px; height: 15px; border: 1px solid #111; text-align: center; line-height: 14px; font-size: .8rem; vertical-align: -2px; }
.pd-words { margin: 10px 0 4px; }
.pd-sign { margin-top: 18px; text-align: center; }
.pd-line { width: 240px; border-bottom: 1px dotted #111; margin: 34px auto 6px; }

/* งาน 036: ตารางอัตราเงินเดือน (หน้าผู้ดูแลระบบ) — กระชับ ปุ่มติดท้ายแถว · หมวดพับได้ · มือถือเป็นการ์ด */
.pr-tools { justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.pr-group { margin-top: 12px; }
.pr-group > summary { cursor: pointer; padding: 8px 0; list-style-position: inside; }
.pr-table { width: 100%; }
.pr-table th, .pr-table td { vertical-align: top; }
.pr-table .pr-name { min-width: 200px; max-width: 340px; }
.pr-table .pr-val { min-width: 160px; max-width: 320px; }
.pr-table .pr-date { white-space: nowrap; }
.pr-table .pr-srccell { text-align: center; width: 1%; }
.pr-table .pr-act { white-space: nowrap; width: 1%; text-align: right; }
.pr-src { text-decoration: none; font-weight: 700; }
.modal-adv { margin-top: 8px; }
.modal-adv > summary { cursor: pointer; color: var(--ink-soft); padding: 4px 0; }

/* งาน 038: แถบเครื่องมือตารางกะค้างบนจอเมื่อเลื่อนลง + ตัวนับช่องที่เลือก */
.r-tools { position: sticky; top: var(--topbar-h, 57px); z-index: 5; background: var(--card); padding: 8px 0; margin: 10px 0; align-items: center; border-bottom: 1px solid var(--line); }
.r-count { min-width: 9em; }

/* งาน 038: ปฏิทินวันหยุด 12 เดือนแบบลากวาง */
.hc-count { margin: 8px 0; }
.hc-wrap { display: grid; grid-template-columns: 1fr 240px; gap: 14px; align-items: start; margin-top: 8px; }
.hc-side { position: sticky; top: calc(var(--topbar-h, 57px) + 8px); display: grid; gap: 10px; }
.hc-drop { border: 2px dashed var(--line); border-radius: 12px; padding: 14px; text-align: center; display: grid; gap: 4px; }
.hc-std { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.hcal { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.hcal-month { border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.hcal-t { width: 100%; border-collapse: collapse; table-layout: fixed; }
.hcal-t th { font-size: .72rem; color: var(--ink-soft); padding: 2px 0; text-align: center; }
.hcal-t td { vertical-align: top; height: 38px; padding: 1px; border: 1px solid var(--line); font-size: .72rem; cursor: pointer; }
.hcal-t td.hwe { background: #fafbfd; }
.hcal-t td.hhas { background: var(--warn-soft); }
.hnum { display: block; color: var(--ink-soft); }
.hcard { display: block; background: var(--brand); color: #fff; border-radius: 6px; padding: 1px 4px; font-size: .68rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: grab; }
.hcard.hstd { background: var(--brand-soft); color: var(--ink); white-space: normal; font-size: .78rem; padding: 4px 6px; cursor: pointer; }
.hc-pick label.check { display: flex; margin: 4px 0; }
.hc-pick .hc-sub { margin-left: 22px; }

/* งาน 040: รายละเอียดเทคนิคในกล่องข้อผิดพลาด — เห็นเฉพาะผู้ให้บริการ */
.admin-detail { display: inline-block; margin-top: 4px; font-family: ui-monospace, monospace; color: var(--ink-soft); }

/* งาน 041/042: dropdown "อื่น ๆ (ระบุ)" — ช่องพิมพ์ขึ้นใต้ช่องเดิม · รายละเอียดงานบนหน้าสมัคร */
.other-input { margin-top: 6px; }
.ap-job { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; display: grid; gap: 8px; }
.ap-job-rows { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.ap-desc { white-space: normal; line-height: 1.55; }

/* งาน 043: ช่องวันที่กลาง วว/ดด/ปปปป + ปฏิทิน พ.ศ. */
.di { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.di .di-text { flex: 1 1 10em; min-width: 9em; }
.di .di-note { flex-basis: 100%; }
.di .di-note.warn { color: var(--warn); }
.di-pop { position: absolute; top: 100%; left: 0; z-index: 60; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; width: 270px; }
.di-head { display: flex; gap: 4px; align-items: center; margin-bottom: 6px; }
.di-head select { flex: 1; padding: 4px; }
.di-head button, .di-grid button { border: 0; background: transparent; border-radius: 8px; cursor: pointer; padding: 6px 0; font: inherit; }
.di-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: .85rem; }
.di-grid b { color: var(--ink-soft); font-weight: 600; font-size: .75rem; }
.di-grid button:hover { background: var(--brand-soft); }
.di-grid button.on { background: var(--brand); color: #fff; }

/* งาน 044: ปุ่มดินสอเล็ก (แก้ในบรรทัด) · ที่จับลากเรียงระดับ */
.icon-btn { min-width: 32px; padding-left: 8px; padding-right: 8px; }
.drag-handle { cursor: grab; color: var(--ink-soft); padding: 0 6px; user-select: none; }
.lvl-row[draggable="true"] { cursor: grab; }

/* ================================================================ หน้าตามือถือ (งาน 028)
   ทุกกฎขึ้นต้นด้วย html.m-ui (web/mobile.js ใส่ให้เมื่อจอกว้าง < 768px หรือเปิดแบบแอปที่ติดตั้ง) — บนคอมไม่มี class นี้ หน้าตาเดิมไม่เปลี่ยน
   ของที่มีเฉพาะมือถือใช้ .m-only (ปกติซ่อน) · ของที่ซ่อนบนมือถือใช้ .m-hide */
.m-only, .emp-chip { display: none; }
html.m-ui .m-only { display: block; }
html.m-ui .m-hide { display: none; }
html.m-ui body { overscroll-behavior-y: contain; }

/* แถบบอกว่าออฟไลน์ (ขึ้นเฉพาะตอนไม่มีเน็ต) */
.offline-bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 70; background: var(--warn); color: #fff; text-align: center;
  font-size: .85rem; padding: calc(4px + env(safe-area-inset-top)) 12px 4px;
}

/* หัว: แตะชื่อบริษัทแล้วเลือกจากแผ่นด้านล่าง */
html.m-ui .emp-switch select { display: none; }
html.m-ui .emp-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 52vw; min-height: 38px; padding: 4px 12px; font: inherit; font-size: .9rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); cursor: pointer;
}
html.m-ui .emp-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.m-ui .emp-chip::after { content: "▾"; color: var(--ink-soft); }

/* แผ่นเลื่อนจากล่าง */
.m-sheet-back { position: fixed; inset: 0; z-index: 90; background: rgba(20, 28, 48, .45); display: flex; align-items: flex-end; justify-content: center; }
.m-sheet {
  background: var(--card); width: 100%; max-width: 560px; max-height: 80vh; max-height: 80dvh; display: flex; flex-direction: column;
  border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(20, 30, 60, .18);
  animation: m-up .18s ease-out;
}
.m-sheet::before { content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 6px; flex: none; }
.m-sheet-head { display: flex; align-items: center; gap: 8px; padding: 4px 0 8px; font-size: 1.05rem; }
.m-sheet-head b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-sheet-x { border: 0; background: transparent; font-size: 1.1rem; min-width: 44px; min-height: 44px; color: var(--ink-soft); cursor: pointer; }
.m-sheet-body { overflow: auto; -webkit-overflow-scrolling: touch; }
.m-sheet-group { font-size: .8rem; color: var(--ink-soft); padding: 10px 4px 4px; }
.m-sheet-item {
  display: block; width: 100%; text-align: left; min-height: var(--tap); padding: 12px; border: 0; border-radius: 12px; background: transparent;
  font: inherit; color: var(--ink); cursor: pointer;
}
.m-sheet-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
@keyframes m-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .m-sheet { animation: none; } }

/* ตัวกรองของแถบเครื่องมือ = แผ่นเลื่อนจากล่าง (เปิดด้วยปุ่ม ⋯ เดิม) */
.m-sheet-title, .m-sheet-done { display: none; }
@media (max-width: 699px) {
  html.m-ui .sticky-tools.open { z-index: 60; }
  html.m-ui .sticky-tools.open::after { content: ""; position: fixed; inset: 0; background: rgba(20, 28, 48, .45); }
  html.m-ui .sticky-tools.open .tools-extra {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 10px;
    background: var(--card); border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    max-height: 75vh; overflow: auto; box-shadow: 0 -8px 30px rgba(20, 30, 60, .18); animation: m-up .18s ease-out;
  }
  html.m-ui .sticky-tools.open .tools-extra > * { flex: none; width: 100%; max-width: none; }
  html.m-ui .sticky-tools.open .m-sheet-title { display: block; font-size: 1.05rem; }
  html.m-ui .sticky-tools.open .m-sheet-done { display: inline-flex; }
}

/* แดชบอร์ดวันนี้ (หน้าแรกของหัวหน้า/ฝ่ายบุคคล/เจ้าของ) */
html.m-ui #m-install, html.m-ui #m-dash { grid-column: 1 / -1; }
html.m-ui .m-manager #card-clock.no-employee { display: none; }
.m-dash-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 14px 0 6px; }
.m-dash-head h2 { margin: 0; }
.m-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.m-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 92px; justify-content: center; padding: 10px 4px;
  border: 0; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); font: inherit; color: var(--ink-soft); cursor: pointer;
}
.m-stat b { font-size: 2.3rem; line-height: 1.1; color: var(--ink); }
.m-stat.ok b { color: var(--ok); }
.m-stat.warn b { color: var(--warn); }
.m-stat.bad b { color: var(--bad); }
.m-sub { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.m-chip {
  flex: none; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  font: inherit; font-size: .9rem; color: var(--ink-soft); cursor: pointer;
}
.m-chip b { color: var(--ink); }
.m-req { margin: 8px 0; touch-action: pan-y; position: relative; }
.m-req .pick, html.m-ui #list .pick { width: 24px; height: 24px; margin-top: 2px; flex: none; }
.m-req .btn-row { margin-top: 8px; }
.m-req .btn-row .btn { flex: 1; min-height: 44px; }
.m-clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70vw; }
.m-shortcuts { margin: 10px 0 0; }
.m-shortcuts .btn { flex: 1; }
html.m-ui #list .card[data-id] { touch-action: pan-y; }
.m-swipe-right { box-shadow: inset 6px 0 0 var(--ok), var(--shadow); background: var(--ok-soft); }
.m-swipe-left { box-shadow: inset -6px 0 0 var(--bad), var(--shadow); background: var(--bad-soft); }
.m-gone { display: none !important; }

/* แถบ "ทำแล้ว · ยกเลิก" 5 วินาที */
.m-undo-wrap {
  position: fixed; left: 8px; right: 8px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 55; display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
.m-undo {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; border-radius: 12px; padding: 6px 6px 6px 14px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.m-undo-btn { border: 0; background: transparent; color: #9db8ff; font: inherit; font-weight: 700; min-height: 44px; padding: 0 14px; cursor: pointer; }
.m-undo-time { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: #9db8ff; transform-origin: left; animation: m-time 5s linear forwards; }
@keyframes m-time { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ดึงลงเพื่อรีเฟรช */
.m-ptr {
  position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; z-index: 65; background: var(--card); color: var(--ink-soft); border-radius: 999px;
  padding: 6px 14px; font-size: .85rem; box-shadow: var(--shadow); pointer-events: none;
}
.m-ptr.ready { color: var(--brand); font-weight: 600; }

/* ติดตั้งแอป + แจ้งเตือน */
.m-install-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.m-install-head img { border-radius: 10px; flex: none; }
.m-install-steps { list-style: none; margin: 0 0 8px; padding: 0; counter-reset: step; }
.m-install-steps li { display: flex; align-items: center; gap: 10px; padding: 8px 0; counter-increment: step; }
.m-install-steps li::before {
  content: counter(step); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}
.m-install-pic { flex: none; width: 44px; height: 44px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.m-install-pic svg { width: 26px; height: 26px; }
.m-install .btn-row { margin-top: 8px; }

/* สรุปรายเดือน: การ์ดต่อคน แตะแล้วกางรายวัน */
.m-group { font-weight: 700; color: var(--brand); margin: 14px 0 6px; }
.m-person { padding: 0; margin: 8px 0; overflow: hidden; }
.m-person-head {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; font: inherit; color: var(--ink); padding: 12px 14px;
  min-height: var(--tap); cursor: pointer;
}
.m-person-head[aria-expanded="true"] { background: var(--brand-soft); }
.m-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.m-days { border-top: 1px solid var(--line); }
.m-day {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 44px; padding: 6px 14px;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; font: inherit; color: var(--ink); cursor: pointer; text-align: left;
}
.m-day:last-child { border-bottom: 0; }
.m-day-date { flex: none; min-width: 64px; color: var(--ink-soft); }
.m-day-date.weekend { color: var(--bad); }

/* ตารางรายชื่อพนักงาน → การ์ดต่อคน (เลื่อนขึ้นลง ไม่เลื่อนซ้ายขวา) */
html.m-ui .m-cards.sticky-head { max-height: none; overflow: visible; }
html.m-ui .m-cards thead { display: none; }
html.m-ui .m-cards table, html.m-ui .m-cards tbody, html.m-ui .m-cards tr, html.m-ui .m-cards td { display: block; width: 100%; }
html.m-ui .m-cards tr { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--card); }
html.m-ui .m-cards td { border: 0; padding: 2px 0; }
html.m-ui .m-cards td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-soft); font-size: .85rem; }
html.m-ui .m-cards td[data-cell="code"] { color: var(--ink-soft); font-size: .85rem; }
html.m-ui .m-cards td[data-cell="name"] { font-weight: 700; font-size: 1.05rem; padding-right: 40px; }
html.m-ui .m-cards td[data-cell="status"] { position: absolute; top: 10px; right: 48px; width: auto; }
html.m-ui .m-cards td.pick-cell { position: absolute; top: 8px; right: 10px; width: auto; }
html.m-ui .m-cards td.pick-cell input { width: 24px; height: 24px; }
html.m-ui .m-cards td[data-cell="open"] { margin-top: 8px; }
html.m-ui .m-cards td[data-cell="open"] .btn { width: 100%; min-height: 44px; }
html.m-ui .m-cards td[colspan] { text-align: center; }
/* จอแคบ: หัวเหลือเครื่องหมาย HR + ชื่อบริษัท + ปุ่มภาษา (ไม่ล้นจอ) */
@media (max-width: 420px) { html.m-ui .topbar .brand > span:not(.brand-mark) { display: none; } }
html.m-ui .emp-switch { min-width: 0; }
html.m-ui .card:has(> .m-cards) { padding: 0; background: transparent; box-shadow: none; }

/* งาน 036: ตารางอัตราเงินเดือนบนมือถือ = การ์ด */
html.m-ui .pr-table thead { display: none; }
html.m-ui .pr-table tr { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--card); }
html.m-ui .pr-table td { display: block; border: 0; padding: 2px 0; max-width: none; min-width: 0; width: auto; text-align: left; }
html.m-ui .pr-table .pr-act { margin-top: 6px; }

/* งาน 038: ปฏิทินวันหยุดบนมือถือ = เรียงลงมา (แตะการ์ดเพื่อย้าย/เอาออก) */
html.m-ui .hc-wrap { grid-template-columns: 1fr; }
html.m-ui .hc-side { position: static; }
