/* ==========================================================
   Toilet Cleaning Checklist — B.Grimm Airconditioning
   Corporate palette from the B.Grimm logo: orange #FF6727 + grey #63666F on white.
   Housekeeper screens: full-screen, one question per screen, big touch targets.
   ========================================================== */
:root {
  --orange: #ff6727;
  --orange-d: #e5531a;
  --orange-soft: #fff1e9;
  --grey: #63666f;
  --grey-2: #97989f;
  --ink: #2b2d33;
  --ink-2: #63666f;
  --ink-3: #97989f;
  --line: #e2e3e7;
  --line-2: #f0f1f3;
  --bg: #f6f6f7;
  --white: #ffffff;
  --ok: #1f9d57;
  --ok-soft: #e7f6ed;
  --warn: #d99100;
  --warn-soft: #fff6dd;
  --bad: #d6383f;
  --bad-soft: #fdecec;
  --pad: clamp(16px, 3vw, 40px);
  --font: "IBM Plex Sans Thai Looped", "Noto Sans Thai Looped", "Leelawadee UI", Tahoma, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 16px; line-height: 1.6; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
}
a { color: var(--orange-d); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; color: var(--ink); }
h1 { font-size: clamp(1.5rem, 3.2vw, 2rem); font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
code { background: var(--line-2); padding: 1px 6px; border-radius: 5px; font-size: .88em; word-break: break-all; }
.ic { flex: none; vertical-align: -3px; }
.main { flex: 1; width: 100%; padding: 24px var(--pad) 40px; }
.muted { color: var(--ink-2); }
.tiny { font-size: .82rem; margin: 12px 0 0; }
.nowrap { white-space: nowrap; }
.t-ok { color: var(--ok) !important; }
.t-warn { color: var(--warn) !important; }
.t-bad { color: var(--bad) !important; }
.eyebrow { margin: 0 0 2px; color: var(--ink-3); font-size: .9rem; }
.stack { display: grid; gap: 18px; align-content: start; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* ---------- Top bar (white, corporate) ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--white); border-top: 4px solid var(--orange); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 18px; height: 68px; padding: 0 var(--pad); }
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { height: 44px; min-width: 44px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--orange); color: #fff; }
.brand-mark.has-logo { background: none; min-width: 0; }
.brand-mark img { height: 44px; width: auto; max-width: 170px; object-fit: contain; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; padding-left: 14px; border-left: 1px solid var(--line); }
.brand-text strong { font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--ink-2); font-size: .82rem; }
.mainnav { margin-left: auto; display: flex; gap: 4px; }
.mainnav a {
  display: flex; align-items: center; gap: 7px; color: var(--ink-2); padding: 0 14px; height: 64px;
  font-weight: 500; font-size: .95rem; border-bottom: 3px solid transparent;
}
.mainnav a:hover { color: var(--ink); text-decoration: none; }
.mainnav a.on { color: var(--orange-d); border-bottom-color: var(--orange); font-weight: 600; }
.mainnav .nav-maid { color: var(--orange-d); }
.boss-link { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: .85rem; padding: 8px 10px; border-radius: 8px; }
.boss-link:hover { background: var(--line-2); text-decoration: none; color: var(--ink-2); }
.print-head { display: none; }

@media (max-width: 900px) {
  .office .mainnav {
    position: fixed; bottom: 0; left: 0; right: 0; margin: 0; z-index: 40; justify-content: space-around;
    background: var(--white); border-top: 1px solid var(--line); padding: 0 4px env(safe-area-inset-bottom);
  }
  .office .mainnav a { flex-direction: column; gap: 0; height: 62px; padding: 0 6px; font-size: .74rem; justify-content: center; border-bottom: 0; border-top: 3px solid transparent; }
  .office .mainnav a.on { border-top-color: var(--orange); }
  .office .main { padding-bottom: 96px; }
  .office .foot { padding-bottom: 80px; }
}
@media (max-width: 600px) {
  .topbar-in { height: 60px; gap: 10px; }
  .brand { gap: 10px; }
  .brand-mark img { height: 34px; max-width: 110px; }
  .brand-text { padding-left: 10px; }
  .brand-text strong { font-size: .86rem; }
  .brand-text small { font-size: .74rem; }
  .boss-link span { display: none; }
}

/* ---------- Generic panels ---------- */
.card, .panel { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.card-h { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.card-h h2 { display: flex; gap: 8px; align-items: center; }
.card-h h2 .ic { color: var(--orange); }
.page-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-sub { margin: 4px 0 0; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; gap: 4px; align-items: center; font-size: .9rem; margin-bottom: 6px; color: var(--ink-2); }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); display: grid; justify-items: center; gap: 8px; }
.empty-sm { color: var(--ink-2); margin: 4px 0; }

/* ---------- Buttons ---------- */
.btn {
  --bh: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--bh); padding: 0 18px;
  border-radius: 8px; border: 1.5px solid transparent; font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer;
  white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-d); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--grey-2); }
.btn-danger { background: var(--bad-soft); color: var(--bad); border-color: #f4c6c8; }
.btn-sm { --bh: 36px; padding: 0 12px; font-size: .87rem; }
.btn-lg { --bh: 54px; padding: 0 26px; font-size: 1.05rem; }
.btn-icon { width: var(--bh); padding: 0; }
.btn-block { width: 100%; }
.push { margin-left: auto; }

/* ---------- Form controls ---------- */
input[type=text], input[type=password], input[type=url], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-width: 0; max-width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line);
  border-radius: 8px; padding: 10px 13px; min-height: 48px; appearance: none; -webkit-appearance: none;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 103, 39, .18); }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2363666f' stroke-width='2.2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 42px;
}
input[type=file] { font: inherit; max-width: 100%; }
.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span { font-size: .88rem; color: var(--ink-2); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > * { min-width: 0; }
.grid-2 .field { margin-bottom: 0; }
.hint { font-size: .86rem; color: var(--ink-3); margin: 8px 0 0; }
.hint:empty { display: none; }
.field-err { display: none; color: var(--bad); font-size: .9rem; font-weight: 600; margin: 8px 0 0; }
.field-err.show { display: block; }
.warn-box {
  display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); color: #6e4b00;
  border-left: 4px solid var(--warn); border-radius: 6px; padding: 11px 14px; font-size: .92rem; margin: 14px 0 0;
}
.warn-box[hidden] { display: none; }
.page-h + .warn-box, .warn-box:first-child { margin: 0 0 18px; }

/* ==========================================================
   HOUSEKEEPER WIZARD — full screen
   ========================================================== */
