/* ระบบบริหารงานบุคคล — ธีม: เขียวอมฟ้า (teal) + เทาอุ่น · ฟอนต์ IBM Plex Sans Thai
   โครงหน้า: แถบบนเข้ม (แบรนด์ + สลับมุมมอง) · เมนูข้างขาว · เนื้อหาบนพื้นเทาอ่อน · มุมมองพนักงาน = จอมือถือ */
:root {
  --teal: #0f766e;
  --teal-ink: #0b5f58;
  --teal-soft: #e3f3f0;
  --teal-dark: #0a3f3b;
  --ink: #16232b;
  --muted: #64747f;
  --bg: #f2f5f4;
  --card: #ffffff;
  --line: #dfe6e3;
  --line2: #c5d0cb;
  --chip: #eef2f0;
  --amber: #b45309;
  --amber-soft: #fdf1dc;
  --red: #b91c1c;
  --red-soft: #fde8e8;
  --blue: #1d4ed8;
  --blue-soft: #e3ecfd;
  --green: #15803d;
  --green-soft: #dff5e6;
  --shadow: 0 1px 2px rgba(22, 35, 43, .04), 0 6px 18px rgba(22, 35, 43, .05);
  --radius: 12px;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans Thai", "Noto Sans Thai", "Sukhumvit Set", "Leelawadee UI", -apple-system, "Segoe UI", Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
}
a { color: var(--teal-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; }
h2 { font-size: 16.5px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
small { font-size: 12.5px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .93em; }
.sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
@media (max-width: 900px) { .grid2, .grid3, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; } }
/* มือถือ: การ์ดในกริดต้องไม่ดันหน้าให้กว้างเกินจอ — ตาราง/ปฏิทินที่กว้างกว่าการ์ดเลื่อนซ้ายขวาในการ์ดแทน (15 พ.ย. 2569) */
.grid2 > *, .grid3 > *, .grid-2-1 > *, .grid-1-2 > * { min-width: 0; }
@media (max-width: 900px) { .card { overflow-x: auto; } }

/* ---------- แถบบน ---------- */
.top {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(90deg, var(--teal-dark) 0%, #0d5c56 60%, var(--teal) 100%);
  color: #fff;
  display: flex; align-items: center; gap: 18px;
  padding: 0 18px; height: 56px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: #fff; color: var(--teal-ink); font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; font-size: 15px; }
.brand-text small { font-weight: 400; font-size: 11.5px; opacity: .8; }
.personas { display: flex; gap: 3px; background: rgba(255,255,255,.12); border-radius: 999px; padding: 3px; margin-left: auto; }
.personas a { color: #d5ebe8; font-size: 13.5px; font-weight: 600; padding: 5px 14px; border-radius: 999px; white-space: nowrap; transition: background .12s, color .12s; }
.personas a:hover { background: rgba(255,255,255,.14); color: #fff; text-decoration: none; }
.personas a.cur { background: #fff; color: var(--teal-ink); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.top-right { display: flex; align-items: center; gap: 14px; margin-left: 6px; }
.today { font-size: 12.5px; opacity: .85; white-space: nowrap; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.2; }
.user-chip b { display: block; font-weight: 600; }
.user-chip small { opacity: .75; font-size: 11px; }
@media (max-width: 1100px) { .today { display: none; } .brand-text small { display: none; } }
@media (max-width: 760px) {
  .top { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .personas { width: 100%; margin-left: 0; order: 3; overflow-x: auto; }
  .personas a { flex: 1; text-align: center; padding: 6px 10px; }
  .user-chip span:last-child { display: none; }
}

/* ---------- โครงหน้า ---------- */
.shell { display: flex; min-height: calc(100vh - 56px); }
.side { width: 232px; flex: 0 0 232px; background: var(--card); border-right: 1px solid var(--line); }
.side-inner { position: sticky; top: 56px; max-height: calc(100vh - 56px); overflow-y: auto; padding: 14px 10px 30px; }
.side-group { margin-bottom: 12px; }
.side-title { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; padding: 8px 12px 4px; }
.side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 12px; border-radius: 9px; color: var(--ink); font-size: 14px; }
.side a:hover { background: var(--chip); text-decoration: none; }
.side a.active { background: var(--teal-soft); color: var(--teal-ink); font-weight: 600; }
.side-badge { font-size: 11.5px; font-weight: 700; background: var(--amber); color: #fff; border-radius: 999px; padding: 0 7px; min-width: 20px; text-align: center; }
.side a.active .side-badge { background: var(--teal); }
.main { flex: 1; min-width: 0; padding: 22px 26px 80px; max-width: 1240px; }
.main.wide { max-width: none; }
.no-side .main { margin: 0 auto; }
@media (max-width: 960px) {
  .shell { flex-direction: column; }
  .side { width: auto; flex: none; border-right: none; border-bottom: 1px solid var(--line); }
  .side-inner { position: static; max-height: none; display: flex; overflow-x: auto; padding: 8px 10px; gap: 4px; }
  .side-group { display: flex; margin: 0; gap: 2px; }
  .side-title { display: none; }
  .side a { white-space: nowrap; padding: 6px 11px; font-size: 13.5px; }
  .main { padding: 16px 14px 60px; }
}

/* ---------- หัวหน้า ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- การ์ด ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card.tight { padding: 12px 14px; }
.card.accent { border-left: 4px solid var(--teal); }

/* ---------- KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(var(--cols, auto-fit), minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 700px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; box-shadow: var(--shadow); color: var(--ink); }
a.kpi:hover { text-decoration: none; border-color: var(--teal); }
.kpi-label { font-size: 12.5px; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 1px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi-good .kpi-value { color: var(--green); }
.kpi-warn .kpi-value { color: var(--amber); }
.kpi-bad .kpi-value { color: var(--red); }
.kpi-teal .kpi-value { color: var(--teal-ink); }

/* ---------- ตาราง ---------- */
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); margin-bottom: 14px; }
.card .tbl-wrap { box-shadow: none; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { background: var(--chip); text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #f8fbfa; }
.tbl tfoot td { background: var(--chip); font-weight: 700; border-top: 1px solid var(--line2); }
.tbl tr.dim td { color: var(--muted); }
.tbl tr.hl td { background: var(--amber-soft); }
.tbl.compact td, .tbl.compact th { padding: 5px 9px; font-size: 13px; }
.empty { color: var(--muted); padding: 26px; text-align: center; background: #f8faf9; border-radius: var(--radius); border: 1px dashed var(--line2); margin-bottom: 14px; }

/* ---------- ป้าย ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 10px; white-space: nowrap; line-height: 1.6; background: var(--chip); color: var(--muted); }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.bad { background: var(--red-soft); color: var(--red); }
.badge.info { background: var(--blue-soft); color: var(--blue); }
.badge.teal { background: var(--teal-soft); color: var(--teal-ink); }
.badge.muted { background: var(--chip); color: var(--muted); }
.due { display: inline-flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.due-date { font-size: 13px; }

/* ---------- รูปประจำตัว ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: hsl(var(--hue, 170) 45% 88%); color: hsl(var(--hue, 170) 45% 28%); font-weight: 700; font-size: 16px; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.avatar.lg { width: 64px; height: 64px; font-size: 26px; }
.emp-cell { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); }
.emp-cell:hover { text-decoration: none; }
a.emp-cell:hover b { color: var(--teal-ink); text-decoration: underline; }
.emp-cell-text { display: flex; flex-direction: column; line-height: 1.25; }
.emp-cell-text b { font-weight: 600; }
.emp-cell-text small { color: var(--muted); font-size: 12px; }

/* ---------- ปุ่ม / ฟอร์ม ---------- */
button, .btn {
  font: inherit; font-weight: 600; font-size: 14px;
  border: 1px solid var(--teal); background: var(--teal); color: #fff;
  border-radius: 9px; padding: 7px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; line-height: 1.5;
  white-space: nowrap; transition: filter .12s;
}
button:hover, .btn:hover { filter: brightness(1.07); text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
.btn.ghost, button.ghost { background: var(--card); color: var(--ink); border-color: var(--line2); }
.btn.ghost:hover { background: var(--chip); }
.btn.danger, button.danger { background: var(--card); color: var(--red); border-color: var(--red); }
.btn.ok-btn, button.ok-btn { background: var(--green); border-color: var(--green); }
.btn.link, button.link { background: none; border: none; color: var(--teal-ink); padding: 7px 8px; }
.btn.sm, button.sm { padding: 3px 11px; font-size: 13px; border-radius: 7px; }
.btn.big { padding: 12px 22px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; justify-content: center; }
.inline-form { display: inline; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input, select, textarea {
  font: inherit; font-size: 14.5px; padding: 7px 11px; border: 1px solid var(--line2); border-radius: 9px; background: var(--card); color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
input[type="checkbox"], input[type="radio"] { width: auto; }
input[type="date"], input[type="time"], input[type="number"] { max-width: 220px; }
.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #33434d; }
.hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
.form-grid.cols3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .form-grid, .form-grid.cols3 { grid-template-columns: 1fr; } }
.form-foot { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar input, .filter-bar select { width: auto; min-width: 150px; }
.filter-bar input[type="search"] { min-width: 240px; }
.check-list label { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.check-list label:last-child { border-bottom: none; }
.check-list input { width: 17px; height: 17px; }
.check-list .done-txt { text-decoration: line-through; color: var(--muted); }

/* ---------- แจ้งเตือน ---------- */
.note { border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; font-size: 14px; border: 1px solid; }
.note.ok { background: var(--green-soft); color: var(--green); border-color: #a9dcb8; }
.note.bad { background: var(--red-soft); color: var(--red); border-color: #f2b8b8; }
.note.warn { background: var(--amber-soft); color: var(--amber); border-color: #f0d39a; }
.note.info { background: var(--blue-soft); color: var(--blue); border-color: #b9cdf7; }
.alerts { display: grid; gap: 8px; margin-bottom: 16px; }
.alert-item { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 10px; padding: 9px 14px; font-size: 14px; }
.alert-item.bad { border-left-color: var(--red); }
.alert-item.ok { border-left-color: var(--green); }
.alert-item.info { border-left-color: var(--blue); }
.alert-item .grow { flex: 1; }

/* ---------- KV ---------- */
.kv { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); gap: 8px 22px; margin: 0; }
.kv div { border-bottom: 1px dashed var(--line); padding: 5px 0; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { font-weight: 500; }
@media (max-width: 700px) { .kv { grid-template-columns: 1fr; } }

/* ---------- แท็บ ---------- */
.tab-bar { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab-btn { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); border-radius: 0; padding: 8px 14px; margin-bottom: -1px; font-weight: 600; }
.tab-btn:hover { color: var(--ink); filter: none; background: var(--chip); }
.tab-btn.active { color: var(--teal-ink); border-bottom-color: var(--teal); }
.tab-count { font-size: 11.5px; background: var(--chip); border-radius: 999px; padding: 0 7px; color: var(--muted); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- แถบวัด / กราฟ ---------- */
.meter { position: relative; background: #e6ece9; border-radius: 999px; height: 20px; min-width: 110px; overflow: hidden; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--teal); border-radius: 999px; }
.meter span { position: relative; z-index: 1; font-size: 11.5px; font-weight: 700; color: var(--ink); padding-left: 9px; line-height: 20px; }
.meter-green i { background: var(--green); }
.meter-amber i { background: var(--amber); }
.meter-red i { background: var(--red); }
.chart { width: 100%; }
.chart-svg { width: 100%; display: block; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis { font-size: 11px; fill: var(--muted); font-family: inherit; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.legend.col { flex-direction: column; gap: 5px; }
.legend.col b { margin-left: auto; color: var(--ink); padding-left: 12px; font-variant-numeric: tabular-nums; }
.donut { display: flex; align-items: center; gap: 18px; }
.donut svg { width: 150px; height: 150px; flex: none; }
.donut-center { font-size: 22px; font-weight: 700; fill: var(--ink); font-family: inherit; }
.donut-sub { font-size: 9.5px; fill: var(--muted); font-family: inherit; }
.donut .legend { flex: 1; }
.hbars { display: grid; gap: 7px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 90px; align-items: center; gap: 10px; font-size: 13.5px; }
.hbar-track { height: 12px; background: #e6ece9; border-radius: 999px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: 999px; }
.hbar-val { text-align: right; font-weight: 600; }
.hbar-val small { color: var(--muted); font-weight: 400; }
@media (max-width: 600px) { .hbar { grid-template-columns: 100px 1fr 70px; } }

/* ---------- ปฏิทิน ---------- */
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; margin-bottom: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; } /* minmax(0,…) กันปฏิทินดันจอมือถือล้น */
.cal-cell { min-width: 0; min-height: 64px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; font-size: 12px; background: var(--card); position: relative; }
.cal-cell.blank { border: none; background: none; }
.cal-cell.off { background: #f6f8f7; color: var(--muted); }
.cal-cell.holiday { background: var(--amber-soft); }
.cal-cell.today { outline: 2px solid var(--teal); }
.cal-day { font-weight: 700; display: block; }
.cal-tag { display: block; font-size: 11px; border-radius: 5px; padding: 0 5px; margin-top: 2px; background: var(--teal-soft); color: var(--teal-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-tag.warn { background: var(--amber-soft); color: var(--amber); }
.cal-tag.info { background: var(--blue-soft); color: var(--blue); }
.cal-tag.bad { background: var(--red-soft); color: var(--red); }
.cal.mini .cal-cell { min-height: 34px; padding: 2px 4px; }

/* ---------- ขั้นตอน / ไทม์ไลน์ ---------- */
.steps { list-style: none; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.steps li { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); padding: 5px 12px 5px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.steps li span { width: 22px; height: 22px; border-radius: 50%; background: var(--chip); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.steps li.done { color: var(--green); border-color: #a9dcb8; }
.steps li.done span { background: var(--green); color: #fff; }
.steps li.cur { color: var(--teal-ink); border-color: var(--teal); font-weight: 600; }
.steps li.cur span { background: var(--teal); color: #fff; }
.timeline { list-style: none; padding: 0; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li { position: relative; padding: 0 0 14px 18px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--teal); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.timeline li.warn::before { background: var(--amber); }
.timeline li.bad::before { background: var(--red); }
.timeline li.muted::before { background: var(--line2); }
.timeline time { display: block; font-size: 12px; color: var(--muted); }

/* ---------- Kanban (สรรหา) ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; overflow-x: auto; }
.kanban-col { background: #eef2f0; border-radius: 10px; padding: 8px; min-width: 190px; }
.kanban-col h3 { font-size: 13px; color: var(--muted); margin: 4px 6px 8px; display: flex; justify-content: space-between; }
.kanban-card { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; margin-bottom: 8px; font-size: 13px; box-shadow: var(--shadow); }
.kanban-card b { display: block; font-size: 14px; }
.kanban-card .muted { font-size: 12px; }
.kanban-card form { margin-top: 6px; }
.kanban-card select { font-size: 12.5px; padding: 3px 6px; }
@media (max-width: 1100px) { .kanban { grid-template-columns: repeat(5, 190px); } }

/* ---------- ผังองค์กร ---------- */
.org { display: flex; flex-direction: column; align-items: center; gap: 0; }
.org-node { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; text-align: center; font-size: 13px; box-shadow: var(--shadow); min-width: 150px; }
.org-node b { display: block; font-size: 14px; }
.org-node.root { background: var(--teal); color: #fff; border-color: var(--teal); }
.org-node.root b { color: #fff; }
.org-line { width: 2px; height: 18px; background: var(--line2); }
.org-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.org-branch { display: flex; flex-direction: column; align-items: center; }
.org-count { font-size: 12px; color: var(--muted); }
.org-node.root .org-count { color: #cfe8e4; }

/* ---------- สลิป / เอกสารพิมพ์ ---------- */
.doc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; max-width: 800px; margin: 0 auto 16px; font-size: 14px; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 14px; }
.doc-head h1 { font-size: 20px; }
.doc-title { text-align: center; font-size: 18px; font-weight: 700; margin: 8px 0 14px; }
.doc table { width: 100%; border-collapse: collapse; }
.doc td, .doc th { padding: 5px 8px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.doc th { text-align: left; background: var(--chip); }
.doc .total td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: none; }
.doc .sign { display: flex; justify-content: space-between; margin-top: 40px; text-align: center; font-size: 13px; }
.doc .sign div { width: 40%; border-top: 1px solid var(--ink); padding-top: 6px; }
.doc p { margin-bottom: 8px; text-indent: 2em; line-height: 1.9; }
.print-bar { max-width: 800px; margin: 0 auto 12px; display: flex; gap: 8px; justify-content: flex-end; }
@media print {
  .top, .side, .print-bar, .page-head-right, .personas, .note { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; }
  .doc { border: none; box-shadow: none; padding: 0; max-width: none; }
}

/* ---------- ปิดบังข้อมูล (PDPA) ---------- */
.masked { cursor: pointer; border-bottom: 1px dashed var(--line2); font-family: var(--mono); font-size: .93em; }
.masked:hover { color: var(--teal-ink); }

/* ---------- จอมือถือ (พนักงาน) ---------- */
.phone-body { background: #dfe6e3; }
.phone-frame { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; box-shadow: 0 0 0 1px var(--line), 0 12px 40px rgba(0,0,0,.12); }
.phone-top { position: static; height: auto; min-height: 50px; padding: 6px 12px; gap: 10px; flex-wrap: wrap; }
.phone-top .personas { margin-left: auto; }
.phone-top .personas a { padding: 4px 9px; font-size: 12px; }
.phone { flex: 1; display: flex; flex-direction: column; }
.phone-head { background: linear-gradient(160deg, var(--teal) 0%, #14907f 100%); color: #fff; padding: 16px 18px 18px; border-radius: 0 0 22px 22px; }
.phone-user { display: flex; align-items: center; gap: 10px; }
.phone-user .avatar { background: rgba(255,255,255,.9); }
.phone-user b { display: block; font-size: 15px; }
.phone-user small { opacity: .85; font-size: 12px; }
.phone-title { font-size: 20px; font-weight: 700; margin-top: 12px; }
.phone-body-inner { flex: 1; padding: 14px 14px 90px; }
.phone-body-inner .card { padding: 14px 16px; margin-bottom: 12px; border-radius: 16px; }
.phone-body-inner h2 { font-size: 15px; margin-bottom: 8px; }
.phone-body-inner .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; }
.phone-body-inner .kpi { padding: 10px 12px; border-radius: 14px; }
.phone-body-inner .kpi-value { font-size: 22px; }
.phone-tabs { position: sticky; bottom: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px 8px; }
.phone-tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 0; border-radius: 10px; }
.phone-tabs a:hover { text-decoration: none; }
.phone-tabs a.cur { color: var(--teal-ink); font-weight: 600; }
.ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.clock-box { text-align: center; padding: 6px 0 2px; }
.clock-box .clock { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1.1; }
.clock-box .loc { font-size: 12.5px; color: var(--muted); margin: 4px 0 12px; }
.clock-btn { width: 100%; justify-content: center; font-size: 17px; padding: 14px; border-radius: 14px; }
.clock-btn.out { background: var(--amber); border-color: var(--amber); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 4px; font-size: 11.5px; color: var(--ink); text-align: center; }
.quick a:hover { text-decoration: none; border-color: var(--teal); }
.quick .ic { color: var(--teal-ink); }
.list { list-style: none; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list li:last-child { border-bottom: none; }
.list li small { color: var(--muted); display: block; }
.balance-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.balance-row:last-child { border-bottom: none; }
.balance-row b { font-size: 16px; }
.balance-row .meter { width: 90px; min-width: 0; height: 8px; }
.balance-row .meter span { display: none; }

/* ---------- หน้าซ่อน (guide) ---------- */
.hero { background: linear-gradient(135deg, var(--teal-dark) 0%, #0d5c56 55%, var(--teal) 100%); color: #eaf6f4; border-radius: 20px; padding: 36px 34px 30px; margin-bottom: 22px; }
.hero h1 { color: #fff; font-size: 30px; }
.hero p { max-width: 820px; margin-top: 8px; color: #cfe8e4; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 12px 0 8px; }
.role-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.role-card .num { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: var(--teal-soft); color: var(--teal-ink); align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.role-card p { font-size: 13.5px; color: var(--muted); flex: 1; }
.role-card .enter { font-weight: 600; }
.story { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 8px; }
.story li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 10px 46px; position: relative; font-size: 14px; }
.story li::before { counter-increment: s; content: counter(s); position: absolute; left: 12px; top: 9px; width: 24px; height: 24px; border-radius: 50%; background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; }

/* ---------- อื่น ๆ ---------- */
.dropzone { display: block; border: 2px dashed var(--line2); border-radius: 14px; padding: 30px 20px; text-align: center; cursor: pointer; margin: 0; font-weight: 400; background: #fafcfb; }
.dropzone b { display: block; font-size: 16px; color: var(--teal-ink); margin-bottom: 4px; }
.dropzone span { color: var(--muted); font-size: 13px; }
.dropzone.over { border-color: var(--teal); background: var(--teal-soft); }
.stat-line { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.stat-line b { color: var(--ink); }
.role-matrix td.y { color: var(--green); font-weight: 700; text-align: center; }
.role-matrix td.n { color: var(--line2); text-align: center; }
.role-matrix td.p { color: var(--amber); font-weight: 700; text-align: center; }
.big-num { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.doc-list { list-style: none; padding: 0; }
.doc-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: center; }
.doc-list li:last-child { border-bottom: none; }
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.int-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.int-card h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.int-card .muted { font-size: 13px; margin-top: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--green); margin-right: 5px; }
.dot.warn { background: var(--amber); }
.dot.bad { background: var(--red); }
.dot.off { background: var(--line2); }
.progress-cells { display: flex; gap: 3px; }
.progress-cells i { width: 14px; height: 14px; border-radius: 3px; background: var(--line); display: inline-block; }
.progress-cells i.on { background: var(--teal); }
.progress-cells i.late { background: var(--amber); }
.progress-cells i.absent { background: var(--red); }
.progress-cells i.leave { background: var(--blue); }
.progress-cells i.off { background: #f0f3f2; }
