/* HR-Innovation — ธีมผสมสองแบรนด์
   INNO Aesthetics  → กรมท่า #00205b + เทาถ่าน #454545 (โครงสร้าง ปุ่ม หัวข้อ)
   Innovation Beauty → เทาเงิน #97999b + วงล้อสีรุ้ง (เส้นเน้น สีประเภทการลา) */
:root {
  --navy: #00205b;
  --navy-2: #0b3486;
  --navy-soft: #eaeef7;
  --charcoal: #454545;
  --ink: #26282c;
  --grey: #97999b;
  --muted: #6d7075;
  --line: #e3e5ea;
  --bg: #f4f5f8;
  --card: #ffffff;
  --ok: #17874a;      --ok-bg: #e7f5ec;
  --warn: #a8690a;    --warn-bg: #fdf3dc;
  --bad: #c62828;     --bad-bg: #fdeaea;
  --off: #6d7075;     --off-bg: #eeeff1;
  --spectrum: linear-gradient(90deg, #1b8fd0, #18a558, #a6ce39, #ffd200, #f58220, #e5352b, #c2185b, #7b2d8e);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 32, 91, .05), 0 6px 20px rgba(0, 32, 91, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 "IBM Plex Sans Thai", "Leelawadee UI", "Sukhumvit Set", Tahoma, system-ui, sans-serif;
}
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.3; margin: 0; color: var(--navy); font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0; color: var(--charcoal); font-weight: 600; }
.sub { color: var(--muted); margin: 2px 0 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- แถบบน ---------- */
.spectrum { height: 4px; background: var(--spectrum); }
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 18px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand img { height: 30px; width: auto; display: block; }
.brand .sep { width: 1px; height: 26px; background: var(--line); }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a {
  padding: 8px 12px; border-radius: 9px; color: var(--charcoal); white-space: nowrap; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.on { background: var(--navy-soft); color: var(--navy); }
.nav .grp { align-self: center; flex-shrink: 0; width: 1px; height: 22px; background: var(--line); margin: 0 8px; }
.badge { background: #e5352b; color: #fff; border-radius: 99px; font-size: 11px; font-weight: 600; padding: 0 7px; line-height: 18px; }
.who { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.who .name { text-align: right; line-height: 1.25; font-size: 13px; }
.who .name b { display: block; font-weight: 600; color: var(--ink); }
.who .name span { color: var(--muted); font-size: 12px; }
.who img { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: #fff; padding: 3px; }

main { max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

/* ---------- การ์ด ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card, .grid + .card, .card + .grid { margin-top: 18px; }
.card-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-b { padding: 18px; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.grid > .card { margin-top: 0; }

.bal { padding: 16px 18px; position: relative; overflow: hidden; }
.bal::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c); }
.bal .t { color: var(--muted); font-size: 13px; }
.bal .n { font-size: 30px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.bal .n small { font-size: 13px; font-weight: 400; color: var(--muted); }
.bar { height: 6px; background: var(--off-bg); border-radius: 99px; margin: 10px 0 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c); border-radius: 99px; }
.bal .f { font-size: 12px; color: var(--muted); }

.stat { padding: 16px 18px; }
.stat .t { color: var(--muted); font-size: 13px; }
.stat .n { font-size: 30px; font-weight: 600; color: var(--navy); line-height: 1.2; }

/* ---------- ตาราง ---------- */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 18px; background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
td .dim { color: var(--muted); font-size: 13px; }
tr.off td { opacity: .55; }
.type { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.type::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.pending { background: var(--warn-bg); color: var(--warn); }
.chip.approved { background: var(--ok-bg); color: var(--ok); }
.chip.rejected { background: var(--bad-bg); color: var(--bad); }
.chip.cancelled, .chip.off { background: var(--off-bg); color: var(--off); }
.chip.co { background: var(--navy-soft); color: var(--navy); font-weight: 500; }
.chip.co.beauty { background: #f1f1f2; color: var(--charcoal); }
.chip.hr { background: var(--navy); color: #fff; }

/* ---------- ฟอร์ม ---------- */
label { display: block; font-size: 13px; font-weight: 500; color: var(--charcoal); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #cfd3da; border-radius: 10px; padding: 9px 12px; min-height: 42px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(11, 52, 134, .25); border-color: var(--navy-2); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin: 0 16px 6px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--navy); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  border-radius: 10px; padding: 9px 16px; min-height: 42px; cursor: pointer; border: 1px solid transparent;
  background: var(--navy); color: #fff; white-space: nowrap;
}
.btn:hover { background: var(--navy-2); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--charcoal); border-color: #cfd3da; }
.btn.ghost:hover { background: var(--bg); }
.btn.ok { background: var(--ok); }
.btn.bad { background: #fff; color: var(--bad); border-color: #efc1c1; }
.btn.bad:hover { background: var(--bad-bg); }
.btn.sm { min-height: 34px; padding: 4px 12px; font-size: 13px; }
.btn.link { background: none; border: 0; color: var(--muted); padding: 0 4px; min-height: 0; font-weight: 500; }
.btn.link:hover { color: var(--bad); background: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }

/* ---------- แจ้งเตือน ---------- */
.flash { padding: 11px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; overflow-wrap: anywhere; }
.flash.ok { background: var(--ok-bg); color: #0f5e33; border-color: #bfe3cd; }
.flash.error { background: var(--bad-bg); color: #8e1c1c; border-color: #f3c4c4; }

/* ---------- ใบลารออนุมัติ (HR) ---------- */
.req { padding: 16px 18px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr minmax(260px, 340px); gap: 18px; }
.req:last-child { border-bottom: 0; }
.req .p b { font-weight: 600; }
.req .meta { display: flex; gap: 6px 14px; flex-wrap: wrap; margin: 6px 0; align-items: center; }
.req .why { color: var(--charcoal); background: var(--bg); border-radius: 8px; padding: 8px 12px; margin-top: 8px; overflow-wrap: anywhere; }
.req form { display: flex; flex-direction: column; gap: 8px; }
.req form .actions { justify-content: flex-end; }

/* ---------- หน้า login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(900px 500px at 50% -10%, #e4e9f5 0, var(--bg) 70%); }
.login .box { width: 100%; max-width: 420px; }
.login .card { overflow: hidden; }
.login .logos { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 26px 22px 6px; }
.login .logos img { height: 44px; max-width: 46%; object-fit: contain; }
.login .logos .sep { width: 1px; height: 34px; background: var(--line); }
.login .card-b { padding: 14px 28px 28px; }
.login h1 { text-align: center; font-size: 21px; }
.login .sub { text-align: center; margin-bottom: 20px; }
.login .btn { width: 100%; margin-top: 6px; }
.login .foot { text-align: center; color: var(--grey); font-size: 12px; margin-top: 16px; }

@media (max-width: 820px) {
  .top-in { flex-wrap: wrap; padding: 8px 16px 0; gap: 8px; }
  .brand img { height: 28px; }
  .who { margin-left: auto; }
  .who .name { display: none; }
  .nav { order: 3; flex-basis: 100%; padding-bottom: 8px; }
  main { padding: 20px 16px 48px; }
  .req { grid-template-columns: 1fr; }
  th, td { padding: 10px 14px; }
}