.kiosk .main { padding: 0; display: flex; flex-direction: column; }
.wizard { flex: 1; display: flex; flex-direction: column; }
.wz-top {
  background: var(--white); border-bottom: 1px solid var(--line); padding: 14px var(--pad);
  display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap;
}
.wz-room { display: flex; align-items: center; gap: 8px; font-size: clamp(1.15rem, 3vw, 1.45rem); font-weight: 700; color: var(--ink); }
.wz-room .ic { color: var(--orange); }
.wz-room[hidden] { display: none; }
.wz-steps { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; gap: 6px; counter-reset: none; }
.wz-steps li { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: .88rem; }
.wz-steps li + li::before { content: ""; width: 18px; height: 2px; background: var(--line); margin-right: 2px; }
.wz-steps b {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .9rem;
  border: 2px solid var(--line); background: #fff; color: var(--ink-3);
}
.wz-steps li.on { color: var(--ink); font-weight: 600; }
.wz-steps li.on b { border-color: var(--orange); background: var(--orange); color: #fff; }
.wz-steps li.done b { border-color: var(--ok); background: var(--ok); color: #fff; }
@media (max-width: 760px) {
  .wz-steps { margin: 0; width: 100%; justify-content: space-between; }
  .wz-steps li span { display: none; }
  .wz-steps li.on span { display: inline; }
  .wz-steps li + li::before { width: 10px; }
}
.wz-alert { margin: 16px var(--pad) 0; padding: 12px 16px; background: var(--bad-soft); color: var(--bad); border-radius: 10px; font-weight: 600; display: flex; gap: 8px; align-items: center; }

.step { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px var(--pad) 24px; }
.step[hidden] { display: none; }
.q { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 700; line-height: 1.2; }
.q-sub { font-size: clamp(1.05rem, 2.4vw, 1.25rem); color: var(--ink-2); margin: 6px 0 22px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.step-err { display: none; margin: 18px 0 0; padding: 14px 18px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 1.1rem; font-weight: 600; }
.step-err.show { display: block; }

/* big pick cards (people / rooms) */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pick { position: relative; display: block; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick > span {
  display: flex; align-items: center; gap: 16px; min-height: 88px; padding: 14px 18px; background: #fff;
  border: 2px solid var(--line); border-radius: 16px; cursor: pointer; font-size: 1.25rem; font-weight: 600; line-height: 1.3;
  transition: border-color .12s, background .12s;
}
.pick > span:hover { border-color: var(--grey-2); }
.pick em { font-style: normal; flex: 1; }
.num {
  width: 56px; height: 56px; flex: none; display: grid; place-items: center; font-weight: 700;
  border-radius: 12px; background: var(--line-2); color: var(--grey); font-size: 1.2rem;
}
.tick {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 2px solid var(--line); color: transparent;
}
.pick input:checked + span { border-color: var(--orange); background: var(--orange-soft); }
.pick input:checked + span .tick { background: var(--orange); border-color: var(--orange); color: #fff; }
.pick input:checked + span .num { background: var(--orange); color: #fff; }
.pick input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 3px; }
.pick.remembered::after { content: "ครั้งก่อน"; position: absolute; top: -10px; left: 18px; background: var(--grey); color: #fff; font-size: .78rem; padding: 0 10px; border-radius: 99px; }
.rooms .pick > span { min-height: 80px; font-size: 1.15rem; }

/* tasks */
.count-pill { background: var(--ink); color: #fff; border-radius: 99px; padding: 2px 14px; font-size: 1rem; font-weight: 600; }
.count-pill b { font-size: 1.15rem; }
.all-btn {
  width: 100%; min-height: 72px; display: flex; align-items: center; justify-content: center; gap: 12px;
  border-radius: 16px; border: 2.5px solid var(--ok); background: #fff; color: var(--ok); font: inherit; font-size: 1.35rem; font-weight: 700;
  cursor: pointer; margin-bottom: 16px;
}
.all-btn.on { background: var(--ok); color: #fff; }
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.task { position: relative; display: block; }
.task input { position: absolute; opacity: 0; pointer-events: none; }
.task > span {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px;
  min-height: 150px; padding: 18px 12px 16px; background: #fff; border: 2px solid var(--line); border-radius: 16px; cursor: pointer;
  font-size: 1.1rem; font-weight: 600; line-height: 1.3; transition: border-color .12s, background .12s;
}
.task > span:hover { border-color: var(--grey-2); }
.task em { font-style: normal; }
.item-ic { color: var(--grey); width: 52px; height: 52px; }
.task .tick { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; }
.task input:checked + span { border-color: var(--ok); background: var(--ok-soft); }
.task input:checked + span .item-ic { color: var(--ok); }
.task input:checked + span .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.task input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 3px; }
@media (max-width: 600px) {
  .pick-grid { grid-template-columns: 1fr; }
  .task-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .task > span { min-height: 132px; font-size: 1rem; padding: 16px 8px 12px; }
  .item-ic { width: 44px; height: 44px; }
}
.note-box { margin-top: 22px; display: grid; gap: 8px; }
.note-box label { font-size: 1.1rem; font-weight: 600; color: var(--ink-2); }
.note-box textarea { font-size: 1.1rem; border-width: 2px; border-radius: 12px; }
.note-box.need label { color: var(--bad); }
.note-box.need textarea { border-color: var(--bad); background: #fffafa; }

/* camera */
.cam-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 260px; border: 3px dashed var(--orange); border-radius: 20px; background: var(--orange-soft);
  color: var(--orange-d); font-size: 1.5rem; font-weight: 700; cursor: pointer; text-align: center; padding: 20px;
}
.cam-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cam-btn.has { min-height: 110px; flex-direction: row; font-size: 1.2rem; }
.cam-btn.has .ic { width: 36px; height: 36px; }
.cam-btn[hidden] { display: none; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: var(--line-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.loading { background: linear-gradient(100deg, var(--line-2) 30%, #fff 50%, var(--line-2) 70%) 0 0 / 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.photo-del {
  position: absolute; left: 8px; bottom: 8px; border: 0; border-radius: 99px; padding: 6px 14px; cursor: pointer;
  background: rgba(43, 45, 51, .82); color: #fff; font: inherit; font-size: .92rem; font-weight: 600;
}

/* summary */
.summary { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 4px 22px; }
.summary > div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.summary > div:last-child { border-bottom: 0; }
.summary dt { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 1.05rem; }
.summary dt .ic { color: var(--orange); }
.summary dd { margin: 0; font-size: 1.25rem; font-weight: 700; }
.summary .ok { color: var(--ok); }
.summary .warn { color: var(--warn); }
@media (max-width: 600px) { .summary > div { grid-template-columns: 1fr; gap: 4px; } }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: grid; text-align: center; padding: 10px 6px; border-radius: 12px; border: 2px solid var(--line); cursor: pointer; background: #fff; }
.seg-opt strong { font-size: 1.15rem; }
.seg-opt small { color: var(--ink-3); font-size: .82rem; font-weight: 500; }
.seg-opt input:checked + span { border-color: var(--orange); background: var(--orange); color: #fff; }
.seg-opt input:checked + span small { color: #ffe2d4; }
.seg-opt input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 2px; }
.wz-warn { margin: 16px 0 0; padding: 12px 16px; border-radius: 10px; background: var(--warn-soft); color: #6e4b00; font-weight: 500; }
.wz-warn[hidden] { display: none; }

/* bottom action bar */
.wz-bar {
  position: sticky; bottom: 0; z-index: 20; display: flex; gap: 12px; padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(43, 45, 51, .06);
}
.wz-back, .wz-next {
  height: 68px; border-radius: 16px; font: inherit; font-size: 1.3rem; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid transparent;
}
.wz-back { flex: 0 0 auto; padding: 0 22px; background: #fff; color: var(--ink-2); border-color: var(--line); }
.wz-next { flex: 1; background: var(--orange); color: #fff; }
.wz-next:hover { background: var(--orange-d); }
.wz-next[hidden], .wz-back[hidden] { display: none; }
.wz-next:disabled { opacity: .7; cursor: progress; }
@media (max-width: 600px) {
  .wz-back { padding: 0 14px; font-size: 1.05rem; }
  .wz-back span { display: none; }
}

/* done — full screen */
.done-screen { position: fixed; inset: 0; z-index: 100; background: var(--ok); color: #fff; display: grid; place-items: center; padding: 24px; text-align: center; }
.done-screen[hidden] { display: none; }
.done-in { max-width: 560px; width: 100%; }
.done-ic { width: 150px; height: 150px; border-radius: 50%; background: #fff; color: var(--ok); display: grid; place-items: center; margin: 0 auto 24px; animation: pop .4s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
.done-in h2 { color: #fff; font-size: clamp(2rem, 6vw, 2.8rem); }
.done-in p { font-size: 1.15rem; opacity: .95; margin: 10px 0 30px; }
.done-next { display: flex; align-items: center; justify-content: center; height: 76px; border-radius: 18px; background: #fff; color: var(--ok); font-size: 1.45rem; font-weight: 700; text-decoration: none !important; }

/* toast */
.toast {
  display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 500;
  background: var(--ok-soft); color: #13703d; border-left: 4px solid var(--ok);
}
.toast-err { background: var(--bad-soft); color: #9d2026; border-left-color: var(--bad); }

/* ---------- Pills / dots ---------- */
.pill { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: #8a5c00; }
.pill-info { background: var(--line-2); color: var(--grey); }
.dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dot-done { background: var(--ok); }
.dot-partial { background: var(--warn); }
.dot-missed { background: var(--bad); }
.dot-now { background: #fff; border: 2px dashed var(--orange); }
.dot-wait { background: var(--line-2); border: 1px solid var(--line); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .84rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ==========================================================
   OFFICE — dashboard / history / record / admin
   ========================================================== */
.date-nav { display: flex; gap: 6px; align-items: center; }
.date-nav input { width: auto; min-height: 44px; padding: 6px 10px; }
.tally { display: grid; grid-template-columns: 2fr repeat(4, 1fr); background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 18px; }
.tally > div { padding: 18px 22px; border-left: 1px solid var(--line-2); display: grid; align-content: center; }
.tally > div:first-child { border-left: 0; }
.tally strong { font-size: 2.2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tally span { font-size: .88rem; color: var(--ink-2); }
.tally-main strong { font-size: 2.8rem; color: var(--orange-d); }
.tally-main strong small { font-size: 1.3rem; color: var(--ink-3); font-weight: 600; }
.tally-bar { display: flex; height: 10px; border-radius: 3px; overflow: hidden; background: var(--line-2); margin-top: 10px; }
.tally-bar i { display: block; height: 100%; }
.b-done { background: var(--ok); } .b-partial { background: var(--warn); } .b-missed { background: var(--bad); }
@media (max-width: 900px) {
  .tally { grid-template-columns: repeat(2, 1fr); }
  .tally-main { grid-column: 1 / -1; border-bottom: 1px solid var(--line-2); }
  .tally > div:nth-child(2), .tally > div:nth-child(4) { border-left: 0; }
  .tally > div:nth-child(n+4) { border-top: 1px solid var(--line-2); }
}

.board { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px 20px 12px; }
.board-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix { width: 100%; border-collapse: collapse; min-width: 640px; }
.matrix thead th { padding: 12px 10px 10px; text-align: left; vertical-align: bottom; font-weight: 500; }
.matrix thead th.l { font-size: .86rem; color: var(--ink-3); }
.sh-name { display: block; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.sh-name em { font-style: normal; font-size: .74rem; background: var(--orange); color: #fff; padding: 1px 8px; border-radius: 99px; vertical-align: 2px; margin-left: 4px; }
.matrix thead small { display: block; color: var(--ink-2); font-size: .8rem; }
.sh-bar { display: block; height: 4px; background: var(--line-2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.sh-bar i { display: block; height: 100%; background: var(--ok); }
.matrix th.col-now { background: var(--orange-soft); border-top: 3px solid var(--orange); }
.matrix td.col-now { background: var(--orange-soft); }
.matrix tbody th.l { text-align: left; font-weight: 500; font-size: .94rem; padding: 4px 12px 4px 0; white-space: nowrap; position: sticky; left: 0; z-index: 1; background: #fff; }
.matrix tbody tr { border-top: 1px solid var(--line-2); }
.matrix td { padding: 5px 6px; width: 24%; }
.idx { display: inline-block; width: 26px; color: var(--ink-3); font-size: .82rem; font-variant-numeric: tabular-nums; }
.slot {
  display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 6px 10px; border-radius: 8px;
  font-size: .85rem; min-height: 48px; text-decoration: none !important; line-height: 1.25;
}
.slot > span { font-weight: 700; font-size: .95rem; }
.slot > span:only-child { grid-column: 1 / -1; font-weight: 500; font-size: .86rem; }
.slot small { grid-column: 2; font-size: .78rem; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .ic { grid-row: span 2; }
.slot em { font-style: normal; font-size: .72rem; background: rgba(255, 255, 255, .3); padding: 0 5px; border-radius: 4px; }
.slot-done { background: var(--ok); color: #fff; }
.slot-partial { background: var(--warn); color: #fff; }
.slot-missed { background: var(--bad); color: #fff; }
.slot-now { background: #fff; color: var(--orange-d); border: 2px dashed var(--orange); }
.slot-wait { background: transparent; color: var(--ink-3); border: 1px solid var(--line-2); }
a.slot:hover { filter: brightness(.94); }
@media (max-width: 760px) {
  .matrix tbody th.l { max-width: 150px; white-space: normal; font-size: .87rem; line-height: 1.3; box-shadow: 6px 0 8px -6px rgba(43, 45, 51, .2); }
  .board { padding: 16px 12px 8px; }
}

.grid-side { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-top: 18px; align-items: start; }
.grid-side > * { min-width: 0; }
@media (max-width: 1000px) { .grid-side { grid-template-columns: 1fr; } }
.issue-list { list-style: none; margin: 0; padding: 0; }
.issue-list li + li { border-top: 1px solid var(--line-2); }
.issue-list a { display: block; padding: 12px 4px; color: var(--ink); text-decoration: none; }
.issue-list a:hover strong { color: var(--orange-d); }
.issue-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.issue-list p { margin: 3px 0; color: var(--ink-2); font-size: .93rem; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.3fr) 1fr 28px; align-items: center; gap: 10px; font-size: .92rem; }
.bar-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 10px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--orange); }
.bars b { text-align: right; font-variant-numeric: tabular-nums; }
.spark { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 150px; }
.spark-col { display: grid; grid-template-rows: auto 1fr auto; gap: 4px; text-align: center; color: var(--ink-2); text-decoration: none !important; border-radius: 6px; padding: 4px 0; }
.spark-col:hover { background: var(--line-2); }
.spark-v { font-size: .74rem; font-variant-numeric: tabular-nums; }
.spark-bar { display: flex; align-items: flex-end; justify-content: center; }
.spark-bar i { width: 58%; max-width: 26px; background: #c9cacf; border-radius: 3px 3px 0 0; }
.spark-col.on .spark-bar i { background: var(--orange); }
.spark-col.on { color: var(--orange-d); font-weight: 700; }
.spark-d { font-size: .86rem; }

/* history */
.filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; align-items: end; margin-bottom: 12px; }
.filters > * { min-width: 0; }
.filters .field { margin: 0; }
.filter-btns { display: flex; gap: 8px; grid-column: 1 / -1; justify-content: flex-end; }
@media (max-width: 1000px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.result-n { margin: 6px 2px 10px; font-size: .92rem; }
.table-card { padding: 4px 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .94rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: .84rem; padding: 12px; border-bottom: 2px solid var(--orange); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr[onclick] { cursor: pointer; }
.tbl tbody tr[onclick]:hover { background: var(--orange-soft); }
.thumb { position: relative; display: block; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--line-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb em { position: absolute; right: 3px; bottom: 3px; background: rgba(43, 45, 51, .8); color: #fff; font-style: normal; font-size: .7rem; padding: 0 5px; border-radius: 4px; }
.note-cell { max-width: 260px; color: var(--ink-2); font-size: .88rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-go { color: var(--ink-3); }
.pager { display: flex; justify-content: center; gap: 14px; align-items: center; margin-top: 16px; color: var(--ink-2); }

/* record */
.status-banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 10px; margin-bottom: 16px; }
.status-banner div { display: grid; }
.status-banner strong { font-size: 1.12rem; }
.status-banner.ok { background: var(--ok); color: #fff; }
.status-banner.warn { background: var(--warn); color: #fff; }
.meta { margin: 0; display: grid; }
.meta div { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.meta dt { color: var(--ink-2); display: flex; gap: 6px; align-items: center; font-size: .92rem; }
.meta dt .ic { color: var(--orange); }
.meta dd { margin: 0; font-weight: 500; }
.meta-note dd { background: var(--warn-soft); padding: 10px 12px; border-radius: 6px; font-weight: 400; }
@media (max-width: 520px) { .meta div { grid-template-columns: 1fr; gap: 2px; } }
.result-list { list-style: none; margin: 0; padding: 0; }
.result-list li { display: flex; gap: 12px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line-2); }
.result-list li:last-child { border-bottom: 0; }
.result-list .ri { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; flex: none; color: #fff; }
.result-list .yes .ri { background: var(--ok); }
.result-list .no { color: var(--bad); font-weight: 500; }
.result-list .no .ri { background: var(--bad); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gal-item { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--line-2); }
.gal-item img { width: 100%; height: 100%; object-fit: cover; }
.detail .gallery { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; }
.lightbox::backdrop { background: rgba(20, 21, 24, .9); }
.lightbox img { max-width: 96vw; max-height: 90vh; display: block; border-radius: 8px; }
.lb-x { position: fixed; top: 14px; right: 18px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; font-size: 26px; cursor: pointer; }

/* admin */
.login-wrap { display: grid; place-items: center; min-height: 60vh; }
.login-card { width: 100%; max-width: 420px; padding: 32px; text-align: center; border-top: 4px solid var(--orange); }
.login-card .field { text-align: left; margin-top: 18px; }
.login-logo { margin: 4px auto 16px; height: 64px; min-width: 64px; border-radius: 12px; display: inline-grid; place-items: center; background: var(--orange); color: #fff; }
.login-logo.has-logo { background: none; }
.login-logo img { height: 64px; max-width: 240px; object-fit: contain; }
.login-card .muted { margin: 6px 0 0; font-size: .92rem; }
.tabs { display: flex; gap: 0; overflow-x: auto; margin-bottom: 18px; border-bottom: 2px solid var(--line); }
.tabs a { display: inline-flex; gap: 7px; align-items: center; padding: 10px 16px; color: var(--ink-2); font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { color: var(--orange-d); border-bottom-color: var(--orange); font-weight: 600; }
.edit-tbl input { min-height: 40px; padding: 6px 10px; border-radius: 7px; }
.edit-tbl .in-sm { width: 76px; }
.edit-tbl input[type=time] { width: 124px; }
.edit-tbl tr.off td { opacity: .55; }
.edit-tbl tr.off td:has(.switch) { opacity: 1; }
form.inline { display: inline; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #cfd0d5; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--orange); outline-offset: 2px; }
.add-row { display: flex; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.add-row input[type=text] { flex: 1 1 240px; }
.add-row input[type=time] { width: 130px; }
.settings { align-items: start; }
.settings .logo-card { grid-column: 1 / -1; }
.settings .card .btn { margin-top: 4px; }
.logo-preview { display: flex; align-items: center; gap: 18px; padding: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; }
.logo-preview .muted { margin: 0; }
.logo-big { height: 72px; min-width: 72px; border-radius: 10px; display: grid; place-items: center; background: var(--orange); color: #fff; flex: none; }
.logo-big.has-logo { background: #fff; padding: 8px 14px; }
.logo-big img { height: 56px; max-width: 240px; object-fit: contain; }
.logo-up { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.logo-up input[type=file] { flex: 1 1 240px; padding: 10px; border: 1.5px dashed var(--line); border-radius: 8px; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } .logo-preview { flex-direction: column; text-align: center; } }

/* QR labels */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.qr-card {
  background: #fff; border: 2px solid var(--orange); border-radius: 16px; overflow: hidden; text-align: center;
  display: flex; flex-direction: column; break-inside: avoid; page-break-inside: avoid;
}
.qr-card header { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 14px 16px 12px; font-weight: 600; font-size: .9rem; border-bottom: 1px solid var(--line); }
.qr-logo { height: 34px; min-width: 34px; border-radius: 7px; display: grid; place-items: center; background: var(--orange); color: #fff; flex: none; }
.qr-logo.has-logo { background: none; }
.qr-logo img { height: 32px; max-width: 120px; object-fit: contain; display: block; }
.qr-k { margin: 14px 0 0; font-size: .84rem; color: var(--ink-2); }
.qr-card h2 { font-size: 1.45rem; padding: 2px 16px 0; line-height: 1.25; }
.qr-box { width: 64%; margin: 12px auto 6px; aspect-ratio: 1; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-cta { margin: 4px 0 0; font-weight: 700; font-size: 1.1rem; color: var(--orange-d); }
.qr-steps { list-style: none; display: flex; justify-content: center; gap: 6px; padding: 8px 12px 14px; margin: 0; font-size: .78rem; counter-reset: s; flex-wrap: wrap; color: var(--ink-2); }
.qr-steps li { counter-increment: s; background: var(--line-2); padding: 2px 9px; border-radius: 99px; }
.qr-steps li::before { content: counter(s) ". "; font-weight: 700; color: var(--orange-d); }
.qr-card footer { margin-top: auto; background: var(--orange); color: #fff; padding: 9px 12px; font-size: .78rem; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }

/* footer */
.foot { background: var(--white); border-top: 1px solid var(--line); color: var(--ink-2); text-align: center; padding: 14px var(--pad); }
.foot p { margin: 0; font-size: .86rem; }
.kiosk .foot { padding: 10px var(--pad); }
.kiosk .foot p { font-size: .78rem; color: var(--ink-3); }

@media (max-width: 560px) {
  .card, .panel { padding: 18px 16px; }
  .page-h { align-items: flex-start; }
  .tbl { font-size: .88rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Print ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 12px; }
  .no-print, .topbar, .mainnav, .wz-bar { display: none !important; }
  .print-head { display: flex; align-items: center; gap: 12px; padding: 0 0 10px; margin-bottom: 14px; border-bottom: 2px solid var(--orange); }
  .print-head div { display: grid; }
  .print-head strong { font-size: 15px; }
  .print-head span { color: var(--ink-2); }
  .print-logo { height: 40px; min-width: 40px; display: grid; place-items: center; border-radius: 6px; background: var(--orange); color: #fff; }
  .print-logo.has-logo { background: none; }
  .print-logo img { height: 40px; max-width: 160px; object-fit: contain; }
  .foot { border-top: 1px solid var(--line); }
  .main { padding: 0; }
  .card, .board, .tally { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .qr-page .print-head, .qr-page .foot { display: none; }
  .qr-grid { grid-template-columns: repeat(2, 1fr); gap: 8mm; }
  .qr-card { height: 130mm; }
  .qr-box { width: 58%; }
}

/* ==========================================================
   PC LAYOUT — wide screen + mouse only.
   Phones / tablets / iPad (touch, pointer: coarse) keep the full-screen layout above.
   ========================================================== */
.wz-date { display: none; }
@media (min-width: 1100px) and (hover: hover) and (pointer: fine) {
  .kiosk .main { padding: 32px var(--pad) 40px; }
  .wizard {
    display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto auto auto 1fr;
    grid-template-areas: "side alert" "side main" "side bar" "side .";
    column-gap: 28px; width: 100%; max-width: 1240px; margin: 0 auto; align-items: start;
  }

  /* left: progress sidebar */
  .wz-top {
    grid-area: side; position: sticky; top: 96px; flex-direction: column; align-items: stretch; gap: 18px;
    background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px;
  }
  .wz-room { font-size: 1.2rem; align-items: flex-start; padding-bottom: 16px; border-bottom: 1px solid var(--line-2); }
  .wz-room .ic { margin-top: 3px; }
  .wz-steps { flex-direction: column; gap: 0; margin: 0; width: auto; }
  .wz-steps li { gap: 12px; font-size: 1rem; padding: 6px 0; position: relative; }
  .wz-steps li span { display: inline; }
  .wz-steps li + li::before { content: ""; position: absolute; left: 15px; top: -8px; width: 2px; height: 16px; margin: 0; background: var(--line); }
  .wz-steps li.done + li::before { background: var(--ok); }
  .wz-steps li.done span { color: var(--ink-2); }
  .wz-date { display: flex; align-items: center; gap: 8px; margin: 0; padding-top: 16px; border-top: 1px solid var(--line-2); color: var(--ink-2); font-size: .9rem; }
  .wz-date .ic { color: var(--orange); }
  .wz-alert { grid-area: alert; margin: 0 0 16px; }

  /* right: question card */
  .step {
    grid-area: main; max-width: none; margin: 0; padding: 32px 36px 28px;
    background: #fff; border: 1px solid var(--line); border-radius: 16px 16px 0 0; border-bottom: 0;
  }
  .q { font-size: 1.9rem; }
  .q-sub { font-size: 1.05rem; margin: 4px 0 22px; }
  .step-err { font-size: 1rem; padding: 12px 16px; }

  .pick-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
  .pick > span { min-height: 70px; font-size: 1.05rem; padding: 12px 16px; gap: 14px; border-radius: 12px; }
  .num { width: 44px; height: 44px; font-size: 1.2rem; }
  .num { font-size: 1rem; border-radius: 10px; }
  .tick { width: 30px; height: 30px; }
  .tick .ic { width: 18px; height: 18px; }
  .rooms .pick > span { min-height: 64px; font-size: 1rem; }

  .all-btn { min-height: 54px; font-size: 1.1rem; border-radius: 12px; border-width: 2px; }
  .all-btn .ic { width: 22px; height: 22px; }
  .task-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
  .task > span { min-height: 124px; font-size: .95rem; padding: 16px 10px 12px; border-radius: 12px; gap: 8px; }
  .item-ic { width: 40px; height: 40px; }
  .task .tick { width: 26px; height: 26px; top: 8px; right: 8px; }
  .note-box label { font-size: 1rem; }
  .note-box textarea { font-size: 1rem; }

  .cam-btn { min-height: 220px; font-size: 1.25rem; border-radius: 16px; }
  .cam-btn .ic { width: 48px; height: 48px; }
  .cam-btn.has { min-height: 84px; font-size: 1.05rem; }
  .cam-btn.has .ic { width: 28px; height: 28px; }
  .photos { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

  .summary { padding: 0 22px; border-radius: 12px; }
  .summary > div { grid-template-columns: 160px 1fr; padding: 13px 0; }
  .summary dd { font-size: 1.1rem; }
  .seg { max-width: 460px; }

  /* buttons: bottom of the same card, normal size, right-aligned */
  .wz-bar {
    grid-area: bar; position: static; justify-content: flex-end; padding: 18px 36px 24px;
    background: #fff; border: 1px solid var(--line); border-top: 1px solid var(--line-2); border-radius: 0 0 16px 16px; box-shadow: none;
  }
  .wz-back, .wz-next { height: 52px; font-size: 1.05rem; border-radius: 10px; }
  .wz-back { margin-right: auto; padding: 0 20px; }
  .wz-back .ic, .wz-next .ic { width: 22px; height: 22px; }
  .wz-next { flex: 0 0 auto; min-width: 220px; padding: 0 28px; }

  /* done screen: centered dialog instead of full green screen */
  .done-screen { background: rgba(43, 45, 51, .55); }
  .done-in { background: var(--ok); border-radius: 20px; padding: 40px 36px 32px; max-width: 480px; box-shadow: 0 30px 60px rgba(0, 0, 0, .25); }
  .done-ic { width: 112px; height: 112px; margin-bottom: 18px; }
  .done-ic .ic { width: 56px; height: 56px; }
  .done-in h2 { font-size: 2rem; }
  .done-in p { font-size: 1.02rem; margin: 8px 0 24px; }
  .done-next { height: 56px; font-size: 1.15rem; border-radius: 12px; }

  /* office pages: don't let content stretch edge-to-edge on very wide monitors */
  .office .main > * { max-width: 1560px; margin-left: auto; margin-right: auto; }
}

/* ---------- accounts ---------- */
.usermenu { display: flex; align-items: center; gap: 10px; margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--line); }
.usermenu form { margin: 0; }
.um-who { display: grid; justify-items: end; line-height: 1.25; color: var(--ink); }
.um-who:hover { text-decoration: none; }
.um-who b { font-size: .9rem; font-weight: 600; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role { display: inline-block; font-size: .72rem; font-weight: 700; padding: 0 8px; border-radius: 99px; white-space: nowrap; }
.role-admin { background: var(--line-2); color: var(--grey); }
.role-superadmin { background: var(--orange); color: #fff; }
.nav-acc { display: none !important; }
.role-help { display: grid; gap: 4px; background: var(--bg); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: .9rem; color: var(--ink-2); }
.role-help p { margin: 0; }
.reset-pw { display: inline-block; position: relative; }
.reset-pw summary { list-style: none; }
.reset-pw summary::-webkit-details-marker { display: none; }
.reset-pw[open] form { position: absolute; right: 0; top: 40px; z-index: 5; display: flex; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; box-shadow: 0 10px 30px rgba(43, 45, 51, .15); width: 340px; }
.add-user input[type=text] { flex: 1 1 180px; }
.add-user select { width: auto; flex: 0 0 150px; }
.narrow-card { max-width: 480px; }
@media (max-width: 900px) {
  .office .mainnav .nav-acc { display: flex !important; }
  .um-who { display: none; }
  .usermenu { margin-left: auto; padding-left: 0; border-left: 0; }
}

/* ---------- Report (report.php) ---------- */
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.rp-filter { display: grid; gap: 14px; margin-bottom: 18px; }
.rp-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: .9rem; font-weight: 500; }
.chip:hover { border-color: var(--orange); color: var(--orange-d); text-decoration: none; }
.chip.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.rp-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.rp-fields .field { margin: 0; }
@media (max-width: 1000px) { .rp-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rp-fields .filter-btns { grid-column: 1 / -1; } }
.rp-delta { display: block; margin-top: 8px; font-size: .85rem; font-weight: 600; }

.rp-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.rp-kpis > div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; display: grid; }
.rp-kpis strong { font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.rp-kpis span { font-size: .85rem; color: var(--ink-2); }
@media (max-width: 900px) { .rp-kpis { grid-template-columns: repeat(2, 1fr); } }

.main > .card, .rp-3, .main > .grid-side { margin-bottom: 18px; }
.rp-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* daily stacked bars */
.rp-days { display: grid; grid-template-columns: repeat(var(--n), minmax(16px, 1fr)); gap: 2px; align-items: end; height: 200px; min-width: calc(var(--n) * 18px); padding-top: 6px; }
.rp-day { display: grid; grid-template-rows: 18px 1fr 20px; height: 100%; color: var(--ink-2); text-align: center; border-radius: 4px; }
.rp-day:hover { background: var(--line-2); text-decoration: none; }
.rp-day-v { font-size: .68rem; font-variant-numeric: tabular-nums; align-self: end; }
.rp-day-bar { align-self: end; display: flex; flex-direction: column; gap: 2px; margin: 0 auto; width: min(100%, 26px); min-height: 2px; border-radius: 4px 4px 0 0; overflow: hidden; }
.rp-day-bar i { display: block; min-height: 0; }
.rp-day-d { font-size: .72rem; font-variant-numeric: tabular-nums; align-self: center; }
.rp-day.we .rp-day-d { color: var(--ink-3); }
.rp-day.we .rp-day-bar { opacity: .7; }

/* room x shift table */
.rp-tbl th.c, .rp-tbl td.c { text-align: center; }
.rp-tbl td { font-variant-numeric: tabular-nums; }
.rp-tbl td.heat { background: color-mix(in srgb, var(--orange) calc((100 - var(--p, 100)) * 1.6%), #fff); font-weight: 600; min-width: 72px; }
.rp-tbl td:first-child { min-width: 170px; }
.rp-barcol { min-width: 200px; }
.rp-pbar { display: grid; grid-template-columns: 1fr 52px; align-items: center; gap: 10px; }
.rp-pbar .tally-bar { margin: 0; }
.rp-pbar b { text-align: right; }

.rp-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.rp-3 > * { margin: 0; }
.rp-3 > *, .main > .grid-side > *, .rp-kpis > * { min-width: 0; }
@media (max-width: 1000px) { .rp-3, .main > .grid-side { grid-template-columns: minmax(0, 1fr); } }
.rp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.rp-list li { display: grid; gap: 6px; }
.rp-list .tally-bar { margin: 0; }
.rp-list-t { display: flex; align-items: baseline; gap: 8px; }
.rp-list-t b { margin-left: auto; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.bars li b { min-width: 46px; }
.bars li { grid-template-columns: minmax(0, 1.3fr) 1fr 50px; }

.rp-note { margin: 0 0 10px; }

.rp-hours { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; height: 170px; }
.rp-hour { display: grid; grid-template-rows: 18px 1fr 20px; text-align: center; }
.rp-hour-v { font-size: .7rem; color: var(--ink-2); align-self: end; font-variant-numeric: tabular-nums; }
.rp-hour-bar { display: flex; align-items: flex-end; justify-content: center; }
.rp-hour-bar i { display: block; width: min(100%, 22px); background: var(--orange); border-radius: 4px 4px 0 0; min-height: 0; }
.rp-hour-d { font-size: .72rem; color: var(--ink-3); }

.rp-scroll { max-height: 520px; overflow: auto; }
.rp-foot { margin: 6px 0 0; }

@media print {
  .rp-kpis, .rp-3 { break-inside: avoid; }
  .rp-scroll { max-height: none; overflow: visible; }
  .rp-3 { grid-template-columns: repeat(3, 1fr); }
  .main > .grid-side { grid-template-columns: 1fr 1fr; }
}

/* summary table + signatures (print-ready document) */
.rs-doc { padding: 28px; }
.rs-title { display: flex; align-items: center; justify-content: center; gap: 16px; text-align: center; margin-bottom: 16px; }
.rs-title h2 { font-size: 1.3rem; }
.rs-title p { margin: 2px 0 0; color: var(--ink-2); }
.rs-logo { height: 44px; min-width: 44px; display: grid; place-items: center; border-radius: 8px; background: var(--orange); color: #fff; }
.rs-logo.has-logo { background: none; }
.rs-logo img { height: 44px; max-width: 160px; object-fit: contain; display: block; }
.rs-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; margin: 0 0 16px; font-size: .93rem; }
.rs-meta div { display: flex; gap: 8px; }
.rs-meta dt { color: var(--ink-2); min-width: 120px; }
.rs-meta dd { margin: 0; }
.rs-tbl { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.rs-tbl th, .rs-tbl td { border: 1px solid #b9bbc2; padding: 7px 10px; vertical-align: middle; }
.rs-tbl th { background: var(--orange-soft); font-weight: 600; white-space: nowrap; }
.rs-tbl th small { display: block; font-weight: 400; color: var(--ink-2); font-size: .78rem; }
.rs-tbl .c { text-align: center; }
.rs-tbl td:nth-child(2) { min-width: 180px; }
.rs-tbl tbody tr:nth-child(even) td { background: #fafafb; }
.rs-tbl tfoot td { font-weight: 700; background: var(--line-2); }
.rs-note { font-size: .8rem; color: var(--ink-2); margin: 10px 0 0; }
.rs-sign { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 56px; text-align: center; break-inside: avoid; }
.rs-sign p { margin: 0 0 10px; }
.rs-line { display: inline-block; width: 70%; border-bottom: 1px dotted var(--ink); vertical-align: bottom; height: 1.4em; }
@media (max-width: 700px) { .rs-meta { grid-template-columns: 1fr; } .rs-sign { grid-template-columns: 1fr; gap: 36px; } }
@media print {
  /* เอกสารเซ็น: ให้แบ่งหน้าได้ (card ทั่วไปตั้ง break-inside: avoid), อัดให้พอดี A4 แนวนอน, ไม่ล้นขอบ */
  .sign-page .print-head, .sign-page .foot { display: none !important; }
  .sign-page .main { padding: 0; }
  .rs-doc { border: 0; border-radius: 0; padding: 0; break-inside: auto; }
  .rs-title { margin-bottom: 8px; }
  .rs-title h2 { font-size: 16px; }
  .rs-logo, .rs-logo img { height: 34px; }
  .rs-meta { font-size: 11px; margin-bottom: 8px; gap: 0 24px; }
  .table-scroll { overflow: visible; }
  .rs-tbl { width: 100%; max-width: 100%; font-size: 10.5px; line-height: 1.3; }
  .rs-tbl th, .rs-tbl td { padding: 3px 6px; }
  .rs-tbl th { white-space: normal; }
  .rs-tbl th small { font-size: 9px; }
  .rs-tbl td:nth-child(2) { min-width: 0; }
  .rs-tbl thead { display: table-header-group; }
  .rs-tbl tfoot { display: table-row-group; }
  .rs-tbl tr { break-inside: avoid; }
  .rs-note { font-size: 9.5px; margin-top: 6px; }
  .rs-sign { grid-template-columns: repeat(3, 1fr); margin-top: 26px; font-size: 11px; }
  .rs-sign p { margin: 0 0 6px; }
}

/* ---------- Settings: purge cleaning records (Super Admin) ---------- */
.purge-card { margin-top: 16px; border-color: #f4c6c8; }
.purge-card .hint { margin-top: 0; }
.purge-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.purge-opts .del-opt { margin-bottom: 0; }
.del-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.del-opt:has(input:checked) { border-color: var(--bad); background: var(--bad-soft); }
.del-opt > input { margin-top: 5px; accent-color: var(--bad); }
.del-opt > span { display: grid; gap: 4px; flex: 1; min-width: 0; }
.del-opt small { margin: 0; font-size: .82rem; }
.purge-range { display: flex; gap: 10px; flex-wrap: wrap; }
.purge-range .field { margin: 0; flex: 1 1 140px; }
.purge-confirm { max-width: 360px; }
@media (max-width: 700px) { .purge-opts { grid-template-columns: 1fr; } }

/* ---------- Responsible staff per room (room_staff) ---------- */
.pick.resp > span { border-color: var(--orange); }
.pick.resp::after { content: "ผู้รับผิดชอบห้องนี้"; position: absolute; top: -10px; left: 18px; background: var(--orange); color: #fff; font-size: .78rem; padding: 0 10px; border-radius: 99px; }
.resp-cell { min-width: 200px; max-width: 360px; }
.resp-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.resp-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 220px; padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--orange-soft); color: var(--orange-d); font-size: .82rem; font-weight: 500; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resp-chip .ic { flex: none; }
.resp-chip.more { background: var(--line-2); color: var(--ink-2); cursor: help; }
.resp-edit { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink-2); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; text-decoration: none !important; transition: border-color .15s, color .15s; }
.resp-edit:hover { border-color: var(--orange); color: var(--orange-d); }
.resp-edit.empty { border-style: dashed; color: var(--orange-d); border-color: #ffc4a8; }

/* dialog เลือกห้อง */
.resp-dlg { border: 0; padding: 0; border-radius: 16px; width: min(720px, 94vw); max-height: min(640px, 90vh); box-shadow: 0 24px 60px rgba(20, 21, 24, .3); color: var(--ink); }
.resp-dlg[open] { display: flex; flex-direction: column; animation: resp-in .16s ease-out; }
.resp-dlg::backdrop { background: rgba(20, 21, 24, .5); }
@keyframes resp-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.resp-dlg-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line-2); border-top: 4px solid var(--orange); }
.resp-dlg-h small { color: var(--ink-3); font-size: .82rem; }
.resp-dlg-h h3 { font-size: 1.15rem; margin: 0; }
.resp-x { border: 0; background: none; color: var(--ink-3); width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.resp-x:hover { background: var(--line-2); color: var(--ink); }
.resp-tools { display: flex; gap: 8px; align-items: center; padding: 14px 22px 4px; }
.resp-search { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; font-size: .95rem; }
.resp-search:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.resp-link { border: 0; background: none; color: var(--orange-d); font: inherit; font-size: .88rem; font-weight: 600; padding: 6px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.resp-link:hover { background: var(--orange-soft); }
.resp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; padding: 12px 22px 16px; overflow-y: auto; flex: 1; align-content: start; }
.resp-opt { position: relative; display: block; cursor: pointer; }
.resp-opt[hidden] { display: none; }
.resp-opt input { position: absolute; opacity: 0; pointer-events: none; }
.resp-opt > span { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; transition: border-color .12s, background .12s; }
.resp-opt:hover > span { border-color: var(--grey-2); }
.resp-opt em { font-style: normal; font-size: .92rem; line-height: 1.35; flex: 1; }
.resp-opt small { font-size: .72rem; color: var(--ink-3); background: var(--line-2); padding: 0 6px; border-radius: 4px; }
.resp-tick { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; background: #fff; transition: all .12s; }
.resp-opt input:checked + span { border-color: var(--orange); background: var(--orange-soft); }
.resp-opt input:checked + span .resp-tick { background: var(--orange); border-color: var(--orange); color: #fff; }
.resp-opt input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 2px; }
.resp-opt.off em { color: var(--ink-3); }
.resp-none { grid-column: 1 / -1; text-align: center; color: var(--ink-3); margin: 20px 0; }
.resp-dlg-f { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line-2); background: #fafafb; }
.resp-dlg-f > span { margin-right: auto; font-size: .92rem; }
.resp-dlg-f b { color: var(--orange-d); font-size: 1.05rem; }
@media (max-width: 600px) { .resp-grid { grid-template-columns: 1fr; } .resp-dlg-f .btn { padding: 0 14px; } }.edit-tbl .resp-dlg .resp-search { min-height: 0; height: 40px; padding: 0 14px; border-radius: 10px; }
.edit-tbl tr.off td.resp-cell { opacity: 1; }
.resp-dlg-h h3:focus { outline: none; }

/* ---------- Exit after submit (ออกจากโปรแกรม) ---------- */
button.done-next { width: 100%; gap: 12px; border: 0; font-family: inherit; cursor: pointer; }
.done-hint { font-size: .95rem !important; opacity: .85; margin: 14px 0 0 !important; }
.bye { max-width: 520px; margin: 6vh auto 0; text-align: center; display: grid; justify-items: center; gap: 6px; padding: 0 8px; }
.bye .done-ic { background: var(--ok); color: #fff; width: 128px; height: 128px; margin-bottom: 14px; }
.bye h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); color: var(--ok); }
.bye > p { margin: 0; font-size: 1.15rem; color: var(--ink-2); }
.bye .bye-qr { display: flex; gap: 12px; align-items: center; text-align: left; margin: 22px 0 8px; padding: 16px 18px; border-radius: 14px; background: var(--orange-soft); color: var(--ink); font-size: 1.05rem; }
.bye .bye-qr .ic { color: var(--orange-d); }
.bye-close { display: inline-flex; align-items: center; gap: 8px; height: 56px; padding: 0 28px; margin-top: 10px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; color: var(--ink-2); font: inherit; font-size: 1.1rem; font-weight: 600; cursor: pointer; }

/* ==========================================================
   Dashboard (dashboard.php) — redesign 2026-11
   ========================================================== */
.dsh-head h1 { font-size: clamp(1.5rem, 3vw, 1.9rem); }
.dsh-head .page-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.dsh-now-chip { display: inline-flex; align-items: center; gap: 7px; padding: 2px 12px; border-radius: 999px; background: var(--orange-soft); color: var(--orange-d); font-size: .86rem; font-weight: 600; }
.dsh-now-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); animation: dsh-pulse 1.8s infinite; }
@keyframes dsh-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 103, 39, .55); } 70% { box-shadow: 0 0 0 8px rgba(255, 103, 39, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 103, 39, 0); } }
.tiny-link { font-size: .86rem; font-weight: 600; }

/* top: ring + stats */
.dsh-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.dsh-hero { position: relative; display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 22px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; }
.dsh-ring { width: 132px; height: 132px; transform: rotate(-90deg); }
.dsh-ring circle { fill: none; stroke-width: 12; stroke-linecap: round; }
.dsh-ring .trk { stroke: var(--line-2); }
.dsh-ring .val { stroke: var(--ok); transition: stroke-dasharray .6s ease; }
.dsh-ring-v { position: absolute; left: 24px; top: 50%; width: 132px; transform: translateY(-50%); display: grid; justify-items: center; line-height: 1.1; pointer-events: none; }
.dsh-ring-v strong { font-size: 2.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dsh-ring-v strong small { font-size: 1rem; color: var(--ink-3); }
.dsh-ring-v span { font-size: .8rem; color: var(--ink-2); }
.dsh-hero-t h2 { font-size: 1.25rem; }
.dsh-hero-t > p { margin: 2px 0 12px; font-size: .9rem; }
.dsh-shiftbars { display: grid; gap: 8px; }
.dsh-shiftbars > div { display: grid; grid-template-columns: 82px minmax(0, 1fr) 46px; align-items: center; gap: 10px; font-size: .9rem; color: var(--ink-2); }
.dsh-shiftbars > div.on { color: var(--orange-d); font-weight: 600; }
.dsh-shiftbars em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.dsh-mini { display: block; height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.dsh-mini b { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.dsh-shiftbars .on .dsh-mini b { background: var(--orange); }

.dsh-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dsh-stat { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.dsh-stat i { grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.dsh-stat strong { font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dsh-stat span { font-size: .85rem; color: var(--ink-2); }
.dsh-stat.ok i { background: var(--ok-soft); color: var(--ok); }
.dsh-stat.ok strong { color: var(--ok); }
.dsh-stat.warn i { background: var(--warn-soft); color: var(--warn); }
.dsh-stat.warn strong { color: var(--warn); }
.dsh-stat.bad i { background: var(--bad-soft); color: var(--bad); }
.dsh-stat.bad strong { color: var(--bad); }
.dsh-stat.now i { background: var(--orange-soft); color: var(--orange-d); }
.dsh-stat.now strong { color: var(--orange-d); }

/* current shift to-do */
.dsh-todo { background: linear-gradient(135deg, #fff7f2, #fff); border: 1px solid #ffd2bd; border-left: 5px solid var(--orange); border-radius: 14px; padding: 16px 20px; margin-bottom: 16px; }
.dsh-todo.clear { background: var(--ok-soft); border-color: #bfe5cd; border-left-color: var(--ok); }
.dsh-todo-h { display: flex; gap: 14px; align-items: center; }
.dsh-todo-h > i { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--orange); color: #fff; flex: none; }
.dsh-todo.clear .dsh-todo-h > i { background: var(--ok); }
.dsh-todo h2 { font-size: 1.1rem; }
.dsh-todo-h p { margin: 0; font-size: .88rem; color: var(--ink-2); }
.dsh-todo-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dsh-todo-list span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 999px; background: #fff; border: 1px solid #ffd2bd; font-size: .88rem; }
.dsh-todo-list .ic { color: var(--orange); }

/* board */
.dsh-board { padding: 20px 22px; margin-bottom: 16px; }
.dsh-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .82rem; color: var(--ink-2); }
.dsh-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dsh-legend i { width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid; }
.lg-done i { background: var(--ok-soft); border-color: var(--ok); }
.lg-partial i { background: var(--warn-soft); border-color: var(--warn); }
.lg-missed i { background: var(--bad-soft); border-color: #eea3a6; }
.lg-now i { background: #fff; border: 1.5px dashed var(--orange); }
.lg-wait i { background: var(--line-2); border-color: var(--line); }
.dsh-grid { display: grid; }
.dsh-row { display: grid; grid-template-columns: minmax(200px, 1.15fr) repeat(var(--n), minmax(0, 1fr)); gap: 8px; align-items: stretch; padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.dsh-row:last-child { border-bottom: 0; }
.dsh-hrow { position: sticky; top: 72px; z-index: 2; background: #fff; border-bottom: 2px solid var(--line); padding: 6px 0 8px; }
.dsh-sh { padding: 4px 10px; border-radius: 8px; display: grid; }
.dsh-sh strong { font-size: .95rem; }
.dsh-sh small { font-size: .78rem; color: var(--ink-3); }
.dsh-sh.on { background: var(--orange-soft); color: var(--orange-d); }
.dsh-sh.on small { color: var(--orange-d); }
.dsh-hrow .dsh-room { align-self: end; font-size: .84rem; color: var(--ink-3); padding-bottom: 4px; }
.dsh-room { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 500; font-size: .94rem; }
.dsh-room b { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--line-2); color: var(--ink-2); display: grid; place-items: center; font-size: .75rem; font-weight: 600; }
.dsh-c { min-width: 0; border-radius: 10px; }
.dsh-c.on { background: #fff8f4; box-shadow: 0 0 0 4px #fff8f4; }
.dsh-slot { display: flex; align-items: center; gap: 8px; height: 100%; min-height: 46px; padding: 6px 10px; border-radius: 10px; border: 1.5px solid transparent; font-size: .84rem; color: var(--ink-2); text-decoration: none !important; min-width: 0; }
.dsh-slot > i { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.dsh-slot > span { display: grid; min-width: 0; line-height: 1.3; }
.dsh-slot strong { font-size: .9rem; font-variant-numeric: tabular-nums; }
.dsh-slot strong em { font-style: normal; font-size: .72rem; padding: 0 5px; border-radius: 5px; background: rgba(0, 0, 0, .07); }
.dsh-slot small { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
a.dsh-slot:hover { filter: brightness(.97); box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
.s-done { background: var(--ok-soft); border-color: #bfe5cd; color: #17703f; }
.s-done > i { background: var(--ok); color: #fff; }
.s-partial { background: var(--warn-soft); border-color: #f3d68a; color: #8a5d00; }
.s-partial > i { background: var(--warn); color: #fff; }
.s-missed { background: #fff6f6; border-color: #f6d3d4; color: #b4282e; }
.s-missed > i { background: var(--bad-soft); color: var(--bad); }
.s-now { background: #fff; border: 1.5px dashed var(--orange); color: var(--orange-d); font-weight: 600; }
.s-now > i { background: var(--orange-soft); color: var(--orange-d); }
.s-wait { background: #fafafb; border-color: var(--line-2); color: var(--ink-3); }
.s-wait > i { background: var(--line-2); color: var(--ink-3); }

/* bottom cards */
.dsh-bottom { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dsh-bottom .card { min-width: 0; }
.dsh-empty { display: grid; justify-items: center; gap: 6px; padding: 18px 0 10px; color: var(--ink-3); }
.dsh-empty p { margin: 0; }
.dsh-empty.ok { color: var(--ok); }
.dsh-issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 360px; overflow: auto; }
.dsh-issues a { display: flex; gap: 12px; padding: 10px 8px; border-radius: 10px; color: var(--ink); text-decoration: none !important; }
.dsh-issues a:hover { background: var(--line-2); }
.dsh-issues i { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.dsh-issues i.w { background: var(--warn-soft); color: var(--warn); }
.dsh-issues i.n { background: #eef3ff; color: #3b63c4; }
.dsh-issues div { min-width: 0; }
.dsh-issues strong { font-size: .93rem; }
.dsh-issues p { margin: 1px 0; font-size: .88rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dsh-issues small { font-size: .78rem; color: var(--ink-3); }
.dsh-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.dsh-people li { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.dsh-people .av { width: 38px; height: 38px; border-radius: 50%; background: var(--orange-soft); color: var(--orange-d); display: grid; place-items: center; font-weight: 700; }
.dsh-people .nm { display: block; font-size: .9rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsh-people .dsh-mini b { background: var(--orange); }
.dsh-people strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.dsh-people strong small { font-size: .75rem; font-weight: 500; color: var(--ink-3); }
.dsh-trend { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 190px; }
.dsh-trend a { display: grid; grid-template-rows: 20px 1fr 20px 16px; justify-items: center; color: var(--ink-2); border-radius: 10px; padding: 4px 0; text-decoration: none !important; }
.dsh-trend a:hover { background: var(--line-2); }
.dsh-trend a.on { background: var(--orange-soft); color: var(--orange-d); }
.dsh-trend em { font-style: normal; font-size: .74rem; font-variant-numeric: tabular-nums; align-self: end; }
.dsh-trend .col { width: 60%; max-width: 30px; height: 100%; display: flex; align-items: flex-end; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.dsh-trend .col i { display: block; width: 100%; border-radius: 6px; }
.dsh-trend .col .hi { background: var(--ok); }
.dsh-trend .col .mid { background: var(--warn); }
.dsh-trend .col .lo { background: #ef8f93; }
.dsh-trend b { font-size: .8rem; align-self: end; }
.dsh-trend small { font-size: .7rem; color: var(--ink-3); }

@media (max-width: 1100px) {
  .dsh-top { grid-template-columns: 1fr; }
  .dsh-bottom { grid-template-columns: 1fr 1fr; }
  .dsh-bottom .card:first-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .dsh-stats { grid-template-columns: 1fr 1fr; }
  .dsh-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 20px 16px; }
  .dsh-ring-v { left: 50%; top: 20px; transform: translateX(-50%); height: 132px; align-content: center; }
  .dsh-hero-t { width: 100%; }
  .dsh-shiftbars > div { text-align: left; }
  .dsh-bottom { grid-template-columns: 1fr; }
  .dsh-board { padding: 16px 14px; }
  /* board → การ์ดต่อห้อง: ชื่อห้องบน, รอบเรียงข้างล่าง */
  .dsh-hrow { display: none; }
  .dsh-row { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; padding: 10px 0; }
  .dsh-row .dsh-room { grid-column: 1 / -1; }
  .dsh-c::before { content: attr(data-sh); display: block; font-size: .72rem; color: var(--ink-3); margin: 0 0 3px 2px; }
  .dsh-c.on::before { color: var(--orange-d); font-weight: 600; }
  .dsh-slot { flex-direction: column; align-items: flex-start; gap: 3px; min-height: 52px; height: auto; padding: 6px 8px; }
  .dsh-slot > i { width: 20px; height: 20px; }
  .dsh-slot small { display: none; }
}
@media print {
  .dsh-hrow { position: static; }
  .dsh-todo, .dsh-hero, .dsh-stat { break-inside: avoid; }
}

/* top nav: ไม่ให้ชื่อเมนูตัดบรรทัดบนจอคอม — จอแคบลงให้ช่องไฟเล็กลง และซ่อนชื่อบริษัทยาวแทน */
@media (min-width: 901px) { .mainnav a { white-space: nowrap; } .brand { min-width: 0; flex-shrink: 1; } }
@media (min-width: 901px) and (max-width: 1360px) { .mainnav { gap: 0; } .mainnav a { padding: 0 10px; font-size: .9rem; } .brand-text strong { max-width: 220px; } }
@media (min-width: 901px) and (max-width: 1150px) { .brand-text { display: none; } .mainnav a .ic { display: none; } }
.brand-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- QR label: รอบเวลาเป็นคอลัมน์ (ไม่ตัดบรรทัด/ไม่หาย) + ตอนพิมพ์ QR ย่อให้พอดีการ์ด ---------- */
.qr-card footer { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; padding: 0; }
.qr-card footer span { display: grid; padding: 7px 4px; line-height: 1.3; }
.qr-card footer span + span { border-left: 1px solid rgba(255, 255, 255, .35); }
.qr-card footer b { font-size: .84rem; }
.qr-card footer small { font-size: .74rem; white-space: nowrap; opacity: .95; }
@media print {
  .qr-card { height: 128mm; }
  .qr-card h2 { flex: none; }
  .qr-box { flex: 1 1 0; min-height: 0; width: 100%; aspect-ratio: auto; margin: 6px auto 4px; }
  .qr-box svg { height: 100%; width: auto; max-width: 62%; margin: 0 auto; }
  .qr-card footer { flex: none; }
  .qr-page .main { padding: 0; }
}

/* ---------- เปิดจาก LINE → ส่งไปเบราว์เซอร์ของเครื่อง (ให้กล้องใช้ได้) ---------- */
.bye .line-ic { background: #06c755; }
.bye .line-h { color: var(--ink); }
.line-go { text-decoration: none !important; color: var(--ink) !important; }
.line-hint { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--warn-soft); color: #7a5200; font-size: 1rem; line-height: 1.5; }
.line-hint .ic { flex: none; margin-top: 2px; }

/* ---------- ขั้นถ่ายรูป: เลือก "ถ่ายรูป (กล้อง)" หรือ "เลือกจากอัลบั้ม" ---------- */
.photo-src { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.photo-src[hidden] { display: none; }
.photo-src .cam-btn { min-height: 230px; gap: 10px; }
.photo-src .cam-btn > span { display: grid; gap: 2px; line-height: 1.3; }
.photo-src .cam-btn small { font-size: .9rem; font-weight: 500; opacity: .8; }
.cam-btn.src-album { background: #fff; border-color: var(--grey-2); color: var(--ink); }
.cam-btn.src-album .ic { color: var(--grey); }
.cam-btn:active { transform: scale(.98); }
.photo-src.has .cam-btn { min-height: 92px; flex-direction: row; font-size: 1.1rem; padding: 12px 14px; text-align: left; }
.photo-src.has .cam-btn .ic { width: 32px; height: 32px; }
.photo-count { margin: 12px 0 0; text-align: center; font-weight: 600; color: var(--ink-2); }
@media (max-width: 360px) { .photo-src { grid-template-columns: 1fr; } .photo-src .cam-btn { min-height: 150px; } }
