:root {
  --bg: #f4f5f7; --panel: #fff; --ink: #1c2230; --muted: #6b7385; --line: #e3e6ec; --line2: #eef0f4;
  --accent: #0f766e; --accent-ink: #fff; --danger: #c2413b; --warn: #b45309; --ok: #15803d;
  --today: #fff7e0; --weekend: #fafbfc; --radius: 10px;
  --cell: 46px; --rowh: 32px; --side: 118px;
  font-family: 'IBM Plex Sans Thai', 'Sarabun', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---- top bar ---- */
.top { display: flex; align-items: center; gap: 16px; padding: 0 16px; height: 54px; background: #102a2a; color: #e8f3f1; position: sticky; top: 0; z-index: 30; }
.top .brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.top nav { display: flex; gap: 2px; overflow-x: auto; }
.top nav button { background: none; border: 0; color: #a9c7c2; padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.top nav button.on { background: #1f4745; color: #fff; }
.top .me { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; color: #a9c7c2; white-space: nowrap; }
.top .me a, .top .me button { color: #e8f3f1; background: none; border: 1px solid #2e5a57; padding: 5px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; }

main { padding: 16px; max-width: 1500px; margin: 0 auto; }
.view { display: none; } .view.on { display: block; }
h2 { font-size: 18px; margin: 4px 0 12px; } h3 { font-size: 15px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 14px; }
@media (max-width: 460px) { .grid2 { grid-template-columns: 1fr; } }
td.fit { width: 1%; white-space: nowrap; }
.sgrid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); }
.sgrid > .panel:first-child { order: 1; }
#alerts { max-height: 460px; overflow: auto; }
#userTable td, #typeTable td { white-space: nowrap; }

.btn { background: var(--panel); border: 1px solid var(--line); padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c5cad3; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); } .btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #99d5cc; border-color: var(--accent); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
label.f > * { color: var(--ink); font-size: 14px; }

/* ---- KPI ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 12.5px; }
.kpi.alert b { color: var(--danger); }

/* ---- tables ---- */
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
table.t th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #f7faf9; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 10px 0; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: #eef0f4; color: #3d4556; white-space: nowrap; }
.tag.confirmed { background: #e0ecff; color: #1e4fa8; }
.tag.checked_in { background: #dcf5e4; color: #146c34; }
.tag.checked_out { background: #eceef2; color: #5b6272; }
.tag.cancelled, .tag.no_show { background: #fde7e5; color: #a3322c; }
.tag.dirty { background: #fff0d6; color: #92520a; }
.tag.clean { background: #e0f2fe; color: #075985; }
.tag.inspected { background: #dcf5e4; color: #146c34; }
.tag.out_of_order { background: #3a3f4b; color: #fff; }
.tag.over { background: var(--danger); color: #fff; }

/* ---- calendar ---- */
.cal-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.cal-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 150px); position: relative; }
.cal { position: relative; min-width: max-content; }
.cal .r { display: grid; grid-template-columns: var(--side) repeat(var(--days), var(--cell)); height: var(--rowh); position: relative; }
.cal .r > div { border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); }
.cal .side { position: sticky; left: 0; background: var(--panel); z-index: 5; padding: 0 8px; display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; overflow: hidden; }
.cal .head { position: sticky; top: 0; z-index: 10; height: 44px; background: var(--panel); }
.cal .head > div { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11.5px; color: var(--muted); line-height: 1.2; background: var(--panel); }
.cal .head > div b { color: var(--ink); font-size: 14px; }
.cal .head .side { z-index: 11; }
.cal .d.we { background: var(--weekend); }
.cal .d.today, .cal .head .today { background: var(--today) !important; }
.cal .d.cellbtn { cursor: cell; } .cal .d.cellbtn:hover { background: #e7f5f2 !important; }
.cal .type { height: 30px; background: #f7f8fa; }
.cal .type .side { background: #f7f8fa; font-weight: 700; }
.cal .type .d { display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal .type .d.full { color: var(--danger); } .cal .type .d.low { color: var(--warn); } .cal .type .d.free { color: var(--ok); }
.cal .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.cal .hk { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-left: auto; }
.hk-clean { background: #38bdf8; } .hk-dirty { background: #f59e0b; } .hk-inspected { background: #22c55e; } .hk-out_of_order { background: #374151; }
.cal .side.ooo { color: #9aa1ad; text-decoration: line-through; }
.cal .unas .side { color: var(--warn); font-style: italic; }

.bar { position: absolute; top: 3px; height: calc(var(--rowh) - 7px); border-radius: 6px; padding: 0 7px; font-size: 12px; line-height: calc(var(--rowh) - 7px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; z-index: 3; border: 1px solid transparent; box-shadow: 0 1px 0 rgba(0,0,0,.05); }
.bar.confirmed { background: #dbe8ff; color: #173c80; border-color: #b9cff7; }
.bar.checked_in { background: #1f9d55; color: #fff; }
.bar.checked_out { background: #e6e8ec; color: #6b7280; }
.bar.over { border: 2px dashed var(--danger); }
.bar .src { font-size: 10.5px; opacity: .8; margin-right: 4px; text-transform: uppercase; }
.bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 30px 12px; overflow: auto; }
.modal.on { display: flex; }
.modal .box { background: var(--panel); border-radius: 14px; width: 100%; max-width: 720px; padding: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal .box header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal .box header h3 { margin: 0; font-size: 17px; }
.modal .box header .x { margin-left: auto; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); }
.form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.form input, .form select, .form textarea { width: 100%; }
.form .c2 { grid-column: span 2; } .form .c4 { grid-column: span 4; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line2); }
.err { background: #fdecea; color: #8c2520; padding: 8px 10px; border-radius: 8px; margin-top: 10px; display: none; }
.err.on { display: block; }
.info { background: #eef7f5; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.log { font-size: 12.5px; color: var(--muted); margin-top: 12px; max-height: 140px; overflow: auto; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #1c2230; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 99; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
.toast.on { opacity: 1; }

@media (max-width: 720px) {
  :root { --cell: 40px; --side: 88px; }
  .form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form .c4, .form .c2 { grid-column: span 2; }
  .top .me > span { display: none; }
  main { padding: 10px; }
}

/* ---- กะ / รับเงิน ---- */
.shift-badge { border: 1px solid #2e5a57 !important; border-radius: 99px !important; padding: 5px 12px !important; font-weight: 600; }
.shift-badge.ok { background: #1f6b4a !important; border-color: #2f8a61 !important; }
.shift-badge.warn { background: #b45309 !important; border-color: #d97706 !important; color: #fff !important; }
.paybox { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.paybox h4 { margin: 0 0 6px; font-size: 14px; }
.paybox table.t td { padding: 5px 6px; font-size: 13px; }
.amt-in { color: var(--ok); font-variant-numeric: tabular-nums; }
.amt-out { color: var(--danger); font-variant-numeric: tabular-nums; }
.shift-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.shift-head h2 { margin: 0; }
.close-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; }
.close-grid input { width: 100%; }
.big-diff { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi.small b { font-size: 20px; }

.cal .bed-tag { font-size: 10.5px; color: var(--muted); background: #eef0f4; border-radius: 4px; padding: 0 4px; }

table.income th { white-space: normal; min-width: 70px; font-size: 11.5px; vertical-align: bottom; }
table.income td { white-space: nowrap; }

.form label.chk { display: flex; align-items: center; gap: 8px; align-self: end; padding: 8px 0; font-size: 14px; cursor: pointer; }
.form label.chk input { width: auto; }
.tag.term { background: #fff0d6; color: #92520a; }
.tag.stay { background: #ede9fe; color: #5b21b6; }
label.f > span { color: var(--muted); font-size: 12.5px; }
.form .disc { display: flex; gap: 4px; } .form .disc input { flex: 1; min-width: 0; } .form .disc select { width: 78px; flex: none; }
#fNet { font-weight: 700; }
label.f > span.disc { color: var(--ink); font-size: 14px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 8px 0; }
.seg button { border: 0; background: #fff; padding: 8px 14px; cursor: pointer; border-right: 1px solid var(--line); font-weight: 600; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.pay-amts { align-items: flex-end; }
.pay-amts label.f { width: 150px; }
.pay-amts #pSlipLbl { width: 220px; }
.slip-prev { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.paybox details { margin-top: 10px; font-size: 13.5px; }
.paybox summary { cursor: pointer; color: var(--muted); }
.roompick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; }
.roompick label { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: 13px; background: #fff; }
.roompick label.on { border-color: var(--accent); background: #e7f5f2; }
.roompick input { width: auto; }
.roompick .hint { width: 100%; font-size: 12.5px; color: var(--muted); }
a.slip { font-size: 12.5px; text-decoration: none; }
.ota-by { font-size: 11px; font-weight: 400; color: var(--muted); line-height: 1.3; }
.kpi.click { cursor: pointer; } .kpi.sel { outline: 2px solid var(--accent); }
.seg .seg-credit.on { background: #b45309; } .seg .seg-ota.on { background: #1e4fa8; }
.tag.credit { background: #fff0d6; color: #92520a; } .tag.otac { background: #e0ecff; color: #1e4fa8; }
tr.overdue td { background: #fdecea; }
#semPays input, #semPays select { padding: 4px 6px; font-size: 13px; }
.edit-row { border-bottom: 1px solid var(--line2); padding: 6px 0; }
.edit-row b { color: var(--ink); }
/* ตรวจห้องว่างคงเหลือ */
.avt td { vertical-align: middle; }
.avn { display: flex; gap: 2px; flex-wrap: wrap; max-width: 520px; }
.avn i { font-style: normal; min-width: 22px; text-align: center; font-size: 11.5px; padding: 2px 3px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.avrooms td { background: #f7faf9; }
#availPanel .f input { padding: 6px 8px; }

/* หน้าวันนี้: รายการที่ทำแล้ว (เช็คอิน/เช็คเอาท์แล้ว) จางลง อยู่ล่าง */
#arrivals tr.done, #departures tr.done { opacity: .5; }

/* ยังไม่ชำระ → ไฮไลต์แดง */
tr.unpaid td { background: #fdecec; }
tr.unpaid td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
tr.unpaid:hover td { background: #fbdcdc; }
.tag.unpaid { background: var(--danger); color: #fff; }

/* มัดจำกุญแจ */
.keybox { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 10px 12px; border: 1px dashed #d4a017; background: #fffbea; border-radius: 10px; font-size: 13.5px; }
.keybox .kicon { font-size: 20px; line-height: 1; }
.keybox .kbody { flex: 1; } .keybox .row { margin-top: 6px; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.tag.key { background: #fff3c4; color: #7a5a00; }

.sign-f input { border: 2px solid var(--accent); font-size: 16px; padding: 10px 12px; }

/* ผังห้อง: สีแยกชัด ไม่ซ้อนกัน — สีอ่อน = ยังไม่เช็คอิน · สีเข้ม = เข้าพักอยู่ · เทา = ออกแล้ว */
.bar.ota.confirmed { background: #ede4ff; color: #4c1d95; border-color: #c4b0f3; }
.bar.ota.checked_in { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.bar.ota.checked_out { background: #ece7f6; color: #6b5a91; border-color: #ece7f6; }
.bar.credit.confirmed { background: #ffedcc; color: #7a4300; border-color: #f6cf8a; }
.bar.credit.checked_in { background: #d97706; color: #fff; border-color: #d97706; }
.bar.credit.checked_out { background: #f6eddc; color: #85602a; border-color: #f6eddc; }
.bar.unpaid.confirmed { background: #fecaca; color: #7f1d1d; border-color: #f87171; }
.bar.unpaid.checked_in { background: #dc2626; color: #fff; border-color: #dc2626; }
.bar.unpaid.checked_out { background: #fca5a5; color: #7f1d1d; border-color: #fca5a5; }
.bar.over { border: 2px dashed #111; }
.legend .lg { display: inline-flex; gap: 2px; margin-right: 4px; }
.legend .lg i { margin: 0; }

/* ข้อมูลห้อง (ผังห้อง → กดเลขห้อง) */
.cal .side.click { cursor: pointer; } .cal .side.click:hover { background: #eef6f4; }
.rinfo { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.rinfo h4 { margin: 0 0 6px; font-size: 15px; }
.rinfo.ready { border-color: #86d4a3; background: #f2fbf5; }
.rinfo.repair { border-color: #f5a3a3; background: #fff5f5; }
.rinfo .big { font-size: 16px; font-weight: 600; margin-bottom: 4px; white-space: pre-wrap; }
.rphotos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.rphotos img { width: 140px; height: 105px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.rlog { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.rlog .rphotos img { width: 90px; height: 68px; }

.rlatest { margin-top: 12px; }
.rl-h { font-size: 13.5px; margin-bottom: 6px; }
.rl-img { width: 100%; max-height: 380px; object-fit: contain; background: #111; border-radius: 10px; display: block; }
.rl-ts { margin-top: 4px; font-size: 13px; color: var(--muted); }
.rphotos figure { margin: 0; text-align: center; } .rphotos figcaption { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.ract { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.rbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rbtns button { padding: 12px 8px; border-radius: 10px; border: 0; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
.rbtns button:disabled { opacity: .4; cursor: default; }
.rbtns .b-dirty { background: #fff0d6; color: #92520a; } .rbtns .b-clean { background: #e0f2fe; color: #075985; }
.rbtns .b-insp { background: #dcf5e4; color: #146c34; } .rbtns .b-ooo { background: #3a3f4b; color: #fff; }
.rbtns .b-fix { background: #dcf5e4; color: #146c34; grid-column: 1 / -1; }
.rrepair { margin-top: 10px; display: grid; gap: 8px; }

.daterange { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 2px 8px; background: #fff; }
.daterange input { border: 0; padding: 6px 2px; } .daterange span { color: var(--muted); }

/* หน้าวันนี้: ห้องที่ต้องซ่อม */
#repairs tr.rep td { vertical-align: top; }
#repairs tr.rep:not(.notified) td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
#repairs tr.rep.notified td:first-child { box-shadow: inset 4px 0 0 #d97706; }
.rep-note { font-weight: 600; }
.rep-remark { margin-top: 3px; font-size: 13px; }

/* ห้องที่ต้องซ่อม (คอลัมน์ข้างเข้าพัก/ออกวันนี้) */
.repl { display: flex; flex-direction: column; }
.repi { padding: 10px 0 10px 12px; border-bottom: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--danger); }
.repi.notified { box-shadow: inset 4px 0 0 #d97706; }
.repi .rtop { display: flex; gap: 8px; align-items: baseline; }
.repi .rtop a { font-size: 16px; }
.repi .acts { display: flex; gap: 6px; margin-top: 6px; }

/* มือถือ (iPhone): ช่องวันที่/เวลาไม่ล้นทับกัน */
.form > *, label.f { min-width: 0; }
input[type=date], input[type=time], input[type=datetime-local] {
  min-width: 0; max-width: 100%; box-sizing: border-box;
  -webkit-appearance: none; appearance: none; min-height: 38px; text-align: left;
}
input[type=date]::-webkit-date-and-time-value { text-align: left; margin: 0; }
@media (max-width: 720px) {
  /* ตัวอักษร 16px กัน iPhone ซูมหน้าจอตอนแตะช่องกรอก */
  input, select, textarea { font-size: 16px !important; }
  #availPanel .row > label.f { flex: 1 1 140px; }
  .daterange { flex-wrap: wrap; max-width: 100%; }
  .daterange input { width: 140px; }
}

.zone-bulk { margin: 0 0 10px; padding: 8px 10px; background: #f6f8f7; border-radius: 10px; align-items: center; gap: 8px; flex-wrap: wrap; }

.printbox { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 6px; }
.printbox label.chk { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.pr-steps { margin: 4px 0 8px 18px; padding: 0; font-size: 13px; line-height: 1.7; }
.pr-steps code { background: #f1f3f2; padding: 1px 5px; border-radius: 4px; }

/* สถานะการชำระในหน้าการจอง */
.pstatus { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 12px; border-radius: 8px; margin: 4px 0 10px; font-size: 14px; border: 1px solid; }
.pstatus .ps-h { font-weight: 700; font-size: 15px; }
.pstatus .ps-m { display: inline-block; padding: 2px 9px; border-radius: 99px; background: #fff; border: 1px solid currentColor; font-weight: 600; font-size: 13px; }
.pstatus.paid { background: #e7f7ec; color: #146c34; border-color: #9fd9b1; }
.pstatus.partial { background: #fff6e0; color: #8a5a00; border-color: #f1cf7c; }
.pstatus.unpaid { background: #fdecea; color: #a3322c; border-color: #f2b1ab; }
.pstatus.credit { background: #fff1de; color: #9a4f00; border-color: #f4bf7a; }
.pstatus.ota { background: #f1ebff; color: #5b21b6; border-color: #c9b5f5; }
#pMode button.used { box-shadow: inset 0 -3px 0 #16a34a; font-weight: 700; }
#pMode button.used::after { content: ' ✓'; color: #16a34a; }

/* ศูนย์แจ้งเตือน (กระดิ่งมุมขวาบน) */
.top .me .bell { position: relative; font-size: 17px; padding: 3px 9px; line-height: 1.2; }
.bell-n { position: absolute; top: -6px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: #f59e0b; color: #fff; font-size: 11.5px; font-weight: 700; line-height: 19px; text-align: center; border: 2px solid #102a2a; }
.bell-n.danger { background: #dc2626; }
.bell.ring { animation: bellring .9s ease-in-out 3; }
@keyframes bellring { 0%,100% { transform: rotate(0) } 15% { transform: rotate(16deg) } 30% { transform: rotate(-14deg) } 45% { transform: rotate(10deg) } 60% { transform: rotate(-6deg) } 75% { transform: rotate(3deg) } }
.noti { position: fixed; top: 58px; right: 12px; width: 400px; max-width: calc(100vw - 24px); max-height: calc(100vh - 76px); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(16,42,42,.25); z-index: 60; }
.noti-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.noti-h .muted { font-size: 12px; margin-left: auto; }
.noti-h .x { border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.noti-list { overflow-y: auto; padding: 4px 0 8px; }
.noti-g { padding: 8px 12px 3px; font-size: 12px; font-weight: 700; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.noti-g .n { background: #eef0f4; color: #3d4556; border-radius: 99px; padding: 0 7px; font-size: 11px; }
.noti-i { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 12px 7px 14px; cursor: pointer; border-left: 4px solid transparent; font: inherit; }
.noti-i:hover { background: #f4f7f7; }
.noti-i.danger { border-left-color: #dc2626; } .noti-i.warn { border-left-color: #f59e0b; } .noti-i.info { border-left-color: #94a3b8; }
.noti-i .t { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.noti-i .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.noti-i.danger .s { color: #b42318; }
.noti-i .new { background: #dc2626; color: #fff; border-radius: 99px; padding: 0 6px; font-size: 10.5px; margin-left: 4px; vertical-align: 1px; }
.noti-empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.noti-pop { position: fixed; top: 64px; right: 14px; z-index: 70; max-width: 340px; background: #7f1d1d; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.3); cursor: pointer; font-size: 14px; animation: popin .25s ease-out; }
.noti-pop small { display: block; opacity: .85; font-size: 12px; margin-top: 2px; }
@keyframes popin { from { transform: translateY(-10px); opacity: 0 } }
@media (max-width: 700px) { .noti { top: 54px; right: 0; left: 0; width: auto; max-width: none; border-radius: 0 0 12px 12px; } }
.noti-more { display: block; border: 0; background: none; color: var(--accent, #0f766e); font: inherit; font-size: 12.5px; padding: 4px 18px 6px; cursor: pointer; }

/* หน้าต่างเช็คเอาท์ */
.co-room { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: #102a2a; color: #fff; border-radius: 12px; margin-bottom: 12px; }
.co-room .num { font-size: 34px; font-weight: 800; line-height: 1; }
.co-room .g { font-size: 15px; font-weight: 600; } .co-room .m { font-size: 12.5px; opacity: .8; }
.co-sec { border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-bottom: 10px; }
.co-sec h4 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.co-sec h4 .st { margin-left: auto; font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.co-sec.need { border-color: #f2b1ab; background: #fff7f6; } .co-sec.need h4 .st { background: #fde7e5; color: #a3322c; }
.co-sec.done h4 .st { background: #dcf5e4; color: #146c34; }
.co-sec.ota h4 .st { background: #ede9fe; color: #5b21b6; }
.co-line { display: flex; justify-content: space-between; font-size: 13.5px; padding: 2px 0; }
.co-line.big { font-size: 16px; font-weight: 700; }
.co-sec .seg button { padding: 6px 12px; }
.co-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.co-chips button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.co-chips button.on { background: #fff0d6; border-color: #f1b75a; color: #92520a; font-weight: 600; }
.co-sum { background: #f4f7f7; border-radius: 10px; padding: 10px 13px; font-size: 14px; }
.co-sum b { font-size: 17px; }
.co-n { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #102a2a; color: #fff; font-size: 12.5px; font-weight: 700; flex: none; }

/* มือถือ: หัวเว็บ 2 แถว — แถวบน ชื่อโรงแรม (ตัดด้วย …) + กระดิ่ง/กะ/ออก · แถวล่าง เมนูเลื่อนซ้าย-ขวาได้ */
@media (max-width: 720px) {
  .top { flex-wrap: wrap; height: auto; padding: 6px 10px 0; gap: 6px 8px; }
  .top .brand { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
  .top .me { margin-left: 0; gap: 6px; flex: none; }
  .top .me a { display: none; }
  .top .me .shift-badge { max-width: 140px; overflow: hidden; text-overflow: ellipsis; padding: 4px 9px !important; font-size: 12px; }
  .top .me button { padding: 4px 8px; }
  .top nav { order: 3; flex: 1 0 100%; margin: 0 -10px; padding: 2px 6px 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .top nav::-webkit-scrollbar { display: none; }
  .top nav button { padding: 7px 11px; font-size: 14px; }
  .top nav .nav-hk { display: inline-block; }
}
.top nav .nav-hk { display: none; color: #a9c7c2; padding: 7px 11px; white-space: nowrap; text-decoration: none; font-size: 14px; }
@media (max-width: 720px) { .top nav .nav-hk { display: inline-block; } }

/* ย้ายห้อง */
.mv-g { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 10px 0 5px; }
.mv-rooms { display: flex; flex-wrap: wrap; gap: 6px; }
.mv-rooms button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; cursor: pointer; min-width: 64px; text-align: left; }
.mv-rooms button b { display: block; font-size: 15px; }
.mv-rooms button small { font-size: 11px; color: var(--muted); }
.mv-rooms button.dirty b::after { content: ' •'; color: #d97706; }
.mv-rooms button.on { background: var(--accent); border-color: var(--accent); color: #fff; } .mv-rooms button.on small { color: #e6f4f1; }

.noti-row { position: relative; }
.noti-row .noti-i { padding-right: 38px; }
.noti-x { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; border: 0; background: transparent; color: #94a3b8; font-size: 18px; line-height: 26px; cursor: pointer; z-index: 1; }
.noti-x:hover { background: #fde7e5; color: #b42318; }
#notiClear { font-size: 12px; padding: 3px 9px; }
.noti-gx { margin-left: auto; border: 0; background: none; color: #94a3b8; font: inherit; font-size: 11.5px; cursor: pointer; padding: 0 4px; } .noti-gx:hover { color: #b42318; text-decoration: underline; }

/* ================= Modern minimal theme (override layer) ================= */
:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #18202b; --muted: #7a8494; --line: #e8ebf0; --line2: #f1f3f6;
  --accent: #0d9488; --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.05);
}
html, body { font-size: 14.5px; -webkit-font-smoothing: antialiased; }
/* top bar: white, light, pill navigation */
.top { background: rgba(255,255,255,.88); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  color: var(--ink); border-bottom: 1px solid var(--line); height: 58px; }
.top .brand { color: var(--ink); letter-spacing: .2px; }
.top .brand::before { content: "●"; color: var(--accent); margin-right: 8px; font-size: 11px; vertical-align: 2px; }
.top nav { gap: 4px; }
.top nav button { color: var(--muted); border-radius: 999px; padding: 7px 14px; font-weight: 500; transition: background .15s, color .15s; }
.top nav button:hover { background: var(--line2); color: var(--ink); }
.top nav button.on { background: var(--ink); color: #fff; }
.top .me { color: var(--muted); }
.top .me a, .top .me button { color: var(--ink); border: 1px solid var(--line); border-radius: 999px; background: #fff; transition: background .15s; }
.top .me a:hover, .top .me button:hover { background: var(--line2); }
main { padding: 22px 20px 40px; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -.1px; }
/* cards */
.panel, .kpi, .paybox, .rinfo, .keybox { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 18px; }
.kpis { gap: 12px; }
.kpi { padding: 14px 16px; background: var(--panel); }
.kpi b { font-weight: 700; letter-spacing: -.3px; }
.kpi span { color: var(--muted); }
/* buttons */
.btn { border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 500; padding: 8px 14px; box-shadow: 0 1px 1px rgba(16,24,40,.03); transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; }
.btn:hover { background: var(--line2); border-color: #d9dee6; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(13,148,136,.28); }
.btn.primary:hover { background: #0b7f75; border-color: #0b7f75; }
.btn.danger { border-radius: 10px; }
/* inputs */
input, select, textarea { border-radius: 10px; border-color: var(--line); background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13,148,136,.14); outline: none; }
label.f > span { color: var(--muted); font-weight: 500; }
/* tables: airy, no heavy lines */
table.t th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: none; letter-spacing: .2px; background: transparent; }
table.t th, table.t td { border-color: var(--line2); padding-top: 9px; padding-bottom: 9px; }
table.t tr.click:hover, table.t tbody tr:hover td { background: #fafbfc; }
/* tags -> soft pills */
.tag { border-radius: 999px; padding: 2px 10px; font-weight: 600; font-size: 12px; }
/* segmented controls */
.seg { border-radius: 10px; overflow: hidden; border-color: var(--line); }
.seg button { transition: background .15s; }
/* modal */
.modal { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal .box { border-radius: 18px; box-shadow: 0 24px 64px rgba(16,24,40,.25); border: 0; }
.modal .box header { border-bottom: 1px solid var(--line2); }
/* toast, notification, badges */
.toast { border-radius: 12px; box-shadow: 0 10px 30px rgba(16,24,40,.25); }
.noti, .noti-pop { border-radius: 14px; box-shadow: 0 16px 48px rgba(16,24,40,.2); border-color: var(--line); }
.shift-badge { border-radius: 999px; }
.info { border-radius: 12px; }
.err { border-radius: 10px; }
/* calendar frame (cell sizes untouched) */
.cal-wrap { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: auto; }
.bar { border-radius: 8px; }
/* subtle scrollbars */
* { scrollbar-width: thin; scrollbar-color: #cfd5de transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: #cfd5de; border-radius: 8px; }
@media (max-width: 720px) { main { padding: 14px 10px 32px; } .panel { padding: 14px; } .top { height: 54px; } }

/* ---- dashboard refinements (หน้าวันนี้) ---- */
#kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
#kpis .kpi { position: relative; padding: 16px 18px 14px; overflow: hidden; }
#kpis .kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, #cfe9e6); }
#kpis .kpi:nth-child(1) { --c: #0d9488; } #kpis .kpi:nth-child(2) { --c: #3b82f6; } #kpis .kpi:nth-child(3) { --c: #8b5cf6; }
#kpis .kpi:nth-child(4) { --c: #14b8a6; } #kpis .kpi:nth-child(5) { --c: #f59e0b; } #kpis .kpi:nth-child(6) { --c: #ef4444; }
#kpis .kpi b { font-size: 30px; line-height: 1.1; }
#kpis .kpi span { display: block; margin-top: 4px; font-size: 13px; }
.kpi.alert { background: #fff7ed; border-color: #fed7aa; }
/* room number chips + calmer list rows */
#arrivals td.fit:first-child b, #departures td.fit:first-child b { display: inline-block; min-width: 46px; text-align: center; padding: 6px 8px; border-radius: 10px; background: var(--line2); font-size: 15px; }
#arrivals table.t td, #departures table.t td { padding-top: 12px; padding-bottom: 12px; }
#arrivals tr.done, #departures tr.done { opacity: .5; }
.btn.sm { padding: 5px 11px; border-radius: 8px; font-size: 13px; }
.btn.ok { background: #ecfdf5; border-color: #a7f3d0; color: #047857; font-weight: 600; }
.btn.ok:hover { background: #d1fae5; }
.btn:disabled { background: transparent; border-color: var(--line2); color: #aab2bf; box-shadow: none; }
/* availability panel */
#availPanel { background: linear-gradient(180deg, #fff, #fbfdfd); }
#availPanel h3 { font-size: 16px; }
.panel > h3, .panel .row > h3 { font-size: 15.5px; font-weight: 700; }
/* repair cards */
.repi { border-radius: 12px; }
@media (max-width: 720px) { #kpis { grid-template-columns: repeat(2, 1fr); } #kpis .kpi b { font-size: 26px; } }

/* ---- refinement pass: dashboard ---- */
.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { position: relative; overflow: hidden; padding: 16px 18px; }
.kpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); opacity: .85; }
.kpi:nth-child(2)::before { background: #3b82f6; } .kpi:nth-child(3)::before { background: #8b5cf6; }
.kpi:nth-child(4)::before { background: #f59e0b; } .kpi:nth-child(5)::before { background: #94a3b8; } .kpi:nth-child(6)::before { background: #ef4444; }
.kpi b { font-size: 28px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; margin-top: 2px; display: block; }
.panel h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -.1px; }
.panel h3 + * { margin-top: 2px; }
#availPanel { padding: 20px; }
#availPanel .btn.sm { border-radius: 999px; padding: 6px 14px; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
table.t td.fit { white-space: nowrap; }
.tag { letter-spacing: 0; }
.top nav button { font-size: 14px; }
main { max-width: 1480px; }

/* ---- shift badge: อ่านง่าย (พื้นอ่อน ตัวอักษรเข้ม) ---- */
.top .me .shift-badge { font-weight: 600; }
.top .me .shift-badge.ok { background: #e7f6ee !important; color: #0b6b43 !important; border-color: #b7e2cb !important; }
.top .me .shift-badge.warn { background: #fff3df !important; color: #9a4f00 !important; border-color: #f3d29a !important; }
.top .me .shift-badge.ok::before, .top .me .shift-badge.warn::before { content: "●"; font-size: 9px; margin-right: 6px; vertical-align: 1px; }

/* ================= มือถือ (≤720px): ใช้งานง่ายขึ้น ================= */
@media (max-width: 720px) {
  html, body { font-size: 15px; }
  /* แถบบน 2 แถว: ชื่อ+ปุ่มขวา / เมนูเลื่อนข้าง */
  .top { height: auto; min-height: 0; flex-wrap: wrap; padding: 8px 12px 0; gap: 6px 8px; align-items: center; }
  .top .brand { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
  .top .me { margin-left: 0; gap: 6px; flex: none; }
  .top nav { order: 3; flex: 1 0 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 2px 0 8px; gap: 4px; scrollbar-width: none; }
  .top nav::-webkit-scrollbar { display: none; }
  .top nav button, .top nav a { flex: none; padding: 8px 14px; font-size: 14px; white-space: nowrap; }
  .noti { top: 104px; }
  main { padding: 12px 12px 110px; }
  h2 { font-size: 18px; }
  /* ปุ่ม/ช่องกรอกกดง่าย (16px กัน iOS ซูมเอง) */
  .btn { min-height: 40px; }
  .btn.sm { min-height: 36px; padding: 6px 12px; }
  input, select, textarea { font-size: 16px; min-height: 42px; }
  /* การ์ดตัวเลข กะทัดรัด */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px 10px 14px; }
  .kpi b { font-size: 24px; }
  .kpi span { font-size: 12.5px; }
  .panel { padding: 14px; border-radius: 14px; overflow-x: auto; }
  /* ตรวจห้องว่าง: แถวละการ์ด */
  .avt, .avt tbody { display: block; width: 100%; }
  .avt tr:first-child { display: none; }
  .avt tr.click { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; background: #fff; }
  .avt tr.click td { display: block; padding: 0; border: 0; text-align: left; }
  .avt tr.click td:first-child { flex: 1 0 100%; font-size: 15.5px; }
  .avt tr.click td:nth-child(n+2):not(:last-child)::before { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
  .avt tr.click td:nth-child(2)::before { content: "ว่าง (ขายได้)"; }
  .avt tr.click td:nth-child(3)::before { content: "ทั้งหมด"; }
  .avt tr.click td:nth-child(4)::before { content: "เตียง"; }
  .avt:not(.multi) tr.click td:nth-child(5)::before { content: "ราคา"; }
  .avt.multi tr.click td:nth-child(5)::before { content: "ว่างรายคืน"; }
  .avt.multi tr.click td:nth-child(6)::before { content: "ราคา"; }
  .avt tr.click td:last-child { margin-left: auto; }
  .avt tr.click td:last-child .btn { min-height: 44px; min-width: 76px; }
  /* ตารางทั่วไปเลื่อนข้างได้ ไม่ตัดคำจนอ่านยาก */
  table.t { font-size: 13.5px; }
  /* กรอบขาวเลื่อนในตัวเอง — ช่องที่ยาวเกินจอไม่ล้นออกไปบนพื้นเทา */
  .modal .box { border-radius: 18px 18px 0 0; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .modal .box header { position: sticky; top: -18px; z-index: 2; background: var(--panel); margin: -18px -18px 14px; padding: 14px 18px 10px; }
}

/* ===== หน้าตั้งค่า: การ์ดเท่ากัน 2 คอลัมน์ ===== */
.sgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 16px; }
.sgrid > .panel, .sgrid > .panel:first-child { order: 0; display: flex; flex-direction: column; min-width: 0; }
.sgrid > .panel.span-all { grid-column: 1 / -1; }
.sgrid > .panel > h3 { margin: 0 0 12px; }
.set-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.set-form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.set-form .full { grid-column: 1 / -1; }
.set-form label.f { min-width: 0; }
.set-form input:not([type=checkbox]):not([type=radio]), .set-form select, .set-form textarea { width: 100%; }
.sgrid .printbox { margin-top: 10px; }
.sgrid .printbox select, .sgrid .printbox input:not([type=checkbox]):not([type=radio]) { width: 100%; }
.user-add { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: auto; padding-top: 12px; }
.user-add input, .user-add select { width: 100%; min-width: 0; }
.user-add .btn { grid-column: 1 / -1; }
.save-bar { flex-direction: row !important; align-items: center; gap: 14px; }
.save-bar .btn { min-width: 160px; }
@media (max-width: 900px) {
  .sgrid { grid-template-columns: 1fr; }
  .set-form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .set-form, .user-add { grid-template-columns: 1fr; }
  .set-form.three { grid-template-columns: 1fr; }
  .save-bar { flex-wrap: wrap; }
  .save-bar .btn { width: 100%; }
}

/* กันตารางผู้ใช้ล้นการ์ด + ให้ปุ่มขึ้นบรรทัดใหม่ได้ */
.sgrid > .panel { overflow-x: auto; }
#userTable { width: 100%; }
#userTable td:last-child { white-space: normal; text-align: right; }
#userTable td:last-child .btn { margin: 2px 0 2px 4px; }
@media (min-width: 1700px) { main:has(#v-settings.on) { max-width: 1680px; } }
.info.warn-box { background: #fff7e6; border: 1px solid #f5c26b; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 10px; }
.choice { border: 1px solid #d8e2df; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.choice h3 { margin: 0 0 4px; }
.choice p { font-size: 13px; margin: 0 0 10px; flex: 1; }

/* ---------- ช่องกรอกสูงเท่ากันทุกช่อง (Safari/iPad วาด select เตี้ยกว่า input) ---------- */
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]):not([type=range]), select {
  height: 38px; min-height: 38px; box-sizing: border-box; line-height: normal;
}
select {
  -webkit-appearance: none; appearance: none; padding-right: 30px; cursor: pointer;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
}
select:disabled { opacity: .6; cursor: default; }
input[readonly] { background: #f6f8f7; }
/* ช่องเล็ก/พิเศษ คงขนาดเดิม */
#semPays input, #semPays select { height: 32px; min-height: 32px; }
.daterange input { height: 32px; min-height: 32px; }
.sign-f input { height: 46px; }
/* เช็คบ็อกซ์ในฟอร์ม: ให้อยู่แนวเดียวกับช่องกรอก */
.form label.chk { height: 38px; padding: 0; }
@media (max-width: 720px) {
  input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]):not([type=range]), select { height: 42px; min-height: 42px; }
  .form label.chk { height: 42px; }
  .sign-f input { height: 48px; }
}

/* ---------- แถบเมนู: ค้างไว้ด้านบนเสมอ + แสดงทุกเมนู (ไม่ต้องเลื่อนซ้าย-ขวาหา) ---------- */
.top { position: sticky; top: 0; z-index: 40; height: auto; min-height: 58px; flex-wrap: wrap; row-gap: 4px; padding-top: 6px; padding-bottom: 6px; }
.top .brand { flex: 0 1 auto; max-width: 280px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.top nav { flex-wrap: wrap; overflow: visible; row-gap: 4px; }
.top nav button, .top nav a { flex: none; }
@media (max-width: 720px) {
  .top { padding: 8px 10px 6px; }
  .top .brand { flex: 1 1 0; max-width: none; }
  .top nav { order: 3; flex: 1 0 100%; margin: 0; padding: 2px 0 2px; overflow: visible; flex-wrap: wrap; gap: 4px; }
  .top nav button, .top nav a { padding: 6px 11px; font-size: 13.5px; }
}

/* ปุ่ม "กู้คืนที่ลบ" บนแถบด้านบน */
.top .me .trash-btn { position: relative; white-space: nowrap; }
.trash-n { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: #64748b; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; vertical-align: 1px; }
@media (max-width: 720px) { .top .me .trash-btn { font-size: 12px; padding: 4px 8px; } }

/* หน้าวันนี้: แถวละ 3 กล่อง (เข้าพัก · เช็คเอาท์ · ห้องซ่อม) กล่องที่เหลือขึ้นแถวถัดไป */
.today-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .today-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .today-grid { grid-template-columns: 1fr; } }

/* ตัวช่วยนับแบงค์ตอนปิดกะ */
.cash-counter { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: #fbfcfc; }
.cc-head { font-weight: 600; margin-bottom: 8px; } .cc-head .muted { font-weight: 400; font-size: 12.5px; }
.cc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cc-cell { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.cc-cell span { white-space: nowrap; min-width: 54px; text-align: right; color: var(--muted); }
.cc-cell input { width: 100%; min-width: 0; }
.cc-cell.coins { grid-column: span 2; }
.cc-cell.coins span { min-width: auto; }
@media (max-width: 720px) { .cc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cc-cell.coins { grid-column: span 2; } }

/* ตัวช่วยนับแบงค์: ตาราง 3 × 2 เรียงเป็นระเบียบ */
.cash-counter .cc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 14px; }
.cash-counter .cc-cell { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; gap: 6px; font-size: 13.5px; }
.cash-counter .cc-cell span { text-align: right; color: var(--muted); white-space: nowrap; }
.cash-counter .cc-cell input { width: 100%; text-align: right; }
.cash-counter .cc-cell.coins { grid-column: auto; }
@media (max-width: 720px) { .cash-counter .cc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* ช่องที่ระบบคำนวณให้ (แก้ไม่ได้) */
input.calc-out, input.calc-out:disabled { background: #eef2f1; color: var(--ink); font-weight: 700; -webkit-text-fill-color: var(--ink); opacity: 1; cursor: not-allowed; border-style: dashed; }

/* ---- การเงินประจำวัน ---- */
.money-bar { flex-wrap: wrap; gap: 8px; align-items: center; }
.money-bar input[type=date] { width: auto; }
#dayHist tr.sel td { background: #eef6f4; font-weight: 600; }

/* ---- จองออนไลน์ (หน้าการจอง) ---- */
.onlinebox { border: 2px solid #0ea5e9; background: #f0f9ff; border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.onlinebox .ol-h { font-size: 14px; margin-bottom: 6px; }
.onlinebox .ol-b { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.onlinebox .ol-slip { width: 120px; max-height: 200px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ---- รูปห้อง ---- */
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }
.ph-grid figure { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.ph-grid img { width: 100%; height: 130px; object-fit: cover; display: block; background: #f1f3f6; }
.ph-grid figcaption { padding: 6px 8px; display: flex; gap: 6px; align-items: center; justify-content: space-between; }

.olqr img { width: 120px; height: 120px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.olqr > span { font-size: 13px; color: var(--muted); }

/* ---- จองออนไลน์ รอดำเนินการ (หน้าวันนี้) ---- */
.online-today { border: 2px solid #0ea5e9; background: #f5fbff; margin-bottom: 14px; }
.ol-card { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-top: 8px; cursor: pointer; }
.ol-card:hover { border-color: #0ea5e9; }
.ol-card.slip { border: 2px solid var(--danger); }
.ol-card img, .ol-card .ol-noslip { width: 56px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.ol-card .ol-noslip { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 11px; color: var(--muted); background: #f6f8f7; }
.ol-card .ol-main { flex: 1; min-width: 0; line-height: 1.6; }
.ol-card .ol-main .muted { font-size: 13px; }
.ol-card .ol-amt { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; white-space: nowrap; }
.ol-card .ol-amt b { font-size: 18px; }
.tag.danger-tag { background: #fde8e8; color: var(--danger); font-weight: 700; }
.noti-pop.online { background: #0369a1; }
@media (max-width: 720px) { .ol-card { flex-wrap: wrap; } .ol-card .ol-amt { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; } }

/* ---------- แถบบนจอคอม: บีบให้อยู่แถวเดียว (ไม่หนาเป็น 2 แถว) ---------- */
@media (min-width: 721px) {
  .top { flex-wrap: nowrap; min-height: 54px; gap: 10px; padding: 6px 14px; }
  .top .brand { flex: 0 1 auto; max-width: 260px; min-width: 70px; }
  .top nav { flex: 0 1 auto; flex-wrap: nowrap; gap: 2px; min-width: 0; }
  .top nav button { padding: 7px 11px; }
  .top .me { flex: none; gap: 6px; }
  .top .me a, .top .me button { padding: 5px 10px; }
}
/* จอไม่กว้างมาก: ย่อชื่อบริษัท ซ่อนชื่อผู้ใช้ และเหลือแค่ไอคอน ↩ ของปุ่มกู้คืน (ชี้ค้างดูคำอธิบายได้) */
@media (min-width: 721px) and (max-width: 1700px) {
  .top .brand { max-width: 240px; }
  .top .me > #me { display: none; }
}
@media (min-width: 721px) and (max-width: 1500px) {
  .top .brand { max-width: 200px; }
  .top .me .trash-btn .tl, .top .me a .tl { display: none; }   /* เหลือแค่ 🗑 กับ 🧹 */
}
@media (min-width: 721px) and (max-width: 1360px) {
  .top { gap: 6px; padding: 6px 10px; }
  .top .brand { max-width: 130px; font-size: 14px; }
  .top nav button { padding: 6px 8px; font-size: 13.5px; }
  .top .me a, .top .me button { padding: 5px 8px; font-size: 12.5px; }
}
@media (min-width: 721px) and (max-width: 1100px) {
  .top { flex-wrap: wrap; }   /* แท็บเล็ตแนวตั้ง: ยอมขึ้น 2 แถวแทนการซ่อนเมนู */
}

/* วงกลมตัวอักษรแรกของชื่อผู้ใช้ — โชว์ตอนย่อหน้าต่าง (จอกว้างแสดงชื่อเต็มแทน) */
.top .me > .me-av { display: none; width: 30px; height: 30px; flex: none; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; line-height: 1; cursor: default; }
@media (max-width: 720px) { .top .me > .me-av { display: inline-flex; width: 26px; height: 26px; font-size: 12.5px; } }
@media (min-width: 721px) and (max-width: 1700px) { .top .me > .me-av { display: inline-flex; } }
.tag.dep{background:#fff4d6;color:#8a5a00;border:1px solid #f1d48a}
.seg .seg-dep.on{background:#a16207}
