/* ระบบ 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;
  --tabbar: 62px;
}
* { 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; }

/* ---------- โครงหน้า ---------- */
.app { min-height: 100vh; }
.rail { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); }
.brand:hover { text-decoration: none; }
.mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; }
.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: 1180px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); }
.page.solo { padding-bottom: 32px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
.tabbar > a, .tabbar summary { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3); font-size: .72rem; min-width: 0; cursor: pointer; list-style: none; position: relative; }
.tabbar summary::-webkit-details-marker { display: none; }
.tabbar > a.on, .tabbar details[open] summary { color: var(--accent); }
.tabbar .ic { width: 22px; height: 22px; }
.tabbar > a:hover { text-decoration: none; }
.more { flex: 1; display: flex; }
.more summary { width: 100%; }
.dot { position: absolute; top: 8px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--neg); }
.more-panel { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); max-height: 70vh; overflow: auto;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(20,30,60,.12); padding: 8px 8px 12px; }
.more-panel a { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: 8px; color: var(--ink); min-height: 44px; }
.more-panel a.on { background: var(--accent-soft); color: var(--accent); }
.more-panel .count { margin-left: auto; }
.more-panel form { padding: .5rem .8rem; }
.sec { padding: .9rem .8rem .25rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em; color: var(--ink-4); text-transform: uppercase; }

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 248px 1fr; }
  .rail { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: auto; background: var(--surface);
    border-right: 1px solid var(--line); padding: 14px 10px; }
  .rail .brand { padding: 4px 8px 12px; }
  .rail nav a { display: flex; align-items: center; gap: .65rem; padding: .48rem .7rem; border-radius: 8px; color: var(--ink-2); font-size: .93rem; }
  .rail nav a:hover { background: var(--surface-2); text-decoration: none; }
  .rail nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .rail nav .count { margin-left: auto; }
  .rail-foot { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid var(--line); }
  .rail-foot .who { display: block; color: var(--ink); margin-bottom: .5rem; position: relative; }
  .rail-foot .who span { display: block; font-size: .78rem; color: var(--ink-3); }
  .rail-foot .who .count { position: absolute; right: 0; top: 0; }
  .topbar, .tabbar { display: none; }
  .page { padding: 24px 28px 40px; }
}

/* ---------- ชิ้นส่วน ---------- */
.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; }
.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); }
.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; }
.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; }
.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: 0; } }
.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; }

/* เข้าสู่ระบบ */
.login { max-width: 400px; margin: 8vh auto 0; }
.login-brand { text-align: center; margin-bottom: 1rem; }
.login-brand h1 { margin: .6rem 0 .1rem; } .login-brand p { color: var(--ink-3); }
.login form { display: grid; gap: 14px; }

/* ---------- เอกสารพิมพ์ ---------- */
.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, .topbar, .tabbar, .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; }
}
