/* ระบบ HR — สไตล์ชีตเดียวของทั้งแอป
   ตัวแปรสีอยู่ใน :root บล็อกเดียว · มือถือก่อน (แถบเมนูล่าง) จอกว้าง ≥ 960px มีแถบข้าง
   หน้าพิมพ์ (.bare / @media print) ใช้กับสลิป 50 ทวิ และแบบฟอร์มราชการ */

@font-face { font-family: "Noto Sans Thai"; src: url("/static/fonts/noto-sans-thai-400-700-thai.woff2") format("woff2");
  font-weight: 400 700; font-display: swap; }

:root {
  --bg: #f3f5f9; --surface: #fff; --surface-2: #f7f8fb; --line: #e3e7ef; --line-2: #cfd6e3;
  --ink: #18202f; --ink-2: #3d4759; --ink-3: #5d677a; --ink-4: #6b7588;
  --accent: #1f4fd1; --accent-2: #173fae; --accent-soft: #e8eefc;
  --pos: #12804a; --pos-soft: #e3f4ea; --neg: #c0332b; --neg-soft: #fbe9e7; --warn: #9a6200; --warn-soft: #fdf2d8;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,30,60,.06), 0 1px 1px rgba(20,30,60,.04);
  --font: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; line-height: 1.3; margin: 0 0 .75rem; font-weight: 700; }
h2 { font-size: 1.08rem; margin: 0 0 .7rem; font-weight: 700; }
h3 { font-size: .98rem; margin: 0 0 .5rem; font-weight: 700; }
p { margin: 0 0 .7rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.small { font-size: .85rem; } .muted { color: var(--ink-3); } .neg { color: var(--neg); } .warn-text { color: var(--warn); }
.mt { margin-top: 1rem; } .center { text-align: center; } .right { text-align: right; }
.ic { width: 20px; height: 20px; flex: none; }

/* ---------- โครงหน้า ---------- */
/* แถบเมนูข้างแบบ animated sidebar: จอกว้างย่อเหลือไอคอนได้ (Ctrl/⌘+B) · มือถือเป็นลิ้นชักเลื่อนจากซ้าย
   ทุกอย่างเป็น CSS transition + app.js เล็ก ๆ (ไม่มี React) · prefers-reduced-motion ปิดแอนิเมชัน */
:root { --rail-w: 252px; --rail-w-min: 68px; --rail-w-mobile: 288px;
  --ease-drawer: cubic-bezier(.32,.72,0,1); --ease-out: cubic-bezier(.22,1,.36,1); --spring: cubic-bezier(.34,1.3,.64,1); }
.app { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px;
  height: 52px; padding: 0 10px 0 6px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; flex: none; }
.mark .ic { width: 18px; height: 18px; }
.mark.big { width: 56px; height: 56px; border-radius: 14px; } .mark.big .ic { width: 30px; height: 30px; }
.bell { position: relative; color: var(--ink-2); display: grid; place-items: center; width: 40px; height: 40px; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--neg); color: #fff;
  font: 700 .72rem/20px var(--font); text-align: center; font-style: normal; }
.bell .count { position: absolute; top: 2px; right: 0; }
.page { max-width: 1440px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.page.solo { padding-bottom: 32px; }

.rail-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-3); cursor: pointer; padding: 0; transition: background .15s, color .15s, transform .15s var(--spring); }
.rail-btn:hover { background: var(--surface-2); color: var(--ink); }
.rail-btn:active { transform: scale(.94); }
.rail-btn:focus-visible, .rail a:focus-visible, .grp-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ตัวแถบ (ใช้ markup ชุดเดียวทั้งจอกว้างและลิ้นชักมือถือ) */
.rail { display: flex; flex-direction: column; background: var(--surface); overflow: hidden; }
.rail-head { display: flex; align-items: center; gap: 6px; padding: 12px 10px 8px 14px; min-height: 60px; }
.rail-head .brand { flex: 1; overflow: hidden; white-space: nowrap; }
.rail-toggle { display: none; }
.rail-nav { position: relative; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 4px 10px 10px; }
.rail .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: opacity .2s var(--ease-out) .08s, transform .2s var(--ease-out) .08s; }
.rail-nav a { position: relative; z-index: 1; display: flex; align-items: center; gap: .7rem; min-height: 40px; padding: 0 .75rem;
  border-radius: 12px; color: var(--ink-3); font-size: .93rem; font-weight: 500; transition: color .15s, transform .15s var(--spring); }
.rail-nav a:hover { color: var(--ink); text-decoration: none; }
.rail-nav a:active { transform: scale(.98); }
.rail-nav a.on { color: var(--accent); font-weight: 600; }
.rail-nav a .count { margin-left: auto; flex: none; }
.pill { position: absolute; left: 10px; right: 10px; top: 0; height: 40px; border-radius: 12px; pointer-events: none; z-index: 0;
  transition: transform .32s var(--spring), height .2s var(--ease-out), opacity .18s; will-change: transform; }
.hover-pill { background: var(--surface-2); opacity: 0; }
.rail-nav:hover .hover-pill.show { opacity: 1; }
.active-pill { background: var(--accent-soft); opacity: 0; }
.active-pill.show { opacity: 1; }
.active-pill.instant, .hover-pill.instant { transition: none; }

/* กลุ่มเมนูพับ/กางได้: แถวสูงเปลี่ยนจาก 0fr→1fr + clip-path + รายการค่อย ๆ โผล่ทีละอัน */
.grp + .grp { margin-top: 4px; }
.grp-head { display: flex; align-items: center; width: 100%; height: 32px; margin: 6px 0 2px; padding: 0 .75rem; border: 0; border-radius: 10px;
  background: none; color: var(--ink-4); font: 700 .7rem/1 var(--font); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; }
.grp-head:hover { color: var(--ink-2); background: var(--surface-2); }
.grp-head .lbl { flex: 1; text-align: left; }
.grp-head .ic { width: 15px; height: 15px; transform: rotate(90deg); transition: transform .3s var(--spring), opacity .2s; }
.grp.closed .grp-head .ic { transform: rotate(0deg); }
.grp-items { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .26s var(--ease-out); }
.grp-inner { min-height: 0; overflow: hidden; clip-path: inset(0 0 0% 0 round 8px); transition: clip-path .22s var(--ease-out), opacity .2s; }
.grp-inner a { transition: color .15s, transform .15s var(--spring), opacity .2s var(--ease-out), filter .2s var(--ease-out), translate .2s var(--ease-out);
  transition-delay: 0s, 0s, calc(var(--i) * 35ms + 30ms), calc(var(--i) * 35ms + 30ms), calc(var(--i) * 35ms + 30ms); }
.grp.closed .grp-items { grid-template-rows: 0fr; }
.grp.closed .grp-inner { clip-path: inset(0 0 100% 0 round 8px); opacity: 0; }
.grp.closed .grp-inner a { opacity: 0; filter: blur(3px); translate: 0 -6px; transition-delay: 0s; }

.rail-foot { display: flex; align-items: center; gap: 6px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.rail-foot form { margin: 0; flex: none; }
.who { display: flex; align-items: center; gap: .65rem; flex: 1; min-width: 0; padding: 4px; border-radius: 12px; color: var(--ink); }
.who:hover { background: var(--surface-2); text-decoration: none; }
.who .lbl b { display: block; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; }
.who .lbl span { display: block; font-size: .75rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.who .avatar { position: relative; display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%;
  background: linear-gradient(135deg, #d5e2ff, #b9cdfb); color: var(--accent-2); font-weight: 700; font-size: .95rem; }
.who .avatar .count { position: absolute; top: -5px; right: -7px; min-width: 18px; line-height: 18px; padding: 0 4px; font-size: .65rem; border: 2px solid var(--surface); }

.topbar .rail-btn { position: relative; }
.dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--neg); border: 2px solid var(--surface); box-sizing: content-box; }
.sec { padding: .9rem .8rem .25rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em; color: var(--ink-4); text-transform: uppercase; }

/* มือถือ/แท็บเล็ต: แถบเป็นลิ้นชักเลื่อนจากซ้าย + ฉากมืด */
@media (max-width: 959px) {
  .rail { position: fixed; z-index: 50; inset: 0 auto 0 0; width: var(--rail-w-mobile); max-width: 88vw; height: 100dvh;
    border-right: 1px solid var(--line); box-shadow: 0 20px 60px rgba(15,23,42,.25);
    transform: translateX(-100%); visibility: hidden; transition: transform .36s var(--ease-drawer), visibility 0s .36s; }
  .scrim { position: fixed; inset: 0; z-index: 45; background: rgba(15,23,42,.4); opacity: 0; pointer-events: none; transition: opacity .36s var(--ease-drawer); }
  .drawer-open .rail { transform: none; visibility: visible; transition: transform .36s var(--ease-drawer), visibility 0s; }
  .drawer-open .scrim { opacity: 1; pointer-events: auto; }
  body.drawer-lock { position: fixed; left: 0; right: 0; overflow: hidden; }
}
@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); transition: grid-template-columns .4s var(--ease-drawer); }
  .app.rail-min { grid-template-columns: var(--rail-w-min) minmax(0, 1fr); }
  .rail { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); }
  .rail-close, .scrim, .topbar { display: none; }
  .rail-toggle { display: inline-grid; }
  .page { padding: 24px 28px 40px; }
  /* โหมดไอคอน: ซ่อนข้อความแบบจางหาย, หัวกลุ่มกลายเป็นเส้นคั่น, ทุกกลุ่มกาง (เมนูย่อยแสดงในแถบไอคอนไม่ได้) */
  .rail-min .rail .lbl { opacity: 0; transform: translateX(-4px); pointer-events: none; transition: opacity .12s var(--ease-out), transform .12s var(--ease-out); }
  /* ตอนย่อ: ปุ่มย่อ/ขยาย และรูปผู้ใช้ ต้องอยู่แนวเดียวกับไอคอนเมนู (กึ่งกลาง x = 34px)
     brand/ชื่อผู้ใช้ กว้าง 0 แต่ gap ยังกินที่ — ตัด gap ทิ้งตอนย่อ */
  .rail-min .rail-head { gap: 0; padding-left: 14px; padding-right: 14px; }
  .rail-min .rail-head .brand { flex: 0 0 0; width: 0; }
  .rail-min .rail-head .mark { display: none; }
  .rail-min .grp-head { height: 9px; margin: 6px 0 5px; padding: 0; pointer-events: none; }
  .rail-min .grp-head .ic { opacity: 0; }
  .rail-min .grp-head::after { content: ""; position: absolute; left: 22px; right: 22px; height: 1px; background: var(--line); }
  .rail-min .grp-head { position: relative; }
  .rail-min .grp.closed .grp-items { grid-template-rows: 1fr; }
  .rail-min .grp.closed .grp-inner { clip-path: none; opacity: 1; }
  .rail-min .grp.closed .grp-inner a { opacity: 1; filter: none; translate: none; }
  .rail-min .rail-nav a { padding: 0 14px; }
  /* แถบเลื่อนแบบมีความกว้าง (Windows) กินที่ในแถบ 68px ทำให้ไฮไลต์/ไอคอนเบี้ยว — ตอนย่อซ่อนแถบเลื่อน (ยังเลื่อนด้วยล้อเมาส์/ทัชแพดได้) */
  .rail-min .rail-nav { scrollbar-width: none; }
  .rail-min .rail-nav::-webkit-scrollbar { display: none; }
  .rail-min .rail-nav a .count { position: absolute; top: 3px; left: 28px; min-width: 16px; padding: 0 4px; line-height: 16px; font-size: .62rem; }
  .rail-min .rail-foot { flex-direction: column; padding-left: 8px; padding-right: 8px; }
  .rail-min .who { flex: none; padding: 2px; gap: 0; }
  .rail-min .who .lbl { width: 0; flex: 0 0 0; }
  .rail-min .rail-foot { align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  .app, .rail, .scrim, .pill, .rail .lbl, .grp-items, .grp-inner, .grp-inner a, .grp-head .ic, .rail-btn, .rail-nav a { transition-duration: .01ms !important; transition-delay: 0s !important; }
}

/* ---------- ชิ้นส่วน ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 16px; }
.card.slim { padding: 10px 14px; }
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.card.list { padding: 4px 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: .75rem; }
.head h1, .head h2 { margin: 0; }
.grid2 { display: grid; gap: 16px; } .grid2 > .card { margin-bottom: 0; } .grid2 { margin-bottom: 16px; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* แถวที่มีช่องกรอก: ปุ่มเล็กสูงเท่าช่อง (40px) · ถ้ามีช่องแบบหัวข้ออยู่บน ให้ปุ่ม/ติ๊กชิดล่างตรงกับกล่องกรอก */
:is(.row, .itemrow):has(> :is(input:not([type=hidden]):not([type=checkbox]), select), > label:not(.check) > :is(input, select, textarea)) > .btn.sm { min-height: 40px; }
:is(.row, .itemrow):has(> label:not(.check) > :is(input, select, textarea)) > :is(.btn, button, label.check, input, select, a.btn, .dpick) { align-self: flex-end; }
:is(.row, .itemrow):has(> label:not(.check) > :is(input, select, textarea)) > label.check { min-height: 40px; }
.stack { display: grid; gap: 12px; }
.empty { color: var(--ink-3); text-align: center; padding: 1rem; margin: 0; }

.msg { padding: .7rem .9rem; border-radius: 8px; margin: 0 0 1rem; border: 1px solid transparent; }
.msg.ok { background: var(--pos-soft); color: #0d5c35; border-color: #bfe3cd; }
.msg.bad { background: var(--neg-soft); color: #8e231d; border-color: #f2c6c1; }
.msg.warn { background: var(--warn-soft); color: #6e4600; border-color: #f0d89c; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .76rem; font-weight: 600; line-height: 1.6;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.badge.pos { background: var(--pos-soft); color: var(--pos); border-color: #c4e6d2; }
.badge.neg { background: var(--neg-soft); color: var(--neg); border-color: #f3cdc8; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #f1dca8; }

/* ปุ่ม: สูงอย่างน้อย 40px ให้นิ้วกดได้ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 .92rem var(--font);
  cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--surface); border-color: #e7b2ac; color: var(--neg); }
.btn.danger:hover { background: var(--neg-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn.huge { min-height: 64px; font-size: 1.15rem; padding: 0 28px; border-radius: 14px; width: 100%; max-width: 360px; }
.btn.huge .ic { width: 24px; height: 24px; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ฟอร์ม: ช่องกรอก 16px บนมือถือ ไม่งั้น iOS ซูมหน้าเอง */
input, select, textarea { font: 16px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 0 10px; min-height: 40px; max-width: 100%; }
textarea { padding: 8px 10px; width: 100%; }
input[type=checkbox] { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }
input[type=file] { padding: 6px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
@media (min-width: 960px) { input, select, textarea { font-size: .93rem; } }
label { display: grid; gap: 4px; font-size: .86rem; color: var(--ink-2); font-weight: 600; }
label input, label select, label textarea { font-weight: 400; width: 100%; }
label.check { display: flex; align-items: center; gap: .45rem; font-weight: 400; }
/* ชิดบน ไม่ใช่ชิดล่าง: ช่องที่มีคำอธิบายเล็กใต้ช่อง (เช่น สิ้นสุดทดลองงาน) จะไม่ถูกดันสูงกว่าช่องข้าง ๆ
   ช่องติ๊กชิดล่างของแถวและสูงเท่าช่องกรอก (40px) จึงตรงกับช่องกรอกข้าง ๆ และไม่เหลือช่องว่างเมื่ออยู่แถวเดียว */
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr; align-items: start; }
.form-grid > label.check { align-self: end; min-height: 40px; }
.form-grid > .wide { align-self: end; }
.form-grid small { font-weight: 400; }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .form-grid { grid-template-columns: repeat(3, 1fr); } }
.form-grid .wide, .form-grid h2 { grid-column: 1 / -1; }
.form-grid h2 { margin: .5rem 0 0; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0; }
fieldset.days { display: flex; flex-wrap: wrap; gap: 6px 16px; }
legend { font-size: .82rem; font-weight: 600; color: var(--ink-3); padding: 0 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: end; }
.filters input[type=search] { flex: 1 1 220px; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.inline-form label { display: inline-flex; align-items: center; gap: 6px; }
details > summary { cursor: pointer; padding: .4rem 0; color: var(--accent); font-weight: 600; font-size: .92rem; }
details[open] > summary { margin-bottom: .6rem; }
.orgrow { border-bottom: 1px solid var(--line); padding: .15rem 0; }
.orgrow > summary { color: var(--ink); font-weight: 400; }
.orgrow[open] { padding-bottom: .8rem; }

/* ตาราง */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl thead th { font-size: .78rem; color: var(--ink-3); font-weight: 700; background: var(--surface-2); white-space: nowrap; }
.tbl tfoot th, .tbl tfoot td { background: var(--surface-2); font-weight: 700; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.absent td:first-child { box-shadow: inset 3px 0 var(--neg); }
.tbl tr.incomplete td:first-child { box-shadow: inset 3px 0 var(--warn); }
.tbl tr.off td, .tbl tr.holiday td { color: var(--ink-4); }
.tbl tr.warnrow td { background: #fffaec; }
.tbl.small { font-size: .8rem; }
.tbl .nowrap { white-space: nowrap; }
.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 6px 14px; margin: 0 0 .8rem; }
.kv dt { color: var(--ink-3); font-size: .88rem; } .kv dd { margin: 0; }

/* รายการคำขอ */
.req { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.req:last-child { border-bottom: 0; }
.req-main { flex: 1; min-width: 0; }
.steps { list-style: none; padding: 0; margin: .4rem 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; }
.steps li { position: relative; padding-left: 14px; }
.steps li::before { content: ""; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.steps li.approved::before { background: var(--pos); } .steps li.rejected::before { background: var(--neg); } .steps li.pending::before { background: var(--warn); }
.req-card .req-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: .5rem; }
.approve { display: flex; flex-wrap: wrap; gap: 8px; margin: .6rem 0 .3rem; }
.approve input { flex: 1 1 220px; }
.list .item { display: flex; justify-content: space-between; gap: 12px; padding: .75rem 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.list .item.unread { background: var(--accent-soft); font-weight: 600; }
.list .item:last-child { border-bottom: 0; }

/* หน้าหลัก */
.hello h1 { margin-bottom: .1rem; }
.hello { margin-bottom: 1rem; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 860px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { display: grid; gap: 2px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .muted { font-size: .82rem; }
.tile-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.punch-tile { grid-column: 1 / -1; background: var(--accent); color: #fff; border-color: var(--accent); }
.punch-tile .muted { color: #dce5ff; } .punch-tile .tile-ic { background: rgba(255,255,255,.18); color: #fff; }
@media (min-width: 860px) { .punch-tile { grid-column: auto; } }
.balances { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.bal { display: grid; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.bal span { font-size: .84rem; color: var(--ink-2); } .bal b { font-size: 1.5rem; line-height: 1.2; } .bal small { color: var(--ink-3); font-size: .76rem; }
.meter { height: 5px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.callout { display: flex; gap: .6rem; align-items: center; color: var(--ink); border-left: 4px solid var(--warn); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } .stats.big { grid-template-columns: repeat(6, 1fr); } }
.stats > div { display: grid; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.card .stats > div { background: var(--surface-2); }
.stats b { font-size: 1.45rem; line-height: 1.2; font-variant-numeric: tabular-nums; } .stats span { font-size: .8rem; color: var(--ink-3); }
.stats.small b { font-size: 1.15rem; }

/* ลงเวลา */
.punch { text-align: center; }
.clock { font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1.1; }
.punch form { display: grid; justify-items: center; gap: 8px; margin: 1rem 0; }
.punches { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; }
.secret { font: 700 1.2rem/1.6 var(--mono); letter-spacing: .08em; background: var(--surface-2); border: 1px dashed var(--line-2); padding: 10px; border-radius: 8px; margin: .5rem 0; text-align: center; user-select: all; word-break: break-all; }
.qr { display: grid; place-items: center; margin: .6rem 0; }
.qr img { width: 232px; height: 232px; image-rendering: pixelated; background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.pw { position: relative; display: block; }
.pw input { width: 100%; padding-right: 46px; }
.pw-toggle { position: absolute; top: 0; right: 0; height: 100%; width: 44px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer; border-radius: 0 8px 8px 0; }
.pw-toggle:hover { color: var(--ink); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.num-hint { display: block; font-size: .78rem; font-weight: 600; color: var(--neg); margin-top: 2px; }
.num-hint[hidden] { display: none; }
input.num-bad { border-color: var(--neg); outline: 2px solid var(--neg-soft); }
/* ---------- ปฏิทินเลือกวัน / เวลา (โครงเดียวกับ badminton.t0r.app สีของแอปนี้) ---------- */
.dpick { position: relative; display: block; }
.row .dpick, .filters .dpick, .inline-form .dpick { display: inline-block; }
.dpick-btn { display: flex; align-items: center; gap: .5rem; width: 100%; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink);
  font: 400 16px var(--font); text-align: left; cursor: pointer; white-space: nowrap; }
@media (min-width: 960px) { .dpick-btn { font-size: .93rem; } }
.row .dpick-btn, .filters .dpick-btn { width: auto; }
.dpick-btn .ic { color: var(--ink-3); width: 18px; height: 18px; }
.dpick-btn:hover { border-color: var(--accent); }
.dpick-btn.on { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.dpick-btn:disabled { opacity: .55; cursor: default; background: var(--surface-2); }
.dpick-empty { color: var(--ink-4); }
.dpick-btn.bad { border-color: var(--neg); outline: 2px solid var(--neg-soft); }
.dpick-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: 19.4rem; max-width: calc(100vw - 24px);
  padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; text-align: left;
  box-shadow: 0 18px 40px rgba(20,30,60,.2); font-weight: 400; }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .7rem; }
.dp-mbtn { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .3rem; border: 0; background: none;
  font: 650 1rem var(--font); color: var(--accent); cursor: pointer; border-radius: 6px; }
.dp-mbtn:hover { background: var(--accent-soft); }
.dp-caret { display: inline-block; width: .45rem; height: .45rem; margin-bottom: .15rem; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s ease; }
.dp-mbtn.open .dp-caret { transform: rotate(-135deg); margin-bottom: -.15rem; }
.dp-nav { display: flex; gap: .2rem; }
.dp-nav-btn { width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0;
  border-radius: 50%; background: none; font: 1.15rem/1 var(--font); color: var(--accent); cursor: pointer; }
.dp-nav-btn:hover { background: var(--accent-soft); }
.dp-nav-btn:disabled { opacity: .3; cursor: default; background: none; }
.dp-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: .15rem; margin-bottom: .25rem; text-align: center;
  font-size: .68rem; font-weight: 700; color: var(--ink-4); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .15rem; justify-items: center; }
.dp-blank { display: block; width: 2.25rem; height: 2.25rem; }
.dp-day { width: 2.25rem; height: 2.25rem; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0;
  border-radius: 50%; background: none; font: 550 .92rem var(--font); color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.dp-day:hover { background: var(--accent-soft); }
.dp-day.we { color: var(--accent); }
.dp-day.now { box-shadow: inset 0 0 0 1.5px #a9bdf0; }
.dp-day.on, .dp-day.on.we { background: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 2px 8px rgba(31,79,209,.35); }
.dp-day.off { color: var(--ink-4); opacity: .45; cursor: default; background: none; box-shadow: none; }
.dp-day:focus-visible, .tp-cell:focus-visible, .dp-month:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dp-months { position: absolute; left: 1rem; right: 1rem; top: 3.1rem; z-index: 5; padding: .6rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 24px rgba(20,30,60,.16); }
.dp-yhead { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding-bottom: .45rem;
  margin-bottom: .5rem; border-bottom: 1px solid var(--line); }
.dp-ysel { min-height: 34px; padding: 0 6px; font-weight: 700; font-size: .95rem; flex: 1; text-align: center; }
.dp-mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; }
.dp-month { padding: .5rem .2rem; border: 0; border-radius: 6px; background: none; font: 600 .84rem var(--font); color: var(--ink-2); cursor: pointer; }
.dp-month:hover { background: var(--accent-soft); }
.dp-month.on { background: var(--accent); color: #fff; }
.dp-month:disabled { opacity: .35; cursor: default; background: none; }
.dp-foot { display: flex; justify-content: space-between; gap: .5rem; margin-top: .7rem; padding-top: .55rem; border-top: 1px solid var(--line); }
.dp-link { border: 0; background: none; padding: .3rem .4rem; font: 600 .84rem var(--font); color: var(--accent); cursor: pointer; border-radius: 6px; }
.dp-link:hover { background: var(--accent-soft); }
.dp-link:disabled { opacity: .4; cursor: default; background: none; }
.dp-foot .dp-link + .dp-link { color: var(--ink-3); }
.dpick-pop.tp { width: 21rem; }
.tp-show { font: 700 1.5rem var(--font); text-align: center; margin-bottom: .6rem; font-variant-numeric: tabular-nums; }
.tp-cols { display: grid; grid-template-columns: 1.35fr 1fr; gap: .8rem; }
.tp-lab { display: block; font-size: .74rem; font-weight: 700; color: var(--ink-4); margin-bottom: .3rem; }
.tp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .2rem; }
.tp-col + .tp-col .tp-grid { grid-template-columns: repeat(3, 1fr); }
.tp-cell { height: 2.1rem; border: 0; border-radius: 8px; background: var(--surface-2); font: 600 .88rem var(--font);
  color: var(--ink-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.tp-cell:hover { background: var(--accent-soft); color: var(--accent); }
.tp-cell.on { background: var(--accent); color: #fff; }
@media (max-width: 560px) { .dp-day, .dp-blank { width: 2.4rem; height: 2.4rem; } .tp-cell { height: 2.5rem; } }
/* timesheet */
.tsweek { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: .6rem; }
.tsday { display: grid; justify-items: center; gap: 1px; padding: 8px 2px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); }
.tsday:hover { text-decoration: none; border-color: var(--accent); }
.tsday b { font-size: .74rem; color: var(--ink-3); } .tsday span { font-size: 1.05rem; font-weight: 700; }
.tsday i { font-style: normal; font-size: .82rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.tsday small { font-size: .66rem; color: var(--ink-4); text-align: center; line-height: 1.2; }
.tsday.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.tsday.now span { color: var(--accent); }
.tsday.future { opacity: .45; }
.tbl td.tsmiss { background: var(--warn-soft); }
.stats6 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 700px) { .stats6 { grid-template-columns: repeat(6, 1fr); } }
.printonly { display: none; }
.pwcell { font-size: 1.05rem; letter-spacing: .04em; user-select: all; }
@media print { .printonly { display: block; } }
@media (max-width: 560px) { .tsday small { display: none; } .tsday { padding: 6px 0; } }
.req-star { color: var(--neg); font-weight: 700; margin-left: 3px; }
label.check .req-star { margin-left: 2px; }
.agebox { display: flex; align-items: center; min-height: 40px; padding: 0 12px; border: 1px dashed var(--line-2); border-radius: 8px;
  background: var(--surface-2); color: var(--ink); font-weight: 600; }
.otp { font: 700 1.3rem var(--mono); letter-spacing: .3em; text-align: center; max-width: 220px; }
.howto { padding-left: 1.2rem; } .howto li { margin-bottom: .6rem; }
/* สวิตช์เปิด/ปิด (หน้าบัญชี: MFA) — .on = เปิด, .locked = บทบาทบังคับ เปลี่ยนไม่ได้ */
.mfa-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: .75rem 0; margin-bottom: .6rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sw { position: relative; flex: none; display: inline-block; width: 46px; height: 26px; padding: 0; border: 0; border-radius: 999px; background: var(--line-2); cursor: pointer; transition: background .2s; }
.sw i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(20,30,60,.3); transition: transform .2s var(--spring, ease); }
.sw.on { background: var(--accent); } .sw.on i { transform: translateX(20px); }
.sw:hover { filter: brightness(.95); text-decoration: none; }
.sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw.locked { opacity: .55; cursor: not-allowed; }
.sw.locked:hover { filter: none; }
#mfa-off .otp { width: 100%; max-width: none; box-sizing: border-box; }
.consent { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: .7rem 0; border-bottom: 1px solid var(--line); }

/* กราฟเล็ก ๆ ทำด้วย CSS */
.barrow { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; margin-bottom: 6px; font-size: .86rem; }
.barrow .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; }
.barcell { width: 26%; }
.cols-chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; border-bottom: 1px solid var(--line); }
.cols-chart .col { flex: 1; display: grid; justify-items: center; gap: 4px; font-size: .7rem; color: var(--ink-3); }
.cols-chart .pair { display: flex; align-items: flex-end; gap: 2px; height: 122px; }
.cols-chart i { display: block; width: 8px; min-height: 2px; border-radius: 3px 3px 0 0; }
.in { background: var(--accent); } .out { background: #e3897f; }
.legend { font-size: .8rem; color: var(--ink-3); margin-top: .5rem; } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }

/* ปฏิทินลา */
.cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 4px; }
.cal .day { min-height: 56px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font-size: .74rem; display: grid; align-content: start; gap: 1px; }
.cal .day b { font-size: .8rem; color: var(--ink-3); }
.cal .wkend { background: var(--surface-2); }
.cal .has { border-color: #b9c9f5; }
.cal .day span { background: var(--accent-soft); color: var(--accent-2); border-radius: 3px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.holidays { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 2px; }
.holidays li { display: flex; gap: 12px; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.holidays li span { color: var(--ink-3); min-width: 9rem; font-size: .88rem; }
.holidays form { margin-left: auto; }

/* พนักงาน */
.profile-head { display: flex; gap: 16px; align-items: center; }
.profile-head h1 { margin: 0; font-size: 1.3rem; } .profile-head p { margin: .2rem 0 0; }
.avatar { flex: none; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 1.6rem; font-weight: 700; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-box { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.photo-box .avatar { width: 96px; height: 96px; font-size: 2.4rem; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--line); }
.photo-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.photo-actions form { margin: 0; }
.photo-pick { cursor: pointer; position: relative; }
.photo-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-box.busy .avatar { opacity: .5; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mb { margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: -4px 0 12px; position: sticky; top: 52px; background: var(--bg); padding: 6px 0; z-index: 10; }
@media (min-width: 960px) { .tabs { top: 60px; } }
.tabs a { padding: .35rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: .86rem; white-space: nowrap; }
.docs { list-style: none; padding: 0; margin: 0 0 1rem; } .docs li { padding: .3rem 0; } .docs a { display: inline-flex; gap: .4rem; align-items: center; }
.flow { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 16px; }
.flow li { padding: .35rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .84rem; color: var(--ink-3); }
.flow li.done { background: var(--pos-soft); border-color: #c4e6d2; color: var(--pos); font-weight: 600; }
.downloads { margin-bottom: 12px; }
.warnings { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--warn); }
.itemrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.itemrow input[name=name] { flex: 1 1 180px; }
pre.json { font: .78rem/1.4 var(--mono); background: var(--surface-2); padding: 8px; border-radius: 6px; max-height: 300px; overflow: auto; white-space: pre-wrap; }
.prose h2 { margin-top: 1.2rem; } .prose ul { padding-left: 1.2rem; }

/* เข้าสู่ระบบ */
/* ---------------- หน้าเข้าสู่ระบบ: กล่องสองคอลัมน์แบบ money.t0r.app (ภาพสไลด์ซ้าย ฟอร์มขวา) ----------------
   จอแคบกว่า 62rem ตัดภาพทิ้งทั้งแถบ ตราระบบ (.authmark) โผล่เหนือหัวข้อแทน
   ฉากบังไล่สีใต้ภาพใช้น้ำเงินเข้มของเมนูข้าง (#0b1f4d) ให้ชื่อระบบสีขาวอ่านออกทุกภาพ */
.auth { display: grid; grid-template-columns: 1fr; max-width: 58rem; margin: clamp(.5rem, 4vh, 3rem) auto 0;
  background: var(--surface); border: 1px solid rgba(255,255,255,.5); border-radius: 18px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(6,40,44,.28), 0 2px 6px rgba(6,40,44,.12); }
.authform { display: flex; align-items: center; justify-content: center; padding: 1.6rem 1.25rem 1.8rem; }
.authbox { width: 100%; max-width: 22rem; }
.auth h1 { margin: 0 0 .2rem; font-size: 1.5rem; }
.auth .hint { margin: 0 0 1.2rem; color: var(--ink-3); }
.authfields { display: grid; gap: 14px; }
.authfields .fld { display: grid; gap: 4px; }
.authfields .otp { width: 100%; max-width: none; box-sizing: border-box; }
.authfields .otp::placeholder { color: var(--line-2); }
/* ช่องละหลัก (app.js สร้างจาก input[data-otp]) แบ่งสามคู่สามด้วยช่องไฟกลาง เหมือนที่แอป authenticator แสดงรหัส */
.otp-boxes { display: grid; grid-template-columns: repeat(3, 1fr) .3rem repeat(3, 1fr); gap: .4rem; }
.otp-boxes .otp-box:nth-child(4) { grid-column: 5; }
.otp-box { width: 100%; min-width: 0; box-sizing: border-box; height: 3.2rem; padding: 0; text-align: center;
  font: 600 1.5rem/1 var(--font); font-variant-numeric: tabular-nums; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 10px; }
.otp-box:hover { border-color: var(--ink-4); }
.otp-box:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.otp-box:not(:placeholder-shown) { border-color: var(--ink-4); background: var(--surface-2); }
.otp-tick { margin: -.35rem 0 0; font-variant-numeric: tabular-nums; }
.otp-tick[hidden] { display: none; }
.otp-tick.soon { color: var(--neg); }
.authnote a { display: inline-block; white-space: nowrap; }
.authnote { margin: 1.1rem 0 0; padding-top: .9rem; border-top: 1px solid var(--line); line-height: 1.65; }
.authmark { display: flex; align-items: center; gap: .55rem; margin: 0 0 1.15rem; color: var(--ink); font-weight: 700; }
.reveal { position: relative; }
.reveal input { width: 100%; padding-right: 2.7rem; }
.peek { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); cursor: pointer; }
.peek:hover { background: var(--surface-2); color: var(--ink); }
.peek:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.peek[hidden] { display: none; }
.peek > span { display: grid; }
.peek .ic-off, .peek[aria-pressed="true"] .ic-on { display: none; }
.peek[aria-pressed="true"] .ic-off { display: grid; }
/* เว็บทดสอบ (HR_TEST_SITE=1): ป้ายมุมจอทุกหน้า + ตารางบัญชีทดสอบในหน้า login — ไม่กินที่ในเลย์เอาต์ */
.testsite { position: fixed; z-index: 90; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; background: #b26a00; color: #fff; font-size: .78rem; font-weight: 600; pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.testsite .ic { width: 14px; height: 14px; }
.testsite .ts-short { display: none; }
@media (max-width: 860px) { body:not(.bare) .testsite { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .testsite { right: 8px; padding: 3px 9px; font-size: .72rem; opacity: .92; } .testsite .ts-long { display: none; } .testsite .ts-short { display: inline; } }
@media print { .testsite { display: none; } }
/* การ์ด "ทดลองใช้ระบบ" บนหน้า login จริง (ผู้ดูแลระบบเปิดที่ /admin/test-site) */
.trysite { display: flex; align-items: center; gap: 10px; margin-top: 1rem; padding: .7rem .8rem; border: 1px solid #f0d9a6; border-radius: 12px;
  background: #fff8e8; color: var(--ink); }
.trysite:hover { border-color: #b26a00; text-decoration: none; }
.trysite:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.trysite-ic { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: #b26a00; color: #fff; }
.trysite-ic .ic { width: 18px; height: 18px; }
.trysite > span:nth-child(2) { flex: 1; min-width: 0; display: grid; }
.trysite small { color: var(--ink-3); font-size: .8rem; line-height: 1.45; }
.trysite > .ic { color: #b26a00; flex: none; }
.ts-closed { max-width: 30rem; }
.page.solo:has(.ts-closed) .solo-tools { max-width: 30rem !important; margin-inline: auto; }
.ts-admin .mfa-row { border-top: 0; padding-top: 0; }
@media screen and (min-width: 62rem) { .auth.ts-closed { grid-template-columns: 1fr; min-height: 0; } }
.testacc { margin-top: 1.1rem; padding: .8rem .85rem; border: 1px dashed #e0b24d; border-radius: 12px; background: #fff8e8; }
.testacc-h { margin: 0 0 .55rem; line-height: 1.5; }
.testacc-h code { white-space: nowrap; padding: 1px 6px; border-radius: 6px; background: #fff; border: 1px solid #f0d9a6; font-size: .85rem; }
.testacc ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.testacc-btn { width: 100%; display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: baseline; text-align: left;
  padding: 6px 9px; border: 1px solid #f0d9a6; border-radius: 9px; background: #fff; color: var(--ink); font: inherit; cursor: pointer; }
.testacc-btn:hover { border-color: #b26a00; }
.testacc-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.testacc-btn b { font-family: var(--mono); font-size: .85rem; }
.testacc-btn span { font-size: .8rem; color: #8a5a00; font-weight: 600; }
.testacc-btn small { grid-column: 1 / -1; color: var(--ink-3); font-size: .74rem; line-height: 1.4; }
@media (max-width: 480px) { .testacc ul { grid-template-columns: 1fr; } }
.authart { display: none; position: relative; overflow: hidden; background: #0b1f4d; }
.slides { position: absolute; inset: 0; }
/* ภาพซ้อนกันหมด ใบที่โชว์มีคลาส on ใบที่กำลังออกมีคลาส out — transition ผูกแค่สองคลาสนี้
   ตอนถอด out ภาพจะเด้งกลับไปตั้งต้นทางขวาทันที ไม่ไหลสวนภาพใหม่ */
.slides img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: translateX(2.5rem); }
.slides img.on { opacity: 1; transform: none; transition: opacity .8s ease, transform .8s ease; }
.slides img.out { opacity: 0; transform: translateX(-2.5rem); transition: opacity .8s ease, transform .8s ease; }
.authart::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, rgba(11,31,77,.92), rgba(11,31,77,.5) 45%, rgba(11,31,77,.12)); }
.authbrand { position: absolute; z-index: 2; left: 2rem; right: 2rem; bottom: 3.6rem; }
.authbrand .who { display: flex; align-items: center; gap: .6rem; margin: 0; color: #fff; font-size: 1.15rem; font-weight: 700; }
.authbrand .tag { margin: .55rem 0 0; color: rgba(255,255,255,.86); font-size: .9rem; line-height: 1.6; }
.dots { position: absolute; z-index: 2; left: 2rem; bottom: 1.8rem; display: flex; align-items: center; gap: .4rem; }
.dots[hidden] { display: none; }
.dots button { width: .5rem; height: .5rem; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.45); cursor: pointer;
  transition: background .3s ease, width .3s ease; }
.dots button:hover { background: #fff; }
.dots button.on { width: 1.4rem; border-radius: 20px; background: #fff; }
@media screen and (min-width: 62rem) {
  .page.solo:has(.auth) { min-height: 100vh; box-sizing: border-box; display: grid; align-content: center; padding-block: 1.5rem; }
  .page.solo:has(.auth) .solo-tools { width: 100%; max-width: 58rem; margin-inline: auto; }
  .auth { width: 100%; grid-template-columns: 1fr 1fr; min-height: min(38rem, calc(100vh - 8rem)); margin-block: 0; }
  .authart { display: block; }
  .authmark { display: none; }
  .authform { padding: 2.2rem 3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .slides img, .slides img.on, .slides img.out { transform: none; }
  .slides img.on, .slides img.out { transition: opacity .35s linear; }
  .dots button { transition: none; }
}

/* ---------- เอกสารพิมพ์ ---------- */
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 28px; max-width: 820px; margin: 0 auto 16px; }
.wide-sheet { max-width: 1060px; }
.sheet-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 14px; }
.sheet-head h1 { font-size: 1.15rem; margin: 0; } .sheet-head h2 { margin: 0; }
.sheet .tbl th, .sheet .tbl td { padding: .35rem .5rem; }
.slip-who { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 4px 14px; margin: 0 0 14px; font-size: .9rem; }
.slip-who dt { color: var(--ink-3); } .slip-who dd { margin: 0; }
.slip-cols { display: grid; gap: 14px; }
@media (min-width: 700px) { .slip-cols { grid-template-columns: 1fr 1fr; } }
.slip-net { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 14px 0; padding: 12px 14px; background: var(--accent-soft); border-radius: 8px; }
.slip-net b { font-size: 1.4rem; } .slip-net small { color: var(--ink-3); }
.ytd { margin-bottom: 12px; }
.box { border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; }
.tawi header { margin-bottom: 14px; } .tawi h1 { margin: 0; font-size: 1.2rem; }
.sign { margin-top: 24px; text-align: right; } .sigline { margin-top: 36px; }

body.bare { background: #fff; }
body.bare .page { max-width: none; padding: 16px; }
body.bare .sheet { border: 0; padding: 0; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 11.5pt; }
  .noprint, .rail, .scrim, .topbar, .msg { display: none !important; }
  .page { padding: 0 !important; max-width: none; }
  .sheet { border: 0; padding: 0; margin: 0; max-width: none; }
  .slip-cols { grid-template-columns: 1fr 1fr; }
  .tbl thead th, .tbl tfoot th, .slip-net { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; }
}

@media (max-width: 560px) {
  h1 { font-size: 1.28rem; }
  .card { padding: 14px 12px; }
  .slip-who { grid-template-columns: auto 1fr; }
  .sheet { padding: 14px; }
  .kv { grid-template-columns: 1fr; gap: 0 0; } .kv dd { margin-bottom: .5rem; }
  .req { flex-direction: column; }
  .profile-head { align-items: flex-start; }
  .avatar { width: 48px; height: 48px; font-size: 1.3rem; }
  .barrow { grid-template-columns: 38% 1fr auto; }
  .approve input { flex-basis: 100%; }
  .approve .btn { flex: 1; }
}
.proj-add { align-items: flex-end; } .proj-add .grow { flex: 1 1 260px; display: grid; gap: 4px; }
.dur-pick { display: grid; gap: 4px; font-size: .86rem; color: var(--ink-2); font-weight: 600; align-content: start; } .dur-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .dur-row select { width: 100%; font-weight: 400; }
.ts-form { margin-top: 12px; } .ts-list .ts-detail { white-space: pre-line; min-width: 220px; max-width: 480px; color: var(--ink-2); } .ts-form textarea { width: 100%; font: inherit; font-weight: 400; }
@media (max-width: 639px) {
  .ts-list thead { display: none; }
  .ts-list, .ts-list tbody, .ts-list tr, .ts-list td { display: block; width: 100%; }
  .ts-list tr { border-bottom: 1px solid var(--line, #e5e7eb); padding: 8px 0; }
  .ts-list td, .tbl.ts-list td.num, .tbl.ts-list td.nowrap { border: 0; padding: 3px 0; text-align: left; display: grid; grid-template-columns: 100px 1fr; gap: 8px; max-width: none; min-width: 0; }
  .ts-list td::before { content: attr(data-label); color: var(--ink-3); font-size: .8rem; font-weight: 600; }
  .tbl.ts-list td.ts-act { display: block; text-align: right; }
  .ts-list td.ts-act::before { content: none; }
}
.ts-editing { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--ink-1, inherit); font-size: .9rem; }
.ts-form.editing { padding: 10px; border: 1px dashed var(--warn); border-radius: 10px; }
.ts-row-editing td { background: var(--warn-soft); }
.ts-btns { justify-content: flex-end; flex-wrap: nowrap; gap: 6px; }
.who .avatar { overflow: visible; } .who .avatar img { border-radius: 50%; }
.add-new > summary { font-weight: 600; color: var(--accent); }

/* Timesheet: ตารางสรุปทั้งสัปดาห์ Task × จ.–อา. */
.ts-matrix { min-width: 640px; }
.ts-matrix th.num, .ts-matrix td.num { text-align: center; white-space: nowrap; width: 9%; font-variant-numeric: tabular-nums; }
.ts-matrix thead th a { color: inherit; text-decoration: none; display: block; }
.ts-matrix thead th span { display: block; font-weight: 400; font-size: .78rem; color: var(--ink-3); }
.ts-matrix thead th.now span { color: var(--accent); font-weight: 700; }
.ts-matrix .on { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.ts-matrix .ts-task { text-align: left; min-width: 160px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.ts-matrix .tot { font-weight: 700; }
.ts-matrix tfoot th, .ts-matrix tfoot td { border-top: 2px solid var(--line); font-weight: 700; }
#detail .scroll + h3 { margin-top: 1.4rem; }
.ts-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--pos-soft); }
.ts-submit.has-draft { background: var(--warn-soft); }
.ts-submit p { margin: 0; flex: 1 1 260px; }
.ts-who { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 4px 0 14px; }
.ts-who dt { font-size: .78rem; color: var(--ink-3); font-weight: 600; }
.ts-who dd { margin: 0; font-weight: 600; }
.ts-req { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--warn-soft); }
.ts-req-approved { background: var(--pos-soft); } .ts-req-rejected { background: var(--neg-soft); }
.ts-req > p { margin: 0 0 6px; } .ts-req .steps { margin: 6px 0; } .ts-req form.approve { margin-top: 8px; }
.ts-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ts-top-submit { display: inline; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; margin-bottom: 12px; border-radius: var(--radius); background: var(--accent-soft); }
.bulk-bar input[name=comment] { flex: 1 1 180px; min-width: 0; }
th.chk, td.chk { width: 32px; text-align: center; }
.bulk-chk { width: 18px; height: 18px; vertical-align: -3px; }

/* popup (<dialog class="modal">) */
dialog.modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 16px;
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(15, 23, 42, .28); overflow: auto; }
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }
dialog.modal[open] { animation: modal-in .18s var(--ease-out, ease-out); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal form { margin: 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 16px 0 20px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-sub { margin: 2px 20px 0; }
.modal-body { display: grid; gap: 14px; padding: 16px 20px; }
.modal-body label, .modal-body .dur-pick { display: grid; gap: 6px; font-weight: 600; }
.modal-body textarea { width: 100%; font: inherit; font-weight: 400; }
.modal-foot { padding: 12px 20px 18px; border-top: 1px solid var(--line); }
html.modal-open { overflow: hidden; }
@media (max-width: 600px) {
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .modal-foot .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { dialog.modal[open] { animation: none; } }

/* ช่องอัปโหลดไฟล์ (พอร์ตจาก shadcn Field + Input type=file) */
:root { --destructive-foreground: #b91c1c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --destructive-foreground: #f87171; } }
:root[data-theme="dark"] { --destructive-foreground: #f87171; }
.ffield { display: grid; gap: 6px; min-width: 0; }
.ffield-label { display: flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.ffield-label .ic { width: 16px; height: 16px; opacity: .6; flex: none; }
.ffield-label .req-star { margin-left: -2px; }
input[type=file].ffield-input { display: flex; width: 100%; height: 40px; padding: 0 12px 0 4px; border: 1px solid var(--line-2, var(--line)); border-radius: 8px;
  background: var(--surface); color: var(--ink-2); font: inherit; font-size: .875rem; line-height: 38px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s; }
input[type=file].ffield-input::file-selector-button { height: 30px; margin: 4px 10px 4px 0; padding: 0 12px; border: 0; border-radius: 6px;
  background: var(--surface-2, var(--bg)); color: var(--ink); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; transition: background .15s; }
input[type=file].ffield-input:hover::file-selector-button { background: var(--accent-soft); color: var(--accent); }
input[type=file].ffield-input:hover { border-color: var(--ink-4, var(--line-2)); }
input[type=file].ffield-input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=file].ffield-input[aria-invalid=true] { border-color: var(--destructive-foreground); box-shadow: 0 0 0 3px var(--neg-soft); }
.ffield-desc { margin: 0; font-size: .8rem; color: var(--ink-3); }
.ffield-desc b { color: var(--ink-2); font-weight: 600; }
.ffield-err { margin: 0; font-size: .8rem; font-weight: 600; color: var(--destructive-foreground); }
.import-form { display: grid; gap: 10px; max-width: 560px; }
.ts-weekhead { flex-wrap: wrap; gap: 8px; }
.ts-weekhead .row { flex-wrap: wrap; gap: 6px; }
.btn[aria-disabled=true] { opacity: .4; pointer-events: none; }
.ts-matrix tfoot tr.ts-worked th, .ts-matrix tfoot tr.ts-worked td { border-top: 1px solid var(--line); font-weight: 400; color: var(--ink-3); }
.ts-fixed-date { display: grid; gap: 6px; } .ts-fixed-date .lbl { font-weight: 600; }
.ts-reason { margin-top: 3px; font-weight: 600; white-space: normal; max-width: 260px; }
.badge.neg.solid { background: var(--destructive-foreground, #b91c1c); color: #fff; }
.ts-lock { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2, var(--bg)); font-weight: 600; font-size: .9rem; }
.ts-lock .ic { width: 16px; height: 16px; flex: none; }
.ts-lock-pending { background: var(--warn-soft); } .ts-lock-approved { background: var(--pos-soft); } .ts-lock-declined { background: var(--neg-soft); }
.ts-decide { display: flex; flex-wrap: wrap; gap: 8px; } .ts-decide input[name=comment] { flex: 1 1 220px; min-width: 0; }
.ts-decide-hint { margin: 8px 0 4px; }
.ts-req-declined { background: var(--neg-soft); }

/* ลงเวลาด้วย CCTV */
.cctv-token { border-color: var(--warn); }
.cctv-copy { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cctv-copy code { background: var(--surface-2); padding: 6px 10px; border-radius: 6px; word-break: break-all; font-size: .85rem; }
.cctv-score { gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
.cctv-score input { width: 4.5em; padding: 2px 6px; }
.cctv-howto li { margin-bottom: .4rem; }
@media (max-width: 640px) { .ts-list .cctv-score { justify-content: flex-start; } }

/* ลงทะเบียนใบหน้า */
.face-cam { position: relative; background: #111; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3; max-width: 480px; display: grid; place-items: center; }
.face-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.face-enroll.live .face-start { display: none; }
.face-start { position: relative; z-index: 1; }
.face-status { min-height: 1.5em; margin: .6rem 0; font-weight: 600; }
.face-thumbs { display: flex; gap: 8px; margin-bottom: .6rem; min-height: 4px; }
.face-thumbs img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; transform: scaleX(-1); border: 2px solid var(--pos); }
.face-link { margin-top: .6rem; }
.cctv-kind { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cctv-kind legend { font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.cctv-kind .check { align-items: flex-start; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; padding: 10px; font-weight: 400; }

/* คีออสก์ (เต็มจอ ไม่มีเมนู) */
body.bare:has(.kiosk) { background: #0b1020; }
.kiosk { min-height: 100dvh; display: flex; flex-direction: column; color: #e8ecf8; padding: 16px; gap: 12px; box-sizing: border-box; }
.kiosk-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.kiosk-top b { font-size: 1.2rem; }
.kiosk-top .small { color: #9aa6c6; }
.kiosk-clock { font: 600 2rem/1 var(--mono, monospace); font-variant-numeric: tabular-nums; }
.kiosk-stage { position: relative; flex: 1; min-height: 50vh; background: #000; border-radius: 16px; overflow: hidden; }
.kiosk-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.kiosk-frame { position: absolute; left: 50%; top: 50%; width: min(46vh, 60%); aspect-ratio: 3/4; transform: translate(-50%, -50%); border: 3px dashed rgba(255,255,255,.45); border-radius: 50% / 42%; pointer-events: none; }
.kiosk:not(.live) .kiosk-frame { display: none; }
.kiosk-result { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); min-width: min(90%, 420px); text-align: center; padding: 18px 24px; border-radius: 16px; background: #0f7b4b; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.kiosk-result[data-kind="warn"] { background: #a36a00; } .kiosk-result[data-kind="bad"] { background: #b42318; }
.kiosk-result b { display: block; font-size: 1.7rem; } .kiosk-result span { font-size: 1.1rem; }
.kiosk-status { text-align: center; font-size: 1.25rem; font-weight: 600; margin: 0; min-height: 1.6em; }
.kiosk-status[data-kind="bad"] { color: #ff8a80; }
.kiosk-setup { display: none; }
.kiosk.setup .kiosk-setup { display: block; text-align: center; font-size: 1.2rem; background: #1b2442; padding: 24px; border-radius: 12px; }
.kiosk.setup .kiosk-stage, .kiosk.setup .kiosk-status { display: none; }
.kiosk-foot { display: flex; gap: 12px; align-items: center; justify-content: space-between; color: #8792b0; flex-wrap: wrap; }
.kiosk-foot .btn { color: #c8d0e8; border-color: #3a4566; background: transparent; }
@media (max-width: 640px) { .kiosk { padding: 10px; } .kiosk-clock { font-size: 1.4rem; } .kiosk-result b { font-size: 1.3rem; } }
.face-cam { outline: 4px solid transparent; outline-offset: -4px; transition: outline-color .2s; }
.face-enroll.live .face-cam[data-ready="0"] { outline-color: #e5a50a; }
.face-enroll.live .face-cam[data-ready="1"] { outline-color: var(--pos); }
.face-consent { align-items: flex-start; background: var(--warn-soft); border: 1px solid #f1dca8; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; max-width: 640px; }
.face-consent.attn { border-color: var(--neg); box-shadow: 0 0 0 3px var(--neg-soft); }
.face-enroll.done [data-save] { animation: face-pulse 1.4s ease-in-out 3; }
@keyframes face-pulse { 50% { box-shadow: 0 0 0 6px rgba(31,79,209,.25); } }
/* คีออสก์โหมดเดินผ่าน: กรอบชื่อบนวิดีโอ + รายการลงเวลาด้านข้าง */
.kiosk-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.kiosk[data-mode="walk"] .kiosk-frame { display: none; }
.kiosk-feed { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; width: min(340px, 70%); pointer-events: none; }
.kiosk-toast { background: #0f7b4b; color: #fff; border-radius: 12px; padding: 10px 14px; box-shadow: 0 6px 18px rgba(0,0,0,.35); transition: opacity .5s, transform .5s; }
.kiosk-toast[data-kind="warn"] { background: #a36a00; } .kiosk-toast[data-kind="bad"] { background: #b42318; }
.kiosk-toast b { display: block; font-size: 1.15rem; } .kiosk-toast span { font-size: .92rem; }
.kiosk-toast.out { opacity: 0; transform: translateX(20px); }
.cctv-mode { margin-top: 4px; } .cctv-mode select { font-size: .82rem; padding: 2px 6px; }
/* ทดสอบกล้อง */
.cam-test-ctl { gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.cam-test-ctl label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; }
.cam-test-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 16px; }
.cam-test-stage { min-height: 0; aspect-ratio: 16/9; flex: none; }
.cam-test-stats dd.pos { color: var(--pos); } .cam-test-stats dd.warn { color: var(--warn); } .cam-test-stats dd.neg { color: var(--neg); }
.cam-test-faces { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.cam-test-faces li { border-left: 4px solid var(--line, #ddd); padding: 4px 8px; background: var(--surface-2); border-radius: 4px; }
.cam-test-faces li[data-kind="ok"] { border-color: var(--pos); } .cam-test-faces li[data-kind="warn"] { border-color: var(--warn); } .cam-test-faces li[data-kind="bad"] { border-color: var(--neg); }
.warn { color: var(--warn); }
@media (max-width: 800px) { .cam-test-grid { grid-template-columns: 1fr; } }

/* ---------------- Timesheet แบบแท็บ (Dashboard / Overview / Attendance) ---------------- */
.tsx-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 18px; }
.tsx-head h1 { font-size: 1.9rem; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.tsx-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tsx-week { display: flex; align-items: center; gap: 2px; padding: 4px; min-height: 48px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.tsx-nav { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--ink-2); }
.tsx-nav:hover { background: var(--surface-2); }
.tsx-nav[aria-disabled="true"] { opacity: .3; pointer-events: none; }
.tsx-nav .ic { width: 20px; height: 20px; }
.tsx-range { margin: 0; }
.tsx-jump { display: block; margin: 0; }
.tsx-range .dpick-btn { border: 0; min-height: 36px; font-weight: 700; background: transparent; padding: 0 10px; }
.tsx-range .dpick-btn .ic { color: var(--accent); }
.tsx-range .dpick-btn:hover { background: var(--surface-2); }
.tsx-add { min-height: 48px; padding: 0 22px; border: 2px solid var(--accent); color: var(--accent); background: var(--surface); font-weight: 800; border-radius: 10px; }
.tsx-add:hover { background: var(--accent-soft); }
.tsx-back { margin: -6px 0 12px; font-size: .9rem; }
.tsx-note { margin: 0 0 12px; }

.tsx-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 18px; margin-bottom: 16px; border-radius: 12px; border: 1px solid; }
.tsx-banner-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; flex: none; }
.tsx-banner-ic .ic { width: 22px; height: 22px; stroke-width: 2; }
.tsx-banner-body { flex: 1 1 260px; min-width: 0; }
.tsx-banner-body b { font-size: 1.05rem; } .tsx-banner-body p { margin: 2px 0 0; }
.tsx-banner-body .steps { margin: 8px 0 0; }
.tsx-banner-pending { background: var(--warn-soft); border-color: #f1d9a0; color: var(--warn); } .tsx-banner-pending .tsx-banner-ic { background: #d9860b; }
.tsx-banner-approved { background: var(--pos-soft); border-color: #c4e6d2; color: var(--pos); } .tsx-banner-approved .tsx-banner-ic { background: var(--pos); }
.tsx-banner-rejected, .tsx-banner-declined { background: var(--neg-soft); border-color: #f3cdc8; color: var(--neg); } .tsx-banner-rejected .tsx-banner-ic, .tsx-banner-declined .tsx-banner-ic { background: var(--neg); }
.tsx-banner-draft { background: var(--accent-soft); border-color: #cdd9f6; color: var(--accent-2); } .tsx-banner-draft .tsx-banner-ic { background: var(--accent); }
.tsx-banner .steps, .tsx-banner .steps * { color: var(--ink-2); }

.tsx-card { padding: 0; overflow: hidden; }
.tsx-grid { width: 100%; min-width: 820px; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.tsx-grid th, .tsx-grid td { border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; padding: 10px 6px; }
.tsx-grid thead th { background: var(--surface-2); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 14px 6px; }
.tsx-grid td + td, .tsx-grid th + td, .tsx-grid th + th { border-left: 1px solid var(--line); }
.tsx-grid .tsx-task { text-align: left; width: 34%; min-width: 240px; padding: 12px 18px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tsx-grid thead .tsx-task { background: var(--surface-2); z-index: 2; }
.tsx-day span { display: block; font-weight: 700; }
.tsx-day b { display: inline-grid; place-items: center; margin-top: 6px; min-width: 44px; height: 32px; padding: 0 6px; border-radius: 999px; background: var(--surface); color: var(--ink); font-size: .86rem; letter-spacing: 0; box-shadow: var(--shadow); }
.tsx-day.now b { background: var(--accent); color: #fff; }
.tsx-grid .we { background: color-mix(in srgb, var(--ink-3) 6%, var(--surface)); }
.tsx-grid thead .we { background: color-mix(in srgb, var(--ink-3) 11%, var(--surface-2)); }
.tsx-sum { width: 8%; font-weight: 700; }
.tsx-total th.tsx-task { font-size: 1.05rem; font-weight: 800; }
.tsx-pill { display: inline-block; min-width: 50px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; color: var(--ink-3); font-size: .86rem; }
.tsx-pill.on { color: var(--ink); border-color: var(--ink-3); }
.tsx-dash { color: var(--line-2); }
.tsx-mark { background: #fffbeb; } .tsx-mark th.tsx-task { background: #fffbeb; font-weight: 700; }
.tsx-mark-holiday th .ic { color: #d9860b; } .tsx-mark-leave th .ic { color: var(--accent); }
.tsx-mark .ic { width: 16px; height: 16px; vertical-align: -3px; }
.tsx-tag { font-weight: 700; font-size: .82rem; color: #b26a00; }
.tsx-mark-leave .tsx-tag { color: var(--accent); }
.tsx-row .tsx-title { display: block; font-weight: 800; color: var(--ink); text-decoration: none; font-size: .98rem; }
.tsx-row a.tsx-title:hover { color: var(--accent); text-decoration: underline; }
.tsx-sub { display: block; margin-top: 2px; color: var(--ink-3); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 380px; }
.tsx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.tsx-meta form { display: inline; margin: 0; }
.tsx-act { border: 0; background: none; padding: 0; font: inherit; font-size: .8rem; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: none; }
.tsx-act:hover { text-decoration: underline; }
.tsx-meta form .tsx-act { color: var(--neg); }
.tsx-h { font-size: 1.02rem; font-weight: 800; }
.tsx-row.st-draft .tsx-h { color: var(--ink-2); }
.tsx-row.st-submitted .tsx-h { color: #d9670b; }
.tsx-row.st-approved .tsx-h { color: var(--pos); }
.tsx-row.st-rejected .tsx-h, .tsx-row.st-declined .tsx-h { color: var(--neg); }
.tsx-row.editing th, .tsx-row.editing td { background: var(--warn-soft); }
.tsx-worked th, .tsx-worked td { color: var(--ink-3); font-weight: 400; font-size: .88rem; border-bottom: 0; }
.tsx-empty { padding: 48px 16px; font-style: italic; }
.tsx-foot { padding: 10px 18px 14px; margin: 0; border-top: 1px solid var(--line); }
.tsx-key { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; }
.tsx-key::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); }
.tsx-key.st-submitted::before { background: #d9670b; } .tsx-key.st-approved::before { background: var(--pos); } .tsx-key.st-rejected::before { background: var(--neg); }

.tsx-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; align-items: end; margin: 18px; padding: 16px; border-radius: 12px; background: var(--surface-2); }
.tsx-filter label { display: grid; gap: 6px; margin: 0; font-size: .8rem; font-weight: 700; color: var(--ink-3); }
.tsx-filter label input, .tsx-filter label select { text-transform: none; letter-spacing: 0; font-weight: 400; }
.tsx-filter .tsx-q { grid-column: span 2; }
.tsx-filter-btns { display: flex; gap: 8px; }
.tsx-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 18px 10px; }
.tsx-ov { margin: 0; } .tsx-ov td:first-child a { font-weight: 700; }
.tsx-card > .scroll > .tbl, .tsx-daily .tbl { margin: 0; }
.tsx-card > .empty { padding: 32px 16px; }

.tsx-att-head { display: flex; align-items: center; gap: 12px; padding: 20px 20px 4px; }
.tsx-att-head > .ic { width: 34px; height: 34px; color: var(--accent); flex: none; }
.tsx-att-head > div { flex: 1; } .tsx-att-head h2 { margin: 0; font-size: 1.4rem; font-weight: 800; } .tsx-att-head p { margin: 2px 0 0; }
.tsx-today { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; padding: 16px 20px; }
.tsx-stat { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; }
.tsx-stat > div { min-width: 0; } .tsx-stat span:not(.tsx-stat-ic):not(.badge) { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-3); }
.tsx-stat b { display: block; font-size: 1.25rem; margin-top: 2px; }
.tsx-stat-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; flex: none; }
.tsx-stat-ic .ic { width: 22px; height: 22px; }
.tsx-stat.tsx-s-in .tsx-stat-ic { background: var(--pos-soft); color: var(--pos); }
.tsx-stat.tsx-s-out .tsx-stat-ic { background: var(--accent-soft); color: var(--accent); }
.tsx-stat.tsx-s-work .tsx-stat-ic { background: var(--warn-soft); color: var(--warn); }
.tsx-stat.tsx-s-st .tsx-stat-ic { background: var(--surface-2); color: var(--ink-3); }
.tsx-att-body { display: grid; grid-template-columns: 220px 1fr; gap: 18px; padding: 4px 20px 20px; }
@media (max-width: 760px) { .tsx-att-body { grid-template-columns: 1fr; } .tsx-filter .tsx-q { grid-column: auto; } }
.tsx-month h3, .tsx-daily h3 { margin: 6px 0 10px; font-size: .9rem; font-weight: 700; color: var(--ink-2); }
.tsx-month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.tsx-count { display: flex; align-items: center; gap: 8px; padding: 12px 14px; margin-bottom: 8px; border-radius: 10px; border: 1px solid var(--line); font-weight: 700; font-size: .9rem; }
.tsx-count .ic { width: 16px; height: 16px; } .tsx-count span { flex: 1; } .tsx-count b { font-size: 1.15rem; }
.tsx-count.pos { background: var(--pos-soft); color: var(--pos); border-color: #c4e6d2; }
.tsx-count.warn { background: var(--warn-soft); color: var(--warn); border-color: #f1d9a0; }
.tsx-count.neg { background: var(--neg-soft); color: var(--neg); border-color: #f3cdc8; }
.tsx-daily { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px 10px; }
@media (max-width: 640px) {
  .tsx-head { align-items: stretch; } .tsx-head > div:first-child { width: 100%; }
  .tsx-tools { width: 100%; } .tsx-week { flex: 1; justify-content: space-between; } .tsx-add { flex: none; padding: 0 16px; }
  .tsx-grid .tsx-task { min-width: 180px; width: 180px; padding: 10px 12px; } .tsx-sub { max-width: 160px; }
}

/* ---------------- แถบบน: ชื่อผู้ใช้ + ออกจากระบบ (ทุกขนาดจอ) ---------------- */
.hello { display: none; min-width: 0; line-height: 1.2; }
.hello span { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .04em; color: var(--ink-3); }
.hello b { display: block; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .who { display: flex; align-items: center; gap: 8px; flex: none; padding: 3px 3px 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); }
.topbar .who:hover { background: var(--surface-2); text-decoration: none; }
.topbar .who .role { font-size: .74rem; font-weight: 700; color: var(--ink-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .who .avatar { width: 32px; height: 32px; }
.topbar .logout { margin: 0; }
.topbar .logout .btn { display: inline-flex; align-items: center; gap: 6px; }
.topbar .logout .ic { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .topbar .who { padding: 2px; border: 0; } .topbar .who .role, .topbar .logout span { display: none; }
  .topbar .logout .btn { padding: 0 8px; min-height: 36px; }
}
@media (min-width: 960px) {
  .topbar { display: flex; height: 60px; padding: 0 28px; }
  .topbar [data-drawer-open], .topbar .brand { display: none; }
  .hello { display: block; }
}

/* ---------------- หน้าลางาน (ปฏิทินการลา) ---------------- */
.lt-sick { --lt: #e5484d; } .lt-personal { --lt: #f59e0b; } .lt-vacation { --lt: #12a150; }
.lt-family { --lt: #d6409f; } .lt-unpaid { --lt: #6b7588; } .lt-other { --lt: #3e63dd; } .lt-team { --lt: #8e4ec6; }
.lv-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--lt, var(--ink-3)); flex: none; }
.lv-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.lv-head h1 { margin: 0; font-size: 1.9rem; font-weight: 800; }
.lv-tools { display: flex; align-items: center; gap: 10px; } .lv-tools form { margin: 0; }
.lv-req { min-height: 44px; padding: 0 20px; font-weight: 800; }
.lv-sec { margin: 22px 0 12px; font-size: 1rem; font-weight: 800; color: var(--ink-2); }
.lv-head + .lv-sec { margin-top: 0; }
.lv-quota { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.lv-q { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.lv-q::before { content: ""; position: absolute; top: 0; left: 18%; right: 18%; height: 3px; border-radius: 0 0 3px 3px; background: var(--lt); }
.lv-q-name { font-weight: 700; font-size: .88rem; color: var(--ink-2); line-height: 1.3; min-height: 2.6em; display: flex; align-items: center; }
.lv-q-num b { font-size: 2rem; font-weight: 800; color: var(--lt); line-height: 1; }
.lv-q-num small { font-size: 1rem; color: var(--ink-4); font-weight: 600; }
.lv-q-sub { font-size: .74rem; color: var(--ink-3); }
.lv-q-pend { font-size: .72rem; font-weight: 700; color: var(--warn); background: var(--warn-soft); padding: 1px 8px; border-radius: 999px; }
.lv-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0 22px; align-items: start; }
@media (max-width: 1100px) { .lv-body { grid-template-columns: minmax(0, 1fr); } }
.lv-card { padding: 0; overflow: hidden; } .lv-card .tbl { margin: 0; } .lv-card > .empty { padding: 28px 16px; }
.lv-tbl td { vertical-align: middle; } .lv-tbl td .ic { width: 15px; height: 15px; color: var(--ink-3); vertical-align: -2px; }
.lv-type { display: inline-flex; align-items: center; gap: 8px; }
.lv-reason { color: var(--ink-2); max-width: 260px; }
.lv-steps { margin-top: 6px; font-size: .78rem; } .lv-steps .steps { margin: 0; }
.lv-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); }
.lv-pager .row { align-items: center; gap: 4px; }
.lv-cal { padding: 16px 16px 12px; }
.lv-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lv-cal-head b { font-size: 1.1rem; font-weight: 800; }
.lv-cal-nav { border: 1px solid var(--line); }
.lv-grid { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; }
.lv-grid th { font-size: .72rem; font-weight: 700; color: var(--ink-3); padding: 4px 0; text-align: center; }
.lv-grid th.we { color: var(--neg); }
.lv-grid td { position: relative; height: 46px; padding: 4px 0 0; text-align: center; vertical-align: top; border-radius: 10px; background: var(--surface-2); }
.lv-grid td.we { background: color-mix(in srgb, var(--neg) 5%, var(--surface)); }
.lv-grid td.out { background: none; } .lv-grid td.out .lv-d { color: var(--line-2); font-weight: 400; }
.lv-grid td.hol { background: #fff7db; box-shadow: inset 0 0 0 1px #f4d77a; }
.lv-d { display: inline-grid; place-items: center; min-width: 24px; height: 24px; font-size: .82rem; font-weight: 700; border-radius: 50%; }
.lv-grid td.now .lv-d { background: var(--accent); color: #fff; }
.lv-dots { display: flex; justify-content: center; align-items: center; gap: 2px; flex-wrap: wrap; margin-top: 1px; }
.lv-dots .lv-dot { width: 6px; height: 6px; } .lv-dots em { font-style: normal; font-size: .6rem; color: var(--ink-3); }
.lv-h { display: inline-block; font-size: .6rem; font-weight: 800; color: #b26a00; }
.lv-grid .lv-h { position: absolute; right: 4px; top: 2px; }
.lv-legend { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.lv-legend li { display: flex; align-items: center; gap: 8px; } .lv-legend .lv-h { width: 9px; text-align: center; }
.lv-cal-note { margin: 10px 0 0; }
.lv-hol { margin-top: 14px; } .lv-hol h3 { margin: 0 0 6px; font-size: .9rem; } .lv-hol ul { margin: 0; padding-left: 18px; font-size: .86rem; color: var(--ink-2); }
.lv-form { grid-template-columns: 1fr 1fr; } .lv-form .wide, .lv-form > .file-field, .lv-form > p { grid-column: 1 / -1; }
@media (max-width: 520px) { .lv-form { grid-template-columns: 1fr; } }
.lv-form .ffield-label { display: flex; align-items: center; gap: 6px; }
.lv-hol li span { color: var(--ink-3); margin-right: 6px; }

/* ---------------- เอกสารบริษัท ---------------- */
.cd-lead { margin: -6px 0 14px; }
.cd-form .cd-title { grid-column: span 1; }
label > .fnote { font-weight: 400; line-height: 1.4; }
label > span > .small { line-height: 1; }
.ffield-list { margin: 6px 0 0; padding-left: 18px; font-weight: 400; color: var(--ink-2); max-height: 160px; overflow: auto; }
.cd-filter { flex-wrap: wrap; gap: 6px; } .cd-filter input[type=search] { min-width: 180px; }
.cd-file { display: flex; align-items: flex-start; gap: 10px; min-width: 240px; }
.cd-ext { display: inline-grid; place-items: center; flex: none; width: 42px; height: 48px; border-radius: 8px; font-size: .68rem; font-weight: 800; text-transform: uppercase; color: #fff; background: #6b7588; letter-spacing: .02em; }
.cd-ext-pdf { background: #d93f3f; } .cd-ext-doc, .cd-ext-docx { background: #2b5fd9; } .cd-ext-xls, .cd-ext-xlsx, .cd-ext-csv { background: #1e8a4c; }
.cd-ext-ppt, .cd-ext-pptx { background: #d4651f; } .cd-ext-jpg, .cd-ext-jpeg, .cd-ext-png { background: #8e4ec6; } .cd-ext-zip { background: #8a6d1e; }
.cd-bar { height: 5px; margin-top: 4px; width: 90px; border-radius: 3px; background: var(--line); overflow: hidden; } .cd-bar i { display: block; height: 100%; background: var(--pos); }
.cd-act { justify-content: flex-end; flex-wrap: nowrap; gap: 6px; } .cd-act form { margin: 0; }
.danger-text { color: var(--neg); }
.md-search { gap: 6px; } .md-search input { min-width: 200px; }
.md-search .btn .ic { width: 18px; height: 18px; }
.md-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.md-cats a { padding: .35rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: .88rem; text-decoration: none; }
.md-cats a b { color: var(--ink-3); font-weight: 600; margin-left: 2px; }
.md-cats a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; } .md-cats a[aria-current="page"] b { color: #fff; }
.md-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.md-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.md-card.is-new { border-color: #b7e1c7; box-shadow: 0 0 0 3px var(--pos-soft); }
.md-top { display: flex; align-items: center; gap: 10px; } .md-meta { min-width: 0; }
.md-title { margin: 4px 0 0; font-size: 1.02rem; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.md-desc { margin: 0; font-size: .88rem; color: var(--ink-2); white-space: pre-line; }
.md-info { margin: 0; } .md-act { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }
.md-act .btn { display: inline-flex; align-items: center; gap: 6px; } .md-act .ic { width: 16px; height: 16px; }
.md-mine h2 .ic, .card h2 > .ic { width: 20px; height: 20px; vertical-align: -3px; }

/* ---------------- หน้าหลักแบบแดชบอร์ด ---------------- */
.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 0 12px; }
.dash-head:first-child { margin-top: 4px; }
.dash-head h2 { margin: 0; font-size: 1.25rem; font-weight: 800; }
.dash-head .row { gap: 6px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px; padding: 18px; min-height: 150px;
  border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(135deg, var(--surface) 55%, var(--kpi-soft)); color: var(--ink); box-shadow: var(--shadow); text-decoration: none; transition: transform .15s var(--ease-out), box-shadow .15s; }
.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20,30,60,.08); }
.kpi-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--kpi-soft); color: var(--kpi); margin-bottom: 8px; }
.kpi-ic .ic { width: 22px; height: 22px; }
.kpi b { font-size: 1.9rem; font-weight: 800; line-height: 1.1; } .kpi b small { font-size: 1rem; font-weight: 600; color: var(--ink-3); }
.kpi > span:not(.kpi-ic) { position: relative; z-index: 1; font-size: .86rem; font-weight: 600; color: var(--ink-3); }
.kpi-wm { position: absolute; right: -8px; bottom: -10px; color: var(--kpi); opacity: .13; } .kpi-wm .ic { width: 86px; height: 86px; stroke-width: 1.2; }
.kpi-blue { --kpi: #1f4fd1; --kpi-soft: #e8eefc; } .kpi-green { --kpi: #12804a; --kpi-soft: #e3f4ea; }
.kpi-amber { --kpi: #b26a00; --kpi-soft: #fdf2d8; } .kpi-red { --kpi: #c0332b; --kpi-soft: #fbe9e7; }
.quota-card h2 .ic { width: 18px; height: 18px; color: var(--accent); vertical-align: -3px; }
.quota-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.quota { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink-2); text-decoration: none; }
.quota:hover { border-color: var(--lt); text-decoration: none; }
.quota span { font-size: .84rem; } .quota b { font-size: 1.45rem; font-weight: 800; color: var(--lt); } .quota b small { font-size: .95rem; color: var(--lt); opacity: .75; }
.quota em { font-style: normal; font-size: .72rem; color: var(--ink-3); }
.panel { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 22px; padding: 24px; margin: 18px 0; border-radius: 18px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #1f4fd1 0%, #0d2f86 45%, #0a2160 100%); box-shadow: 0 10px 28px rgba(13,47,134,.3); }
@media (max-width: 860px) { .panel { grid-template-columns: 1fr; padding: 18px; } }
.panel-h { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-h h2 { margin: 0; font-size: 1.2rem; font-weight: 800; color: #fff; } .panel-h p { margin: 0; font-size: .86rem; color: rgba(255,255,255,.75); }
.panel-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); flex: none; }
.panel-ic .ic { width: 22px; height: 22px; color: #ffd84d; }
.panel-box { margin: 0; padding: 16px; border-radius: 14px; background: rgba(5,18,60,.35); border: 1px solid rgba(255,255,255,.1); }
.panel-big { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.panel-big span { font-size: .8rem; font-weight: 700; color: rgba(255,255,255,.7); }
.panel-big b { font-size: 2rem; font-weight: 800; } .panel-big small { font-size: .9rem; color: rgba(255,255,255,.7); font-weight: 600; }
.pbar { margin-top: 10px; } .pbar > div { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; color: rgba(255,255,255,.85); }
.pbar i { display: block; height: 6px; margin-top: 5px; border-radius: 3px; background: rgba(255,255,255,.14); overflow: hidden; }
.pbar u { display: block; height: 100%; border-radius: 3px; background: #ffd84d; text-decoration: none; }
.pbar.warn u { background: #ffb547; } .pbar.neg u { background: #ff7a70; } .pbar.info u { background: #7dd3fc; }
.pbar.plain { padding-top: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.todo { list-style: none; display: grid; gap: 4px; }
.todo a { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; color: #fff; text-decoration: none; }
.todo a:hover { background: rgba(255,255,255,.08); }
.todo a > span:nth-child(2) { flex: 1; } .todo a > .ic { width: 16px; height: 16px; opacity: .5; }
.todo-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,216,77,.15); color: #ffd84d; flex: none; }
.todo-ic .ic { width: 16px; height: 16px; }
.todo li.done a { color: rgba(255,255,255,.65); } .todo li.done .todo-ic { background: rgba(74,222,128,.18); color: #4ade80; }
.panel-note { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(5,18,60,.35); border: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.85); font-size: .88rem; text-decoration: none; }
.panel-note:hover { text-decoration: none; background: rgba(5,18,60,.5); } .panel-note .ic { width: 18px; height: 18px; color: #ffd84d; flex: none; }
.proj-card .tbl { margin: 0; }
@media (max-width: 640px) { .kpi { min-height: 128px; padding: 14px; } .kpi b { font-size: 1.5rem; } }
/* Dashboard บริษัท: ใช้การ์ด KPI แบบหน้าหลัก */
.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpis.k3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi-violet { --kpi: #6d3fd1; --kpi-soft: #efe8fc; }
div.kpi:hover { transform: none; box-shadow: var(--shadow); }
.dash-card { --dc: #1f4fd1; --dc-soft: #e8eefc; border-radius: 16px; }
.dc-green { --dc: #12804a; --dc-soft: #e3f4ea; } .dc-amber { --dc: #b26a00; --dc-soft: #fdf2d8; } .dc-violet { --dc: #6d3fd1; --dc-soft: #efe8fc; }
.dash-card > h2 { display: flex; align-items: center; gap: 10px; }
.dc-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--dc-soft); color: var(--dc); flex: none; }
.dc-ic .ic { width: 18px; height: 18px; }
.dash-card .hbar i { background: var(--dc); }

/* ---------------- พื้นหลังระบบ "Marine Foam" (ไล่สีเขียวน้ำทะเล + เกรนบาง ๆ) ---------------- */
body:not(.bare), body.bare:has(.login) { min-height: 100vh; background-color: #0F5C63;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E"),
    linear-gradient(145deg, #0F5C63 0%, #3F9EA8 33%, #A9E2D9 67%, #EAF7F2 100%);
  background-size: 120px 120px, 100% 100%; background-blend-mode: overlay, normal; background-attachment: fixed; }
/* ข้อความที่วางบนพื้นหลังตรง ๆ (ไม่ได้อยู่ในการ์ด/กล่องขาว) → สีขาว อ่านง่ายบนโทนเข้ม */
body:not(.bare) .page :is(h1, h2, h3):not(:is(.card, dialog, .kpi, .panel, .tile, .stats, .lv-q, .md-card, .sheet, .flow, .tsday, .tsx-grid, table, .callout, .tsx-banner, .lv-detail, .qp-card, .qp-mcard, .qp-legend, .pd-tabs, .pd-stats, .pd-seg) *) { color: #fff; text-shadow: 0 1px 3px rgba(6,40,44,.45); }
body:not(.bare) .page :is(p, .muted, .small, .legend, label, .row > span, h1 span, h2 span):not(:is(.card, dialog, .kpi, .panel, .tile, .stats, .lv-q, .md-card, .sheet, .flow, .tsday, .tsx-grid, table, .callout, .btn, .md-cats, .tabs, .ffield, .dpick, .msg, .xtabs, .tsx-banner, .lv-detail, .qp-card, .qp-mcard, .qp-legend, .pd-tabs, .pd-stats, .pd-seg) *):not(.kpi-ic, .badge, .dc-ic, .sr-only, .msg, .num-hint, .callout, .qp-legend) { color: rgba(255,255,255,.9); text-shadow: 0 1px 2px rgba(6,40,44,.4); }
body:not(.bare) .page p a:not(.btn):not(:is(.card, dialog, .kpi, .panel, table) *) { color: #fff; text-decoration: underline; }

/* ---------------- เมนูข้าง + แถบบน โทนน้ำเงินเข้มแบบ pm.m1n.app ---------------- */
.rail { --nav-bg: #0b1f4d; background: linear-gradient(180deg, #0c2357 0%, #0a1a42 100%); border-right-color: rgba(255,255,255,.06) !important; color: #dbe4ff; }
.rail .brand, .rail .brand b, .rail .brand span { color: #fff; }
.rail .rail-btn, .topbar .rail-btn { color: rgba(219,228,255,.75); }
.rail .rail-btn:hover, .topbar .rail-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail-nav a { color: rgba(219,228,255,.78); }
.rail-nav a:hover { color: #fff; }
.rail-nav a.on { color: #fff; font-weight: 600; }
.hover-pill { background: rgba(255,255,255,.06); }
.active-pill { background: rgba(255,255,255,.13); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.grp-head { color: rgba(170,186,230,.6); } .grp-head:hover { color: #dbe4ff; background: rgba(255,255,255,.05); }
.sec { color: rgba(170,186,230,.6); }
.rail-foot { border-top-color: rgba(255,255,255,.08); }
.rail-nav { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.rail-nav a:focus-visible, .rail-btn:focus-visible, .grp-head:focus-visible { outline-color: #7db3ff; }
.topbar { background: #0b2152; border-bottom-color: rgba(255,255,255,.06); color: #fff; }
.topbar .brand { color: #fff; }
.hello span { color: rgba(170,186,230,.75); } .hello b { color: #fff; }
.topbar .who { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.04); color: #fff; }
.topbar .who:hover { background: rgba(255,255,255,.1); }
.topbar .who .role { color: #dbe4ff; }
.topbar .who .avatar .count { border-color: #0b2152; }
.topbar .logout .btn { color: #dbe4ff; border: 1px solid rgba(255,255,255,.14); background: transparent; }
.topbar .logout .btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.rail .who { color: #fff; } .rail .who:hover { background: rgba(255,255,255,.08); } .rail .who .lbl span { color: rgba(219,228,255,.7); }
.rail .count, .topbar .count { box-shadow: none; }
.topbar .bell { color: #dbe4ff; border-radius: 12px; } .topbar .bell:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar .bell .count { box-shadow: 0 0 0 2px #0b2152; }

/* ---------------- แท็บแบบขยายได้ (Expandable Tabs): ไอคอนอย่างเดียว ตัวที่เลือกจะกางชื่อออก ---------------- */
.xtabs { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(16,24,40,.06); }
.xtab { --xt-ease: cubic-bezier(.22, 1, .36, 1); position: relative; display: inline-flex; align-items: center; padding: .5rem; border-radius: 12px;
  color: var(--ink-3); font-size: .875rem; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: color .3s, background-color .3s, padding .6s var(--xt-ease) .1s; }
.xtab .ic { width: 20px; height: 20px; flex: none; }
.xtab:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.xtab-l { display: grid; grid-template-columns: 0fr; opacity: 0; margin-left: 0;
  transition: grid-template-columns .6s var(--xt-ease) .1s, opacity .6s var(--xt-ease) .1s, margin-left .6s var(--xt-ease) .1s; }
.xtab-l > span { overflow: hidden; min-width: 0; }
.xtab-l b { font-weight: 700; opacity: .7; }
.xtab[aria-current="page"], .xtab.is-on { padding: .5rem 1rem; background: var(--surface-2); color: var(--accent); }
.xtab[aria-current="page"] .xtab-l, .xtab.is-on .xtab-l { grid-template-columns: 1fr; opacity: 1; margin-left: .5rem; }
.xtabs.is-picking .xtab[aria-current="page"]:not(.is-on) { padding: .5rem; background: none; color: var(--ink-3); }
.xtabs.is-picking .xtab[aria-current="page"]:not(.is-on) .xtab-l { grid-template-columns: 0fr; opacity: 0; margin-left: 0; }
.xtab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.xtab-sep { width: 1.2px; height: 24px; margin: 0 4px; background: var(--line-2); flex: none; }
.xtabs-sticky { position: sticky; top: 60px; z-index: 10; margin: 0 0 12px; }
@media (max-width: 959px) { .xtabs-sticky { top: 58px; } }
.tsx-tabs.xtabs { margin-top: 10px; gap: 8px; }
.md-cats.xtabs { margin: 0 0 14px; }
.md-cats.xtabs a.xtab { padding: .5rem; border: 0; background: none; color: var(--ink-3); font-size: .875rem; }
.md-cats.xtabs a.xtab[aria-current="page"], .md-cats.xtabs a.xtab.is-on { padding: .5rem 1rem; background: var(--surface-2); color: var(--accent); }
.md-cats.xtabs a.xtab[aria-current="page"] b { color: inherit; }
@media (prefers-reduced-motion: reduce) { .xtab, .xtab-l { transition-duration: .01ms !important; transition-delay: 0s !important; } }
.page section.card[id] { scroll-margin-top: 128px; }

/* ---------------- Timesheet: ช่อง Issue + popup Select Issue (แบบระบบ PM) ---------------- */
.ts-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .ts-two { grid-template-columns: minmax(0, 1fr); } }
.ts-code { background: var(--surface-2) !important; color: var(--ink-2); font-family: var(--mono); }
.ts-issue { display: grid; gap: 6px; } .ts-issue > .lbl { font-weight: 600; }
.ts-issue-row { display: flex; gap: 8px; }
.ts-issue-box { flex: 1; min-width: 0; display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ts-issue-box:hover { border-color: var(--accent); }
.ts-issue-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ts-issue-box > span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ts-issue-box .ph { color: var(--ink-4); font-style: italic; }
.ts-issue-btn { width: 44px; min-height: 44px; padding: 0; display: grid; place-items: center; flex: none; }
.ts-issue-btn .ic { width: 20px; height: 20px; }
.ts-free[hidden] { display: none !important; }
.ts-free-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); font-size: .74rem; font-weight: 700; }
.iss-no { display: inline-block; font-family: var(--mono); font-size: .8em; font-weight: 700; color: var(--accent); white-space: nowrap; }
.iss-no.iss-bug { color: var(--neg); } .iss-no.iss-milestone { color: #6d3fd1; }
.tsx-type { display: inline-block; margin-top: 2px; padding: 0 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-3); font-size: .72rem; font-weight: 600; }
.iss-badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-style: normal; font-size: .72rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.iss-st-open { background: #e8eefc; color: #1f4fd1; } .iss-st-in_progress { background: #fdf2d8; color: #9a5b00; } .iss-st-done { background: #e3f4ea; color: #12804a; }
/* popup */
dialog.modal.ts-pick { width: min(980px, calc(100vw - 32px)); }
.ts-pick .modal-head { flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ts-pick .modal-head h2 { margin-right: 8px; }
.ts-pick-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); margin-right: auto; }
.ts-pick-tabs button { padding: 6px 14px; border: 0; border-radius: 9px; background: none; color: var(--ink-3); font: inherit; font-size: .86rem; font-weight: 700; cursor: pointer; }
.ts-pick-tabs button b { font-weight: 600; opacity: .7; }
.ts-pick-tabs button[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(16,24,40,.1); }
.ts-pick-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ts-pick .modal-body { gap: 10px; }
.ts-pick-search { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 10px; }
.ts-pick-search input { width: 100%; }
.pick-list { display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; max-height: min(56vh, 520px); overflow-y: auto; }
.pick-head, .pick-item { display: grid; grid-template-columns: minmax(0, 1.3fr) 110px minmax(0, 2fr) 110px; gap: 12px; align-items: center; padding: 12px 16px; }
.pick-free .pick-head, .pick-free .pick-item { grid-template-columns: 110px minmax(0, 2fr) 100px minmax(0, 1fr); }
.pick-head { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--ink-3); font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.pick-item { width: 100%; border: 0; border-top: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.pick-item:hover { background: #f1f5ff; } .pick-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; background: #f1f5ff; }
.pick-item[hidden] { display: none; }
.pick-item .pi-proj { color: var(--ink-3); font-size: .84rem; } .pick-item .pi-proj b { color: var(--ink-2); }
.pick-item .pi-title { font-weight: 600; }
.pick-list .empty { margin: 0; padding: 18px; }
@media (max-width: 680px) {
  .pick-head { display: none; }
  .pick-item, .pick-free .pick-item { grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; }
  .pick-item .pi-title { grid-column: 1 / -1; order: -1; }
  .pick-item .pi-proj { grid-column: 1 / -1; }
}
.ts-pick .modal-foot { display: flex; justify-content: center; }
.ts-pick .modal-foot .btn { min-width: 140px; border-radius: 999px; }
/* หน้า Issue ของโปรเจกต์ */
.pi-code { display: inline-block; padding: 2px 10px; border-radius: 8px; background: rgba(255,255,255,.18); font-family: var(--mono); font-size: .7em; vertical-align: middle; }
.pi-top { margin-bottom: 14px; }
.pi-add { display: grid; gap: 10px; } .pi-add label { display: grid; gap: 6px; font-weight: 600; } .pi-add textarea { width: 100%; font: inherit; font-weight: 400; } .pi-add .btn { justify-self: start; }
.iss-st { min-height: 34px; padding: 2px 8px; font-size: .84rem; font-weight: 600; border-radius: 8px; }
.pi-tbl td { vertical-align: middle; }
.proj-code { display: grid; gap: 4px; width: 180px; }
.proj-act { justify-content: flex-end; gap: 6px; flex-wrap: nowrap; }
/* ปุ่ม ghost ที่วางบนพื้นหลังไล่สีตรง ๆ (หัวหน้า) */
body:not(.bare) .page > .head > .btn.ghost { color: #fff; text-shadow: 0 1px 2px rgba(6,40,44,.4); }
body:not(.bare) .page > .head > .btn.ghost:hover { background: rgba(255,255,255,.14); }

/* ── สลับภาษา TH / EN ── */
.lang-sw { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 8px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #cfdcff; font-size: 12px; font-weight: 600; line-height: 1; }
.lang-sw svg { width: 15px; height: 15px; margin-right: 3px; opacity: .85; }
.lang-sw a { color: inherit; text-decoration: none; padding: 5px 8px; border-radius: 999px; }
.lang-sw a:hover { background: rgba(255,255,255,.12); color: #fff; }
.lang-sw a.on { background: #fff; color: #0b2152; }
.solo-tools { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.solo-tools:empty { display: none; }
.solo-tools .lang-sw { background: rgba(11,33,82,.55); border-color: rgba(255,255,255,.25); color: #e6eeff; backdrop-filter: blur(6px); }
@media (max-width: 560px) { .topbar .lang-sw svg { display: none; } .topbar .lang-sw { padding-left: 4px; } }

/* โควตาวันลา (HR) */

/* โควตาวันลาของฉัน */

/* โควตาวันลา (HR) — ตาราง พนักงาน × ประเภท, ช่องแบบ pill กดแก้ตัวเลขในช่อง */
.qp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.qp-title { display: flex; align-items: center; gap: 12px; }
.qp-ic { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; background: rgba(255,255,255,.92); color: var(--accent); box-shadow: var(--shadow); }
.qp-ic .ic { width: 24px; height: 24px; }
.qp-title h1 { margin: 0; }
.qp-sub { margin: 2px 0 0; font-size: .88rem; }
.qp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qp-tools select { width: auto; }
.qp-search { position: relative; display: block; }
.qp-search .ic { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.qp-search input { width: 15.5rem; padding-left: 32px; }
.qp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.qp-tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.qp-tbl thead th { padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: .74rem; font-weight: 700; text-align: left; white-space: nowrap; }
.qp-tbl tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.qp-tbl tbody tr:last-child td { border-bottom: 0; }
.qp-tbl tbody tr:hover td { background: #f7f9fc; }
.qp-tbl .qp-emp { position: sticky; left: 0; z-index: 1; background: var(--surface); border-right: 1px solid var(--line); min-width: 220px; }
.qp-tbl thead .qp-emp { background: var(--surface-2); z-index: 2; }
.qp-tbl .qp-th, .qp-tbl .qp-cell { text-align: center; padding-left: 8px; padding-right: 8px; min-width: 124px; }
.qp-th-in { display: inline-flex; align-items: center; gap: 6px; }
.qp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--lt, #ccd); flex: none; }
.qp-person { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.qp-person:hover { text-decoration: none; } .qp-person:hover b { color: var(--accent); }
.qp-av { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent); border: 1px solid #d3defa; font-weight: 800; font-size: .9rem; }
.qp-pn { display: flex; flex-direction: column; min-width: 0; }
.qp-pn b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qp-pn small { font-size: .72rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qp-role { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-size: .76rem; font-weight: 700; white-space: nowrap; }
.qp-team { color: var(--ink-2); white-space: nowrap; }
.qp-na { color: var(--line-2); }
.qp-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); white-space: nowrap; transition: border-color .15s, box-shadow .15s; }
.qp-pill.qp-custom { background: #fff8e6; border-color: #f3d68a; box-shadow: 0 1px 2px rgba(180,120,0,.12); }
.qp-pill.qp-over { border-color: #efb3ad; box-shadow: inset 0 0 0 1px #efb3ad; }
.qp-pill.qp-low { border-color: #f1c66b; }
.qp-n { min-width: 22px; font-size: .98rem; font-weight: 800; color: var(--ink); text-decoration: none; border-radius: 6px; padding: 0 3px; }
a.qp-n:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.qp-custom .qp-n { color: #8a5a00; }
.qp-over .qp-used { color: var(--neg); font-weight: 700; }
.qp-self { cursor: default; }
.qp-div { width: 1px; height: 14px; background: rgba(0,0,0,.08); }
.qp-used { font-size: .72rem; color: var(--ink-3); font-weight: 600; }
.qp-pend { font-size: .7rem; font-weight: 700; color: #8a5a00; background: var(--warn-soft); padding: 0 6px; border-radius: 999px; }
.qp-rf { display: contents; }
.qp-reset { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: none; color: #c08a00; cursor: pointer; }
.qp-reset:hover { background: #fdecc0; color: #8a5a00; }
.qp-reset .ic { width: 14px; height: 14px; }
.qp-form { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.qp-form input[name=total] { width: 3.6rem; min-height: 28px; padding: 0 6px; text-align: center; font-weight: 800; font-size: .95rem; border-color: var(--accent); }
.qp-ok, .qp-more { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--accent); cursor: pointer; }
.qp-ok:hover, .qp-more:hover { background: var(--accent-soft); text-decoration: none; }
.qp-ok .ic, .qp-more .ic { width: 15px; height: 15px; }
.qp-pill.qp-editing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qp-none td, p.qp-none { padding: 40px 16px; text-align: center; color: var(--ink-3); }
.qp-mob { display: none; }
.qp-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; margin-top: 22px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.86); color: var(--ink-3); font-size: .82rem; }
.qp-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.qp-legend b { color: var(--ink-2); font-weight: 600; }
.qp-legend-r { margin-left: auto; font-style: italic; }
.qp-legend .ic { width: 14px; height: 14px; }
.qp-key { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-2); }
.qp-key.qp-custom { background: #fff8e6; border-color: #f3d68a; }
.qp-key-over { border-color: #e88f86; box-shadow: inset 0 0 0 1px #efb3ad; }
.qp-key-low { border-color: #f1c66b; }
@media (max-width: 860px) {
  .qp-desk { display: none; }
  .qp-mob { display: grid; gap: 12px; }
  .qp-mcard { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
  .qp-mcard .qp-person { margin-bottom: 12px; }
  .qp-mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .qp-mbox { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
  .qp-mbox.qp-custom { background: #fff8e6; border-color: #f3d68a; }
  .qp-mname { display: flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .qp-mbox .qp-pill { padding: 0; min-height: 0; border: 0; background: none; box-shadow: none; flex-wrap: wrap; }
  .qp-mbox .qp-pill.qp-editing { box-shadow: none; }
  .qp-search, .qp-search input { width: 100%; }
  .qp-tools { width: 100%; }
  .qp-legend-r { margin-left: 0; }
}

/* popup ปรับยอดโควตา (กว้าง) */
@media (min-width: 641px) { dialog.modal.qt-dialog { width: min(820px, calc(100vw - 32px)); } }
.qt-body { display: grid; gap: 16px; }
.qt-who { display: flex; align-items: center; gap: 12px; }
.qt-who > div { display: flex; flex-direction: column; min-width: 0; }
.qt-who small { color: var(--ink-3); font-size: .8rem; }
.qt-who .qp-av { width: 40px; height: 40px; font-size: 1rem; }
.qt-stats { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.qt-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.qt-stat span { font-size: .72rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-stat b { font-size: 1.2rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.qt-stat-total { background: var(--accent-soft); border-color: #cddaf8; } .qt-stat-total b { color: var(--accent); }
.qt-stat-rem { background: var(--pos-soft); border-color: #bfe3cd; } .qt-stat-rem b { color: var(--pos); }
.qt-stat-rem.qt-neg { background: var(--neg-soft); border-color: #f2c6c1; } .qt-stat-rem.qt-neg b { color: var(--neg); }
.qt-fields { grid-template-columns: 1fr 1fr 2fr; }
.qt-hint { margin: 0; }
@media (max-width: 760px) {
  .qt-stats { grid-template-columns: repeat(4, 1fr); }
  .qt-fields { grid-template-columns: 1fr 1fr; } .qt-fields .qt-note { grid-column: 1 / -1; }
}
@media (max-width: 520px) { .qt-stats { gap: 6px; } .qt-stat { padding: 8px; } .qt-stat span { white-space: normal; line-height: 1.25; font-size: .68rem; } .qt-stat b { font-size: 1.05rem; } }

/* ลางาน: ที่มาของสิทธิ์การลา (รวมจากหน้าโควตาของฉันเดิม) */
.lv-detail { margin: 12px 0 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); color: var(--ink); }
.lv-detail > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 12px 16px; cursor: pointer; font-weight: 700; list-style: none; }
.lv-detail > summary::-webkit-details-marker { display: none; }
.lv-detail > summary > .ic:last-child { margin-left: auto; transform: rotate(90deg); transition: transform .15s; }
.lv-detail[open] > summary > .ic:last-child { transform: rotate(-90deg); }
.lv-detail-sub { font-weight: 400; font-size: .84rem; color: var(--ink-3); }
.lv-detail .scroll { border-top: 1px solid var(--line); }
.lv-dt { margin: 0; }
.lv-dt th { white-space: nowrap; }
.lv-dt-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.lv-dt-note { margin-top: 2px; line-height: 1.45; }
.lv-dt-pend { color: #8a5a00; font-weight: 700; }
.lv-dt-rem.low { color: #b26a00; } .lv-dt-rem.neg { color: var(--neg); }
.lv-dt-foot { margin: 0; padding: 10px 16px 14px; border-top: 1px solid var(--line); }

/* เอกสารบริษัท: เลือกพนักงานรายบุคคล */
.badge.info { background: #e8efff; color: #2747a8; border-color: #c9d6f7; }
.badge .ic { width: 13px; height: 13px; vertical-align: -2px; }
.cd-people-names { max-width: 260px; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cd-people { margin: 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); min-width: 0; }
.cd-people[hidden] { display: none; }
.cd-people legend { padding: 0 6px; font-weight: 700; }
.cd-ptools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 10px; }
.cd-ptools input[type=search] { flex: 1 1 220px; min-width: 0; }
.cd-ptools .cd-only { margin-left: auto; font-weight: 400; }
.cd-plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 10px; max-height: 288px; overflow: auto; padding: 2px; }
.cd-p { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: start; align-content: start; padding: 7px 9px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; font-weight: 400; }
.cd-p[hidden] { display: none; }
.cd-p input { grid-row: span 2; margin-top: 3px; width: 18px; height: 18px; }
.cd-p:has(input:checked) { border-color: var(--brand, #2b5fd9); background: #eef3ff; }
.cd-p-name { font-weight: 600; }
.cd-nologin { color: #8a5a00; }
.cd-plist .empty { grid-column: 1 / -1; margin: 6px 0; }
#cd-edit .cd-people { margin-top: 4px; }
.btn.sm.acct-rename-btn { min-height: 28px; height: 28px; padding: 0 8px; margin: -6px 0 -6px 6px; vertical-align: middle; }

/* ---------- โปรเจกต์ (แบบระบบ PM) ---------- */
.pj-head { align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.pj-head h1 { margin-bottom: 2px; }
.pj-lead { margin: 0; }
.pj-card { padding: 0; overflow: hidden; }
.pj-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pj-search { display: flex; gap: 6px; flex: 1 1 260px; max-width: 380px; }
.pj-search input { flex: 1; min-width: 0; }
.pj-search .btn { padding: 0 12px; }
.pj-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.pj-filter a { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: .86rem; font-weight: 600; text-decoration: none; }
.pj-filter a b { font-size: .76rem; color: var(--ink-3); font-weight: 700; }
.pj-filter a[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pj-filter a[aria-current] b { color: rgba(255,255,255,.85); }
.pj-pager { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.pj-pager .small { margin-right: 6px; font-weight: 700; }
.pj-pager .btn { min-height: 34px; width: 34px; padding: 0; }
.pj-pager [aria-disabled] { opacity: .35; pointer-events: none; }
.pj-tbl { margin: 0; }
.pj-tbl th { white-space: nowrap; }
.pj-tbl td { padding-top: 14px; padding-bottom: 14px; vertical-align: middle; }
.pj-tbl tr[data-href] { cursor: pointer; }
.pj-tbl tbody tr:hover { background: var(--surface-2); }
.pj-name { font-weight: 700; color: var(--ink); text-decoration: none; }
a.pj-name:hover { color: var(--accent); text-decoration: underline; }
.pj-client { font-weight: 600; color: var(--accent); }
.pj-late { color: var(--neg); font-weight: 700; }
.pj-st { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; line-height: 1.6; white-space: nowrap; border: 1px solid transparent; }
.pj-st-active { background: #e3f4ea; color: #12804a; border-color: #c4e6d2; }
.pj-st-on_hold { background: #fdf2d8; color: #9a5b00; border-color: #f1dca8; }
.pj-st-completed { background: #e8eefc; color: #1f4fd1; border-color: #c9d6f7; }
.pj-st-cancelled { background: var(--surface-2); color: var(--ink-3); border-color: var(--line); }
.pj-mob { display: none; }
.pj-foot { margin-top: 10px; }
.pj-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.pj-fields label { display: grid; gap: 6px; align-content: start; }
.pj-fields .pj-f-wide { grid-column: span 1; }
.pj-fields .pj-f-all { grid-column: 1 / -1; }
.pj-fields textarea { width: 100%; font: inherit; }
@media (min-width: 641px) { dialog.modal.pj-dialog { width: min(760px, calc(100vw - 32px)); } }
@media (max-width: 760px) {
  .pj-desk { display: none; }
  .pj-mob { display: grid; gap: 10px; padding: 12px; }
  .pj-mcard { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); text-decoration: none; }
  .pj-mtop { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
  .pj-mtop .pj-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .pj-kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .88rem; }
  .pj-kv dt { color: var(--ink-3); font-weight: 600; } .pj-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
  .pj-pager { margin-left: 0; }
  .pj-search { max-width: none; }
}
@media (max-width: 640px) { .pj-fields { grid-template-columns: 1fr; } }

/* หน้าโปรเจกต์ */
.pd-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.btn.ghost.pd-back, .pd-back { width: 44px; min-height: 44px; padding: 0; background: var(--surface); border-color: var(--surface); color: var(--ink); flex: none; }
.btn.ghost.pd-back:hover { background: #fff; color: var(--accent); }
.pd-title { flex: 1 1 300px; min-width: 0; }
.pd-title h1 { margin: 0; line-height: 1.25; overflow-wrap: anywhere; }
.pd-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 4px 0 0; font-weight: 700; }
.pd-code { padding: 1px 8px; border-radius: 6px; background: rgba(255,255,255,.2); font-size: .82rem; }
.pd-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pd-tools .btn { background: var(--surface); }
.pd-tabs { display: flex; gap: 4px; padding: 5px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: none; }
.pd-tabs::-webkit-scrollbar { display: none; }
.pd-tabs a { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; border-radius: 10px; color: var(--ink-2); font-weight: 700; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.pd-tabs a .ic { width: 18px; height: 18px; }
.pd-tabs a b { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); font-size: .74rem; text-align: center; line-height: 1.6; }
.pd-tabs a:hover { background: var(--surface-2); }
.pd-tabs a[aria-current] { background: var(--accent); color: #fff; }
.pd-tabs a[aria-current] b { background: rgba(255,255,255,.22); color: #fff; }
.pd-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.pd-stat { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.pd-stat:hover { border-color: var(--accent); text-decoration: none; } .pd-stat:hover * { text-decoration: none; }
.pd-stat span { font-size: .8rem; font-weight: 700; color: var(--ink-3); }
.pd-stat b { font-size: 2rem; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.pd-stat b small { font-size: .85rem; font-weight: 600; color: var(--ink-3); }
.pd-stat b.pd-warn { color: var(--neg); }
.pd-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 14px; align-items: start; }
.pd-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.pd-kv dt { font-size: .8rem; font-weight: 700; color: var(--ink-3); margin-bottom: 4px; }
.pd-kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.pd-kv .pd-kv-all { grid-column: 1 / -1; }
.pd-notes { white-space: pre-line; font-weight: 400; }
.pd-ms { margin: 4px 0 6px; }
.pd-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.pd-seg a { padding: 5px 12px; border-radius: 8px; color: var(--ink-2); font-size: .86rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.pd-seg a b { color: var(--ink-3); font-size: .78rem; }
.pd-seg a[aria-current] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.pd-tbl td { vertical-align: middle; }
.pd-share { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; vertical-align: middle; margin-right: 4px; }
.pd-share i { display: block; height: 100%; background: var(--accent); }
.pd-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.pd-add .grow { flex: 1 1 320px; display: grid; gap: 6px; font-weight: 600; }
.pd-add label:not(.grow) { display: grid; gap: 6px; font-weight: 600; }
.pd-add textarea { width: 100%; font: inherit; font-weight: 400; min-height: 40px; resize: vertical; }
.pd-due { min-height: 34px; font-size: .86rem; }
@media (max-width: 1100px) { .pd-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pd-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .pd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pd-stat { padding: 12px 14px; } .pd-stat b { font-size: 1.6rem; }
  .pd-kv { grid-template-columns: 1fr; }
  .pd-tools { width: 100%; justify-content: space-between; }
}
@media (max-width: 760px) {
  .pj-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; padding-bottom: 2px; }
  .pj-filter::-webkit-scrollbar { display: none; }
  .pj-filter a { flex: none; }
}
.pm-role { font-weight: 700; }
.pm-act { justify-content: flex-end; flex-wrap: nowrap; gap: 6px; } .pm-act form, .pm-tbl td form { margin: 0; }
.pm-fields { margin-top: 12px; }
#pm-edit .modal-body label { display: grid; gap: 6px; margin-bottom: 10px; }
.modal-body .cd-ptools label.check { display: inline-flex; align-items: center; gap: 8px; grid-template-columns: none; }
.pd-viewer { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 10px; background: rgba(255,255,255,.16); color: #fff; font-size: .86rem; }
.pd-viewer b { color: #fff; }
.iss-st-ro { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border: 0; }
