:root {
  --bg: #f3f4f1;
  --surface: #ffffff;
  /* ชุดสี ก (เจ้าของเลือก 10 พ.ย. 2569): สีเดิม ปรับตัวหนังสือรอง/ขอบ/สีสถานะให้ชัดขึ้น */
  --surface-2: #f6f7f5;
  --ink: #18211f;
  --ink-2: #3c4744;
  --muted: #4d5753;      /* ตัวหนังสือรอง ≥ 7:1 บนพื้นขาว */
  --line: #d3d9d6;       /* เส้นแบ่งเบาๆ (ตกแต่ง) */
  --line-2: #7b8883;     /* ขอบช่องกรอก/ปุ่มรอง/select ≥ 3:1 */
  --brand: #0f5f58;
  --brand-2: #0b4a44;
  --brand-soft: #e3f0ee;
  --accent: #f2a516;
  --danger: #b42318;
  --danger-2: #8f1c13;   /* ปุ่มอันตรายตอนชี้ */
  --danger-soft: #fdecea;
  --ok: #12622f;
  --ok-soft: #e3f3e8;
  --warn: #8a4500;
  --warn-soft: #fdf0db;

  /* สีสถานะแผง (ค่าเริ่มต้น — ตลาดที่บันทึกสีไว้เองใช้สีที่บันทึก) */
  --st-free: #ffffff;
  --st-occupied: #085a45;
  --st-regular: #2f62d8;
  --st-daily: #ee7a1a;
  --st-weekly: #5b2a8c;
  --st-temp: #c93a7e;
  --st-held: #0ea5b7;
  --st-booked: #7a4a0c;
  --st-paused: #b8c0bd;
  --st-paused-line: #5f6a66;
  --st-sel: #ffc61a;
  --st-sel-ink: #1b1300;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 22, .06), 0 4px 16px rgba(16, 24, 22, .05);
  --font: "IBM Plex Sans Thai", "Sarabun", "Leelawadee UI", "Tahoma", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* ขนาดตัวอักษรทั้งระบบ: ทุกขนาดเป็น rem → ปรับที่ html ที่เดียว ขยายได้ทั้งหน้า
   คอม 16px · มือถือ 18px · เตรียมไว้ 3 ระดับ (html[data-fs] = "" ปกติ / "l" ใหญ่ / "xl" ใหญ่มาก) */
html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[data-fs="l"] { font-size: 112.5%; }
html[data-fs="xl"] { font-size: 125%; }
@media (max-width: 640px) {
  html { font-size: 112.5%; }
  html[data-fs="l"] { font-size: 125%; }
  html[data-fs="xl"] { font-size: 137.5%; }
}
@media print { html, html[data-fs] { font-size: 100% !important; } }
body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
/* ช่องกรอกไม่เล็กกว่าตัวหนังสือหลัก (มือถือ 18px → iPhone ไม่ซูมหน้าเอง) */
input, select, textarea { font-size: 1rem; }
.btn, button { line-height: 1.4; }
a { color: var(--brand); }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); min-height: 100vh; }
.shell > div { min-width: 0; }
.side {
  background: var(--side, var(--brand-2));
  color: rgba(255, 255, 255, .86);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; }
.brand img { width: 34px; height: 34px; }
.brand b { display: block; font-size: 1rem; }
.brand span { font-size: .875rem; opacity: .7; }
.market-pick { padding: 0 14px 12px; }
.market-pick select {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.08); color: #fff;
}
.market-pick select option { color: var(--ink); }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 2px 0;
  border-radius: 8px; color: inherit; text-decoration: none; font-size: .9375rem;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.on { background: #fff; color: var(--side, var(--brand-2)); font-weight: 600; }
.nav svg { width: 19px; height: 19px; flex: none; }
.side-foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: .875rem; }
.side-foot .who { color: #fff; font-weight: 600; }
.side-foot button { background: none; border: 0; color: rgba(255, 255, 255, .78); padding: 4px 0; cursor: pointer; text-decoration: underline; }

.topbar { display: none; }
.main { min-width: 0; padding: 22px 28px 90px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: min(17rem, 86vw); z-index: 50; height: 100%;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40;
    background: var(--side, var(--brand-2)); color: #fff; padding: 10px 12px;
  }
  .topbar b { flex: 1; font-size: .9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar button { background: none; border: 0; color: #fff; padding: 6px; display: grid; place-items: center; }
  .main { padding: 16px 16px 90px; }
}

/* ---------- common ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); font-size: .875rem; margin-top: 2px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card h2 { margin-bottom: 10px; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }

.stat { padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: .875rem; }
.stat .value { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .hint { font-size: .875rem; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 500;
  min-height: 38px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
/* ปุ่มอันตรายแบบทึบ (ใช้ในกล่องยืนยัน): แดงทึบ ตัวขาว */
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.solid:hover { background: var(--danger-2); border-color: var(--danger-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: .875rem; }
.btn svg { width: 1.0625rem; height: 1.0625rem; flex: none; }
.icon-btn { background: none; border: 0; cursor: pointer; padding: 4px 8px; font-size: 1.375rem; line-height: 1; color: var(--muted); border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--brand); color: #fff; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
/* มือถือ (ตัวอักษร 18px): ปุ่มแบ่งกลุ่มขึ้นบรรทัดใหม่แทนล้นขอบจอ */
@media (max-width: 640px) {
  .seg { flex-wrap: wrap; max-width: 100%; }
  .seg button { flex: 1 1 auto; white-space: nowrap; min-height: 40px; }
}

label.field { display: block; }
label.field > span { display: block; font-size: .875rem; color: var(--ink-2); margin-bottom: 4px; font-weight: 500; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; min-height: 38px;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: .875rem; padding: 9px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th.num, table.t td.num { text-align: right; } /* หัวคอลัมน์ตัวเลขชิดขวาให้ตรงกับตัวเลข */
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
table.t tfoot td { font-weight: 600; background: var(--surface-2); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .8125rem; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); border-color: #bfe3cc; color: var(--ok); }
.badge.warn { background: var(--warn-soft); border-color: #f5d7a8; color: var(--warn); }
.badge.danger { background: var(--danger-soft); border-color: #f2c3b8; color: var(--danger); }
.badge.void { text-decoration: line-through; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-color: var(--brand); font-weight: 600; }

.loading { padding: 40px; text-align: center; color: var(--muted); }
.alert { padding: 10px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); border: 1px solid #f5d7a8; font-size: .875rem; }
.alert.info { background: var(--brand-soft); color: var(--brand-2); border-color: #c4e0db; }
.alert.danger { background: var(--danger-soft); color: var(--danger); border-color: #f2c3b8; }

/* ---------- การกระทำผิด ---------- */
.vl-warn { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.vl-warn .small { color: var(--ink-2); }
.vl-warn .btn { margin-top: 4px; }
.vl-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.vl-photos:empty { display: none; }
.vl-thumb { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.vl-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.vl-thumb .icon-btn { position: absolute; top: 2px; right: 2px; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 99px; width: 26px; height: 26px; padding: 0; font-size: 1rem; line-height: 1; }
.vl-clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ---------- ปุ่มเลือก (ประเภทรายรับ / หมวดค่าใช้จ่าย) ---------- */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(8.75rem, 100%), 1fr)); gap: 8px; }
.pick-grid button { border: 1.5px solid var(--line-2); border-radius: 10px; padding: 9px 12px; background: var(--surface); text-align: left; cursor: pointer; font: inherit; color: var(--ink); line-height: 1.4; min-height: 44px; }
.pick-grid button:hover { border-color: var(--brand); }
.pick-grid button.on { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.pick-grid small { display: block; font-size: .875rem; color: var(--muted); font-weight: 400; }
.pick-other { margin-top: 8px; }
.qty-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qty-row input { width: 90px; text-align: center; }
.qty-row .btn { min-width: 40px; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px; border-radius: 10px; background: var(--brand-soft); }
.total-line b { font-size: 1.375rem; }

/* ---------- ตารางจดมิเตอร์ (มิเตอร์ × เดือน) ---------- */
.mg-wrap { max-height: 64vh; }
table.mg { border-collapse: separate; border-spacing: 0; }
table.mg thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); }
table.mg .mg-head { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 170px; max-width: 220px; box-shadow: 1px 0 0 var(--line); }
table.mg thead .mg-head { z-index: 3; background: var(--surface-2); }
.mg-month { text-align: center; min-width: 104px; }
.mg-month.cur { color: var(--brand); }
.mg-cell { vertical-align: top; min-width: 104px; }
.mg-cell input { width: 100%; min-width: 88px; text-align: right; padding: 5px 7px; font-variant-numeric: tabular-nums; }
.mg-cell.cur { background: rgba(15, 95, 88, .04); }
.mg-cell.chg { background: var(--warn-soft); }
.mg-cell.abn { background: var(--danger-soft); }
.mg-cell.abn .mg-sub { color: var(--danger); }
.mg-val { text-align: right; padding: 5px 7px; font-variant-numeric: tabular-nums; }
.mg-sub { font-size: .8125rem; color: var(--muted); text-align: right; margin-top: 2px; line-height: 1.3; }
.mg-bill { display: inline-block; min-width: 16px; text-align: center; border-radius: 99px; font-size: .8125rem; font-weight: 600; }
.mg-bill.ok { color: var(--ok); } .mg-bill.warn { color: var(--warn); }
.mg-off td { opacity: .55; }
.mg-save { position: sticky; bottom: 0; background: var(--bg, #f4f3ef); padding: 10px 0; margin-top: 8px; z-index: 4; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; text-align: left; }
button.link:hover { text-decoration: underline; }
tr.abn-row td { background: var(--danger-soft); }
.mg-thumb { display: inline-block; width: 40px; height: 40px; padding: 0; vertical-align: middle; cursor: zoom-in; }

/* ---------- กราฟในหน้ารายงาน ---------- */
.cc { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.cc-y { height: var(--h); display: flex; flex-direction: column; justify-content: space-between; font-size: .8125rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; transform: translateY(6px); }
.cc-main { min-width: 0; }
.cc-plot { position: relative; height: var(--h); display: flex; align-items: flex-end; border-bottom: 1px solid #c3c2b7; }
.cc-grid { position: absolute; left: 0; right: 0; border-top: 1px solid #ecebe6; pointer-events: none; }
.cc-b { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; position: relative; z-index: 1; cursor: default; outline: none; }
.cc-b:hover, .cc-b:focus-visible { background: rgba(15, 95, 88, .06); }
.cc-bar { display: block; border-radius: 4px 4px 0 0; min-height: 0; }
.cc-x { display: flex; font-size: .8125rem; color: var(--muted); margin-top: 4px; }
.cc-x span { flex: 1 1 0; min-width: 0; text-align: center; white-space: nowrap; overflow: visible; }
.cc-legend { display: flex; gap: 14px; font-size: .875rem; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.cc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cc-tip { position: absolute; z-index: 300; display: none; background: #18211f; color: #fff; font-size: .875rem; padding: 6px 10px; border-radius: 6px; pointer-events: none; max-width: 280px; white-space: pre-line; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.hb { display: flex; flex-direction: column; gap: 8px; }
.hb-row { display: grid; grid-template-columns: minmax(100px, 46%) 1fr auto 3.5rem; gap: 10px; align-items: center; font-size: .875rem; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 10px; background: #f1f0ec; border-radius: 4px; overflow: hidden; }
.hb-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.hb-val { text-align: right; font-variant-numeric: tabular-nums; }
.hb-pct { text-align: right; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: .875rem; margin-top: 4px; }
.kpi .delta.up { color: #006300; } .kpi .delta.down { color: var(--danger); } .kpi .delta.flat { color: var(--muted); }
.rp-period { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 560px) { .hb-row { grid-template-columns: 1fr auto 3.5rem; } .hb-track { grid-column: 1 / -1; order: 4; } }
.share-grid th, .share-grid td { text-align: center; }
.share-grid th:first-child, .share-grid td:first-child { text-align: left; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(16, 24, 22, .45); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: min(35rem, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(53.75rem, 100%); }
.modal > header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal > header h3 { flex: 1; font-size: 1.125rem; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 560px) {
  .modal-wrap { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; border-radius: 14px 14px 0 0; max-height: 92vh; }
}

/* กล่องยืนยัน: ปุ่ม "ไม่ทำ กลับไป" ซ้าย · ปุ่มยืนยันขวา (แยกคนละฝั่ง) */
.modal > footer.cb-foot { justify-content: space-between; gap: 12px 24px; }
.modal.is-danger > header h3 { display: flex; align-items: center; gap: 10px; }
.modal.is-danger > header h3 svg { width: 1.375rem; height: 1.375rem; flex: none; color: var(--danger); }
.cb-msg { margin: 0; white-space: pre-line; }
.cb-msg + .field { margin-top: 12px; }
@media (max-width: 560px) {
  /* มือถือ: ปุ่มเต็มแถว ซ้อนกัน · "ไม่ทำ กลับไป" อยู่ล่างสุด (นิ้วโป้งเอื้อมถึงง่าย) ห่างจากปุ่มยืนยัน */
  .modal > footer.cb-foot { flex-direction: column-reverse; align-items: stretch; gap: 14px; }
  .modal > footer.cb-foot .spacer { display: none; }
  .modal > footer.cb-foot .btn { width: 100%; min-height: 48px; flex: none; }
}
/* ข้อผิดพลาดในหน้าต่างที่เปิดอยู่: แสดงในกล่องเหนือปุ่ม (ไม่ทับปุ่ม) ค้างจนกดปิด */
.modal-alert { flex: none; display: flex; align-items: flex-start; gap: 8px; margin: 0 18px 12px; padding: 10px 6px 10px 12px; border-radius: 8px; background: var(--danger-soft); border: 1px solid var(--danger); color: var(--danger); font-weight: 600; }
.modal-alert > svg { width: 1.25rem; height: 1.25rem; flex: none; margin-top: .2rem; }
.modal-alert .ma-msg { flex: 1; min-width: 0; padding-top: 2px; }
.modal-alert .ma-x, .toast .toast-x { flex: none; width: 44px; height: 44px; margin: -8px 0; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; display: grid; place-items: center; }
.modal-alert .ma-x:hover { background: rgba(180, 35, 24, .1); }
.modal-alert .ma-x svg, .toast .toast-x svg { width: 1.125rem; height: 1.125rem; }

#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(28rem, calc(100% - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, .22); font-size: 1rem; animation: pop .18s ease; }
.toast.error { background: var(--danger); display: flex; align-items: flex-start; gap: 8px; padding-right: 6px; font-weight: 600; }
.toast.error .toast-msg { flex: 1; min-width: 0; padding-top: 2px; }
.toast .toast-x:hover { background: rgba(255, 255, 255, .15); }
.toast.ok { background: var(--brand); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
/* มือถือ: ข้อความแจ้งอยู่ด้านบน ไม่ทับปุ่มท้ายหน้าต่าง/แถบล่าง */
@media (max-width: 640px) {
  #toasts { top: calc(env(safe-area-inset-top, 0px) + 8px); bottom: auto; }
  @keyframes pop { from { transform: translateY(-8px); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--brand-2), #13403b 60%, #0c2f2b); }
.login .card { width: min(380px, 100%); padding: 28px 26px; }
.login h1 { margin: 12px 0 4px; }
.login form > * + * { margin-top: 12px; }
.login .btn { width: 100%; }

/* ---------- seat map ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .875rem; color: var(--ink-2); margin: 4px 0 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 16px; border-radius: 5px 5px 3px 3px; display: inline-block; border: 1px solid rgba(0,0,0,.12); }
/* คำอธิบายสีแบ่งกลุ่ม + จำนวนแผง */
.legend { gap: 8px; align-items: stretch; }
.legend .lg-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 7px 12px; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 10px; }
.legend .lg-title { font-weight: 700; color: var(--ink); font-size: .875rem; padding-right: 10px; border-right: 1px solid var(--line); }
.legend .n { font-weight: 700; color: var(--ink); min-width: 1ch; }
.legend .zero { opacity: .45; }
.map-card { padding: 18px; }
.map-scroll { overflow-x: auto; padding-bottom: 6px; }
.stage {
  margin: 0 auto 22px; width: min(70%, 640px); text-align: center; color: var(--muted); font-size: .875rem; letter-spacing: .08em;
  padding-top: 8px; border-top: 5px solid var(--line); border-radius: 50% 50% 0 0 / 14px 14px 0 0;
}
.seat-grid {
  --z: 1; --bw: 58px; --bh: 52px;
  --cw: calc(var(--bw) * var(--z)); --ch: calc(var(--bh) * var(--z));
  --af: .35; --aw: calc(var(--bw) * var(--af) * var(--z)); --ah: calc(var(--bh) * var(--af) * var(--z));
  display: grid; gap: calc(6px * var(--z)); margin: 0 auto; width: max-content; font-size: calc(.875rem * var(--z));
}
.run { display: flex; flex-direction: column; gap: calc(6px * var(--z, 1)); min-height: 0; min-width: 0; }
.run.h { flex-direction: row; }
.run > * { min-height: 0; min-width: 0; }
.editor-grid .run { gap: 4px; }
.seat-grid.tiny .seat .who, .seat-grid.tiny .seat.big .who { display: none; }
.map-card { position: relative; }
.zoombar { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-bottom: 8px; }
.zoombar button { width: 34px; height: 34px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; cursor: pointer; font-size: 1.125rem; line-height: 1; display: grid; place-items: center; }
.zoombar button:hover { background: var(--surface-2); }
.zoombar button.wide { width: auto; padding: 0 10px; font-size: .875rem; }
.zoombar span { min-width: 48px; text-align: center; font-size: .875rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.seat.big .who { max-width: none; font-size: .96em; white-space: normal; text-align: center; line-height: 1.2; }
.seat.big { border-radius: 12px 12px 6px 6px; }
.seat {
  position: relative; border: 1.5px solid var(--line-2); background: var(--st-free); color: var(--ink);
  border-radius: 12px 12px 5px 5px; cursor: pointer; padding: 3px 2px 6px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1.1; transition: transform .08s ease;
  font-size: inherit; overflow: hidden; min-width: 0;
}
.seat:hover { transform: translateY(-2px); }
.seat .code { font-weight: 600; }
.seat .who { font-size: .93em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.seat.st-free { background: var(--st-free); color: var(--st-free-ink, var(--ink)); }
.seat.st-occupied { background: var(--st-occupied); border-color: var(--st-occupied); color: var(--st-occupied-ink, #fff); }
.seat.st-regular { background: var(--st-regular); border-color: var(--st-regular); color: var(--st-regular-ink, #fff); }
.seat.st-daily { background: var(--st-daily); border-color: var(--st-daily); color: var(--st-daily-ink, #fff); }
.seat.st-weekly { background: var(--st-weekly); border-color: var(--st-weekly); color: var(--st-weekly-ink, #fff); }
.seat.st-temp { background: var(--st-temp); border-color: var(--st-temp); color: var(--st-temp-ink, #fff); }
/* ฝากแผง: ขอบประ + สีฝาก เพื่อแยกจากแผงที่มีคนเช่าจริง */
.seat.st-held { background: var(--st-held); border: 2px dashed rgba(255,255,255,.85); outline: 2px solid var(--st-held); color: var(--st-held-ink, #fff); cursor: pointer; }
/* จองแล้ว (ค่าจองก่อนตลาดเปิด): ลายเส้นทแยง + สีจอง */
.seat.st-booked, .legend i.st-booked {
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.22) 0 5px, transparent 5px 10px), var(--st-booked);
  border-color: var(--st-booked); color: var(--st-booked-ink, #fff); cursor: pointer;
}
.seat.st-paused, .legend i.st-paused {
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.45) 0 6px, transparent 6px 12px), var(--st-paused);
  border-color: var(--st-paused-line); color: var(--st-paused-ink, var(--ink)); border-style: dashed;
}
.seat.partial { background-image: linear-gradient(180deg, transparent 50%, rgba(255,255,255,.85) 50%); color: var(--ink); }
.seat.partial .code { color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.3); }
/* แผงที่เลือก: เหลืองทอง + ขอบเข้ม (ไม่ซ้ำกับสีแผงที่มีคนเช่า) */
.seat.sel { background: var(--st-sel); border-color: var(--st-sel-ink); color: var(--st-sel-ink); box-shadow: 0 0 0 3px rgba(255,198,26,.45); }
.seat.sel::before { content: "✓"; position: absolute; top: -7px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--st-sel-ink); color: var(--st-sel); font-size: .875rem; font-weight: 700; display: grid; place-items: center; border: 1.5px solid #fff; }
.legend i.st-free { border-color: var(--line-2); }
.seat .flag { position: absolute; top: 3px; left: 4px; width: 7px; height: 7px; border-radius: 50%; background: #ff3b30; box-shadow: 0 0 0 1.5px #fff; }
@media (max-width: 640px) { .seat-grid { --bw: 48px; --bh: 46px; } .seat-grid:not(.zoomed) .seat:not(.big) .who { display: none; } }

.selbar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 60;
  width: min(760px, calc(100% - 24px)); background: var(--ink); color: #fff; border-radius: 14px;
  padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.selbar .info { flex: 1; min-width: 0; }
.selbar .info b { font-size: .9375rem; }
.selbar .info div { font-size: .875rem; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selbar .btn { border-color: rgba(255,255,255,.25); background: transparent; color: #fff; }
.selbar .btn.primary { background: var(--accent); border-color: var(--accent); color: #1b1300; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: .875rem; }

.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(9.375rem, 100%), 1fr)); gap: 8px; }
.choice label { border: 1.5px solid var(--line-2); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: block; }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice label:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice b { display: block; }
.choice small { color: var(--muted); }
@media (max-width: 480px) { .choice { grid-template-columns: 1fr; } }

.vendor-results { border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; max-height: 210px; overflow-y: auto; }
.vendor-results button { display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: #fff; border-bottom: 1px solid var(--line); cursor: pointer; }
.vendor-results button:hover { background: var(--brand-soft); }
.picked { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--brand-soft); border: 1px solid #c4e0db; }

.summary-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.summary-box .line { display: flex; justify-content: space-between; gap: 12px; font-size: .875rem; padding: 2px 0; }
.summary-box .line.total { font-weight: 700; font-size: 1.0625rem; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 8px; }

.kv { display: grid; grid-template-columns: minmax(0, 8.125rem) minmax(0, 1fr); gap: 4px 12px; font-size: .875rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.rental-box { border: 1px solid var(--line); border-left: 4px solid var(--c, var(--line-2)); border-radius: 8px; padding: 10px 12px; }
.rental-box + .rental-box { margin-top: 10px; }

/* ---------- layout editor ---------- */
.editor-grid { display: grid; gap: 4px; width: max-content; user-select: none; touch-action: none; }
.cell { border: 1px dashed var(--line); border-radius: 6px; background: #fff; font-size: .8125rem; display: grid; place-items: center; cursor: crosshair; overflow: hidden; text-align: center; line-height: 1.2; }
.cell small { display: block; font-weight: 400; font-size: .8125rem; opacity: .85; }
.cell.stall.merged { background: #2f4540; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.cell.pick { outline: 3px solid var(--accent); outline-offset: -2px; background-color: #fff3d6; }
.cell.stall.pick { background-color: #8a6a1f; }
.cell.corner, .seat.corner { position: relative; }
.cell.corner::after, .seat.corner::after {
  content: ""; position: absolute; top: 0; right: 0; width: 0; height: 0;
  border-top: 11px solid var(--accent); border-left: 11px solid transparent; border-top-right-radius: inherit;
}
.cell.moving { outline: 3px solid var(--accent); outline-offset: -2px; }
.cell.stall { border-style: solid; color: #fff; font-weight: 600; border-color: transparent; background: #4b5b57; }
.cell.stall.nocat { background: #fff; color: var(--danger); border: 1.5px dashed var(--danger); }
.palette { display: flex; flex-wrap: wrap; gap: 6px; }
.palette button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; border: 1.5px solid var(--line-2); background: #fff; cursor: pointer; }
.palette button.on { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(0,0,0,.08); }

.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

@media print { body > *:not(#print-root) { display: none !important; } }

/* ---------- ตะกร้า (พักรายการ) ---------- */
.nav-badge { margin-left: auto; background: var(--accent); color: #1b1300; border-radius: 99px; font-size: .8125rem; font-weight: 700; padding: 0 7px; line-height: 20px; min-width: 20px; text-align: center; }
.tb-badge { position: absolute; top: 0; right: 0; background: var(--accent); color: #1b1300; border-radius: 99px; font-size: .8125rem; font-weight: 700; padding: 0 5px; line-height: 16px; }
.nav-badge.hidden, .tb-badge.hidden { display: none; }

/* ---------- ค่าบริการเสริม "อื่นๆ" ในฟอร์มเช่า ---------- */
.custom-addon { display: grid; grid-template-columns: minmax(0, 1fr) 6rem 7.5rem 4rem auto; gap: 6px; align-items: center; }
@media (max-width: 560px) { .custom-addon { grid-template-columns: 1fr 1fr; } .custom-addon > :first-child { grid-column: 1 / -1; } }

/* ---------- ตั้งค่าประเภทการเช่า ---------- */
.rt-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.rt-head .grow { flex: 1; min-width: 160px; }
.map-label { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; color: var(--ink-2, inherit); }
.map-label select { width: auto; }

/* ---------- หน้าคิดเงิน ---------- */
.cashpad { display: grid; gap: 12px; }
.cp-due, .cp-change { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); }
.cp-due b { font-size: 1.625rem; }
.cp-change b { font-size: 1.375rem; color: var(--ok); }
.cp-in { font-size: 1.625rem !important; text-align: right; padding: 12px 14px !important; font-weight: 600; }
.cp-label { font-size: .9375rem; font-weight: 600; margin-bottom: -4px; }
/* วิธีชำระ: ปุ่มใหญ่แยก 2 ปุ่ม */
.cp-method { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cp-method button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; font-size: 1.0625rem; font-weight: 600;
  border: 2px solid var(--line-2); border-radius: 12px; background: var(--surface, #fff); color: var(--ink); cursor: pointer; }
.cp-method button.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.cp-ico { font-size: 1.25rem; }
/* ปุ่มลัดจำนวนเงิน: ใหญ่ กดง่าย */
.cp-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr)); gap: 8px; }
.cp-quick button { padding: 12px 8px; font-size: 1.0625rem; font-weight: 600; border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.cp-quick button:hover { border-color: var(--brand); color: var(--brand); }
/* หัวข้อในฟอร์มเช่า */
.sec-title { display: block; font-size: .9688rem; font-weight: 700; color: var(--ink); margin: 4px 0 8px; }
.sec-title .sub { font-size: .875rem; font-weight: 400; color: var(--muted); margin-left: 6px; }
#rentForm > *:has(.sec-title), #rentForm > .sec-title { border-top: 1px solid var(--line); padding-top: 12px; }
#rentForm > label.field:has(.sec-title) { border-top: 0; padding-top: 0; }

/* ---------- สรุปค่าใช้จ่ายในฟอร์มเช่า ---------- */
.bill { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface, #fff); }
.bill-sec { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.bill-h { display: flex; justify-content: space-between; font-weight: 600; font-size: .875rem; color: var(--ink-2, inherit); margin-bottom: 4px; }
.bill-h .tag { font-weight: 400; color: var(--muted); font-size: .875rem; margin-left: 6px; }
.bill-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.bill-row .d { font-size: .875rem; color: var(--muted); }
.bill-row .a { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bill-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; background: var(--brand-soft, #e7f3ef); }
.bill-total b { font-size: 1.375rem; }
.bill-note { padding: 8px 14px; font-size: .875rem; color: var(--muted); background: var(--surface-2); }
.bill-next { padding: 8px 14px; font-size: .875rem; display: flex; justify-content: space-between; border-top: 1px dashed var(--line); }

/* ---------- ขั้นตอนเช่า ---------- */
.steps { display: flex; gap: 6px; margin-bottom: 12px; font-size: .875rem; }
.steps span { flex: 1; text-align: center; padding: 6px 4px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.steps span.on { background: var(--brand); color: #fff; font-weight: 600; }
.steps span.done { background: var(--brand-soft, #e7f3ef); color: var(--brand); }
.review dl.kv { margin: 0; }
.field > span.sec-title { font-size: .9688rem; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.bill-h { font-size: .9375rem; } .bill-row { font-size: .9063rem; } .bill-next { font-size: .875rem; }
/* หน้ารับเงิน: เว้นระยะให้อ่านง่าย */
.cashpad { gap: 16px; }
.cp-cash { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.cp-label { margin: 0; }
.cp-change { margin-top: 4px; }
.bill-row .d { font-size: .875rem; line-height: 1.55; margin-top: 2px; }
/* ---------- ช่องวันที่ วัน/เดือน/ปี ---------- */
.dmy { position: relative; display: inline-flex; align-items: stretch; width: 100%; min-width: 150px; }
.toolbar .dmy, .row .dmy { width: auto; }
.dmy-text { flex: 1; min-width: 0; padding-right: 40px !important; font-variant-numeric: tabular-nums; }
.dmy-text.bad { border-color: var(--danger) !important; background: #fff1f1; }
.dmy-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 1.0625rem; cursor: pointer; padding: 4px 6px; line-height: 1; }
.dmy-btn:disabled { opacity: .35; cursor: default; }
.dmy.locked .dmy-text { background: var(--surface-2); }
.dmy-native { position: absolute !important; left: 0; bottom: 0; width: 100% !important; height: 100% !important; opacity: 0; pointer-events: none; z-index: -1; }
/* ---------- ตั้งค่าใบเสร็จ + ตัวอย่าง ---------- */
.receipt-setup { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; max-width: 1100px; }
.receipt-preview { position: sticky; top: 12px; }
.receipt-preview .paper { background: #fff; color: #000; border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.12); padding: 6px 0; display: flex; justify-content: center; max-height: calc(100vh - 90px); overflow: auto; }
@media (max-width: 900px) { .receipt-setup { grid-template-columns: 1fr; } .receipt-preview { position: static; } }
/* ---------- เมนูเลือกคอลัมน์ ---------- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface, #fff); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 10px 12px; min-width: 220px; display: grid; gap: 6px; }
.perm-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; } .perm-group .grid { margin-top: 6px; }

/* หน้าต่างแผง (ผังตลาด) */
.sb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.sb-sec { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.sb-sec .sec-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 1.0313rem; padding-left: 10px; border-left: 4px solid var(--brand); line-height: 1.4; margin-bottom: 10px; }
.sb-sec .sec-title.minor { font-size: .9375rem; border-left-width: 3px; border-left-color: var(--line-2, var(--line)); }
/* คำเตือนของแผง/ผู้เช่า: ย่อเป็นแถบเดียว กดเพื่อกางดูรายละเอียด */
.warn-sum { border: 1px solid #f5d7a8; background: var(--warn-soft); color: var(--warn); border-radius: 8px; }
.warn-sum.danger { border-color: #f2c3b8; background: var(--danger-soft); color: var(--danger); }
.warn-sum > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: .875rem; }
.warn-sum > summary::-webkit-details-marker { display: none; }
.warn-sum > summary .ws-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn-sum > summary .ws-more { flex: none; font-size: .875rem; text-decoration: underline; }
.warn-sum[open] > summary .ws-more::after { content: " ▴"; }
.warn-sum:not([open]) > summary .ws-more::after { content: " ▾"; }
.warn-sum > .stack { padding: 0 10px 10px; }
.sb-sec .sec-title .sub { margin-left: 0; }
.sb-sec .sec-title a.sub { margin-left: auto; color: var(--brand, inherit); }
.sb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.sb-free { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border: 1px dashed var(--line-2, var(--line)); border-radius: 8px; padding: 12px; }
.sb-meters { display: grid; gap: 4px; margin-bottom: 10px; }
.sb-meter { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.sb-sec .sec-title .sec-act { margin-left: auto; font-size: .875rem; }
/* เมนู "เปลี่ยนแปลงการเช่า ▾" ในกล่องผู้เช่า */
.sb-dd .dropdown-menu { min-width: 210px; padding: 6px; gap: 4px; }
.sb-dd .dropdown-menu .btn { width: 100%; justify-content: flex-start; text-align: left; border-color: transparent; background: transparent; }
.sb-dd .dropdown-menu .btn:hover { background: var(--surface-2); }
.sb-dd .dropdown-menu .btn.danger { color: var(--danger); border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; }
/* ตารางที่กดทั้งแถวเพื่อดูรายละเอียด */
.t.rows-click tbody tr[data-invrow], .t.rows-click tbody tr[data-rentrow], .t.rows-click tbody tr[data-inv] { cursor: pointer; }
.t.rows-click tbody tr[data-invrow]:hover td, .t.rows-click tbody tr[data-rentrow]:hover td, .t.rows-click tbody tr[data-inv]:hover td { background: var(--brand-soft); }
.sb-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }

/* ไอคอนมิเตอร์บนแผง (หน้าแก้ไขผัง) */
.e-mtr { position: absolute; top: 1px; left: 2px; font-size: .8125rem; font-style: normal; line-height: 1; pointer-events: none; }
.editor-grid .stall { position: relative; }

/* ช่องเลือกจากรายการ (พิมพ์ค้นหาได้ ต้องกดเลือกจากรายการ) */
.combo { position: relative; }
.combo-box { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 40px; padding: 4px 30px 4px 6px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); position: relative; }
.combo-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.combo-box input { flex: 1; min-width: 120px; border: 0 !important; outline: none; box-shadow: none !important; padding: 4px; background: transparent; }
.combo-chips { display: contents; }
.combo-chips .chip { background: var(--brand-soft); border-color: #c4e0db; }
.combo-chips .chip button { border: 0; background: none; cursor: pointer; padding: 0 2px; font-size: .9375rem; line-height: 1; color: var(--muted); }
.combo-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 1.125rem; color: var(--muted); cursor: pointer; }
.combo-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow); }
.combo-opt { padding: 7px 10px; cursor: pointer; }
.combo-opt small { display: block; color: var(--muted); font-size: .875rem; }
.combo-opt.hi, .combo-opt:hover { background: var(--surface-2); }
.combo-opt.on { font-weight: 600; color: var(--brand); }
.combo-empty { padding: 10px; color: var(--muted); font-size: .875rem; }

/* แฟ้มเอกสารผู้ค้า */
.doc-need { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.doc-need-items { display: grid; gap: 4px; margin-top: 6px; }
.doc-need-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 8px; border-radius: 6px; background: var(--surface-2); font-size: .875rem; }
.doc-need-item.missing, .doc-need-item.expired { background: var(--danger-soft); color: var(--danger); }
.doc-need-item.expiring { background: var(--warn-soft); color: var(--warn); }
.doc-need-item.ok { color: var(--ok); }
.ok-text { color: var(--ok); font-weight: 600; }
.danger-text { color: var(--danger); font-weight: 600; }
.doc-drop { border: 2px dashed var(--line-2); border-radius: 10px; padding: 16px; text-align: center; margin: 10px 0; background: var(--surface-2); transition: background .15s, border-color .15s; }
.doc-drop.over { border-color: var(--brand); background: var(--brand-soft); }
.doc-pending { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.doc-pend-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.doc-pend-fields { flex: 1; display: grid; gap: 6px; min-width: 0; }
.doc-thumb { width: 56px; height: 56px; flex: none; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 1.375rem; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb.lg { width: 100%; height: 110px; text-decoration: none; }
.doc-pdf { font-weight: 700; color: var(--danger); font-size: .9375rem; letter-spacing: .5px; }
.doc-group { margin: 8px 0 12px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(10rem, 100%), 1fr)); gap: 10px; margin-top: 6px; }
.doc-card { border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-type { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
/* แฟ้มเอกสารแบบกะทัดรัด: 1 แถวต่อเอกสาร · กด "ดู" เพื่อเปิดไฟล์ */
.warn-text { color: var(--warn); }
.dsum { padding: 8px 12px; border-radius: 8px; margin-bottom: 8px; background: var(--danger-soft); color: var(--danger); }
.dsum.ok { background: var(--ok-soft); color: var(--ok); }
.dsum .muted { color: var(--muted); }
.dlist { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.drow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface); transition: background .15s; }
.dlist > .drow:first-child { border-top: 0; }
.drow.over { background: var(--brand-soft); outline: 2px dashed var(--brand); outline-offset: -3px; }
.drow-ic { flex: none; min-width: 92px; padding: 2px 8px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8125rem; white-space: nowrap; }
.drow.st-ok .drow-ic { background: var(--ok-soft); color: var(--ok); }
.drow.st-expiring .drow-ic { background: var(--warn-soft); color: var(--warn); }
.drow.st-missing .drow-ic, .drow.st-expired .drow-ic { background: var(--danger-soft); color: var(--danger); }
.drow-main { flex: 1; min-width: 0; line-height: 1.45; }
.drow-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dfiles { background: var(--surface-2); border-top: 1px solid var(--line); padding: 6px 12px 8px 46px; display: grid; gap: 6px; }
.dfile { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.dfile-thumb { width: 48px; height: 48px; flex: none; border-radius: 6px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; text-decoration: none; }
.dfile-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dfile-thumb .doc-pdf { font-size: .875rem; }
.dfile-info { flex: 1; min-width: 0; }
.dfile-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; }
.dfile-act { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.doc-drop.slim { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; text-align: left; padding: 8px 12px; margin: 8px 0; border-width: 1.5px; }
@media (max-width: 640px) { .drow { flex-wrap: wrap; } .drow-act { width: 100%; justify-content: flex-start; padding-left: 0; } .dfiles { padding-left: 12px; } }
.dshops { margin-bottom: 8px; flex-wrap: wrap; }

/* ย้ายแผง / ชำระล่วงหน้า */
.mv-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.mv-row.ok { border-color: #b8dfc6; background: var(--ok-soft); }
.mv-row.bad { border-color: #f1c0b6; background: var(--danger-soft); }
.mv-from { min-width: 48px; }
.pp-row { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; display: flex; }
.pp-review { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 2px; }
.rental-box.upcoming { border-style: dashed; border-left-style: solid; background: var(--surface-2); }
.rental-box.upcoming + .rental-box.upcoming { margin-top: 10px; }
/* ---------- ตรวจร้านค้า (อุปกรณ์ไฟฟ้า + ความสะอาด) — มือถือมาก่อน · ใช้เฉพาะหน้านี้ ---------- */
.insp-sw { margin-bottom: 10px; }
.insp-sw button { padding: 7px 16px; min-height: 44px; }
.insp-head { flex-wrap: nowrap; align-items: flex-start; margin-bottom: 10px; }
.insp-title { min-width: 0; }
.insp-more { flex: none; }
.insp-more > summary { min-height: 44px; min-width: 48px; font-size: 1.0625rem; }
.insp-more .dd-panel { min-width: min(18rem, calc(100vw - 32px)); }
.insp-more .dd-item { padding: 10px 12px; font-size: 1rem; }
.insp-tabs { margin-bottom: 12px; }
.insp-tabs button { min-height: 44px; }
.insp-hint { margin-bottom: 10px; }
.pc .link-btn, .el-fnote .link-btn, .ec-reg .link-btn { background: none; border: 0; padding: 0 4px; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; font-weight: 600; min-height: 44px; }
@media (max-width: 640px) {
  .insp-head .sub, .insp-more-t { display: none; }
  .insp-head h1 { font-size: 1.25rem; }
  /* ปุ่มสลับ + ⋯ แถวเดียว · ชื่อหน้าซ่อน (ซ้ำกับปุ่มสลับและแถบบน) */
  .insp-top.has-sw { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
  .insp-top.has-sw .insp-sw { flex: 1; min-width: 0; margin: 0; flex-wrap: nowrap; }
  .insp-top.has-sw .insp-sw button { padding: 6px 8px; }
  html[data-fs] .insp-top.has-sw .insp-sw button { white-space: normal; line-height: 1.25; }
  .insp-top.has-sw .insp-head { margin: 0; flex: none; }
  .insp-top.has-sw .insp-title { display: none; }
  .insp-tabs { margin-bottom: 10px; }
}
/* การ์ดความคืบหน้า */
.pc { padding: 12px 16px; margin-bottom: 12px; }
.pc-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.pc-n { font-size: 1.75rem; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.pc-u { font-weight: 600; color: var(--ink-2); }
.pc-done { margin-left: auto; color: var(--ink-2); font-size: .9375rem; }
.pc-done b { color: var(--ink); font-variant-numeric: tabular-nums; }
.pc-bar { height: 10px; margin: 6px 0 10px; }
.pc-bar i { background: var(--brand); }
.pc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.pc-date { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-left: auto; }
.pc-date.past { color: var(--warn); font-weight: 600; }
.pc-chip { min-height: 44px; padding: 6px 14px; border-radius: 99px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.pc-chip.danger { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.pc-chip.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.pc-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pc-chip.danger.on { background: var(--danger); border-color: var(--danger); }
.pc-date .dmy { width: 10.5rem; min-width: 0; }
.pc-date .dmy-text { min-height: 44px; }
.pc-date .dmy-btn { min-width: 40px; min-height: 40px; }
.pc-round { margin-top: 2px; }
.pc-extra { margin-top: 2px; }
@media (max-width: 640px) { .pc { padding: 10px 14px; } .pc-n { font-size: 1.625rem; } .pc-extra { display: none; } }
/* ค้นหา + ตัวกรอง + โซน */
.insp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.insp-bar input[type=search] { flex: 1 1 16rem; max-width: 22rem; min-height: 44px; }
.insp-f button { min-height: 38px; padding: 6px 16px; }
.el-zones { display: flex; gap: 8px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.el-zones button { flex: none; min-width: 48px; min-height: 40px; padding: 4px 14px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface); color: var(--ink-2); font: inherit; cursor: pointer; }
.el-zones button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (max-width: 640px) {
  .insp-bar input[type=search] { flex-basis: 100%; max-width: none; }
  .insp-f { display: flex; width: 100%; flex-wrap: nowrap; }
  .insp-f button { flex: 1 1 0; min-height: 44px; padding: 6px 4px; }
  .el-zones button { min-height: 44px; }
}
.el-fnote { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin-bottom: 8px; padding: 0 12px; background: var(--brand-soft); color: var(--brand-2); border-radius: 8px; }
/* แถวร้าน: คอม = แถวตาราง · มือถือ = การ์ด (รหัส+ชื่อร้าน / ชิป / สถานะเต็มบรรทัด / ปุ่มเต็มกว้าง) */
.el-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.el-chip { display: inline-flex; gap: 4px; align-items: baseline; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: .875rem; }
.el-chip.meter { background: var(--warn-soft); border-color: #f5d7a8; color: var(--warn); }
.el-free { display: inline-block; font-size: .875rem; font-weight: 600; color: var(--ok); background: var(--ok-soft); border-radius: 99px; padding: 0 6px; }
.el-list { display: flex; flex-direction: column; gap: 8px; }
.el-row { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) 11rem auto; gap: 6px 12px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.el-row.done { background: var(--surface-2); }
.el-code { font-weight: 700; font-size: 1.0625rem; word-break: break-word; }
.el-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.el-shop { min-width: 0; }
.el-todo { color: var(--ink-2); }
.el-st { min-width: 0; }
.el-btns { display: flex; gap: 8px; justify-content: flex-end; }
.el-btns .btn { min-height: 44px; min-width: 4.5rem; }
.el-row.mini { padding: 6px 12px; }
.el-row.mini .el-btns .btn { min-height: 40px; }
@media (max-width: 720px) {
  .el-row { grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; padding: 12px; }
  .el-code { grid-column: 1; grid-row: 1; }
  .el-main { grid-column: 2; grid-row: 1; }
  .el-st { grid-column: 1 / -1; }
  .el-btns { grid-column: 1 / -1; gap: 12px; margin-top: 4px; }
  .el-btns .btn { flex: 1 1 0; min-width: 0; min-height: 48px; padding-left: 6px; padding-right: 6px; }
  .el-row.mini { grid-template-columns: auto minmax(0, 1fr) auto auto; padding: 6px 6px 6px 12px; }
  .el-row.mini .el-st, .el-row.mini .el-btns { grid-column: auto; grid-row: 1; margin: 0; }
  .el-row.mini .el-shop { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .el-row.mini .el-shop .muted, .el-row.mini .el-shop .badge { display: none; }
  .el-row.mini .el-btns .btn { flex: none; min-width: 4rem; min-height: 44px; }
}
/* หน้าต่างตรวจ 1 ร้าน */
.ec-who { font-size: 1.0625rem; }
.ec-info { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--surface-2); }
.ec-info[open] { padding-bottom: 12px; }
.ec-info > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 44px; padding: 6px 0; cursor: pointer; list-style: none; }
.ec-info > summary::-webkit-details-marker { display: none; }
.ec-more { margin-left: auto; color: var(--brand); font-weight: 600; }
.ec-more::after { content: " ▸"; }
.ec-info[open] .ec-more::after { content: " ▾"; }
.ec-open { margin-top: 4px; }
.ec-note { padding: 8px 12px; border: 1px dashed var(--line-2); border-radius: 8px; }
.ec-count { display: flex; flex-direction: column; }
.ec-head { display: flex; justify-content: space-between; padding: 0 8px 4px; }
.ec-none { padding: 6px 8px; }
.ec-sep { margin-top: 10px; padding: 8px 8px 4px; border-top: 2px solid var(--line); color: var(--ink-2); font-weight: 600; }
.el-line { padding: 10px 8px; border-radius: 8px; border: 1px solid transparent; }
.el-line + .el-line { border-top-color: var(--line); }
.el-line.over { background: var(--danger-soft); border-color: #f2c3b8; }
.el-line.under { background: var(--warn-soft); border-color: #f5d7a8; }
.el-l1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.el-l2 { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 8px; margin-top: 6px; }
.el-l2 .el-was { margin-right: auto; }
.el-was { color: var(--ink-2); white-space: nowrap; }
.el-was b { color: var(--ink); font-size: 1.125rem; }
.el-to { color: var(--ink-2); white-space: nowrap; }
.el-step { display: flex; align-items: center; gap: 6px; }
.el-step input { width: 3.5rem; min-height: 48px; text-align: center; padding-left: 4px; padding-right: 4px; font-size: 1.125rem; font-weight: 700; }
.el-step .btn { min-width: 48px; min-height: 48px; padding: 0; font-size: 1.375rem; font-weight: 700; }
.el-act:empty { display: none; }
.el-act { margin-top: 10px; }
.el-act-q { margin-bottom: 6px; font-weight: 600; }
.el-fine { margin-top: 8px; min-height: 44px; }
/* ปุ่มเลือกวิธีจัดการ / ผลการติดตาม: ปุ่มใหญ่แทนวงกลมเล็ก */
.el-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 100%), 1fr)); gap: 8px; }
.el-choice.col { grid-template-columns: 1fr; }
.el-choice button { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; line-height: 1.35; text-align: left; cursor: pointer; }
.el-choice button::before { content: ""; flex: none; width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 2px solid var(--line-2); background: #fff; }
.el-choice button:hover { border-color: var(--brand); }
.el-choice button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); }
.el-choice button[aria-pressed="true"]::before { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px #fff; }
.el-choice button.bad[aria-pressed="true"] { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.el-choice button.bad[aria-pressed="true"]::before { border-color: var(--danger); background: var(--danger); }
.el-choice button:disabled { opacity: .55; cursor: not-allowed; }
.el-meter { background: var(--warn-soft); }
.el-hist { padding: 6px 0; border-top: 1px solid var(--line); }
.ec-hist > summary, .er-cust > summary, .er-opt > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; min-height: 44px; cursor: pointer; font-weight: 600; color: var(--brand-2); }
.ec-hist > summary::-webkit-details-marker, .er-cust > summary::-webkit-details-marker, .er-opt > summary::-webkit-details-marker { display: none; }
.ec-hist > summary::before, .er-cust > summary::before, .er-opt > summary::before { content: "▸"; width: 1em; }
.ec-hist[open] > summary::before, .er-cust[open] > summary::before, .er-opt[open] > summary::before { content: "▾"; }
.ec-reg { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; padding-top: 6px; border-top: 1px solid var(--line); }
.modal > footer .ec-save, .modal > footer .er-save, .modal > footer #rsOk, .modal > footer #clSave { white-space: normal; text-align: center; line-height: 1.35; }
@media (max-width: 640px) {
  .modal > footer.insp-foot { flex-wrap: nowrap; align-items: stretch; gap: 10px; }
  .insp-foot .spacer { display: none; }
  .insp-foot .btn[data-close] { flex: 0 1 7.5rem; white-space: normal; line-height: 1.25; padding-left: 8px; padding-right: 8px; }
  .insp-foot .btn.primary, .insp-foot .btn.danger { flex: 1 1 auto; min-height: 52px; white-space: normal; line-height: 1.3; }
}
/* หน้าต่างเพิ่ม/ลดอุปกรณ์ */
.er-table { display: flex; flex-direction: column; }
.er-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nm q" "err err"; gap: 4px 10px; align-items: center; padding: 8px; border-top: 1px solid var(--line); border-radius: 8px; }
.er-head { border-top: 0; padding-top: 0; padding-bottom: 2px; }
.er-head .er-q { text-align: center; }
.er-nm { grid-area: nm; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.er-q { grid-area: q; }
.er-free { display: none; }
.er-err { grid-area: err; }
.er-row.chg { background: var(--brand-soft); }
.er-was { flex-basis: 100%; font-size: .875rem; font-weight: 700; color: var(--brand-2); }
.er-was:empty { display: none; }
.show-free .er-row { grid-template-columns: minmax(0, 1fr) auto 4.5rem; grid-template-areas: "nm q free" "err err err"; }
.show-free .er-free { display: flex; grid-area: free; align-items: center; justify-content: center; gap: 4px; }
.er-row:not(.er-head) .er-free > span { display: none; }
.er-free input { width: 100%; min-height: 48px; text-align: center; }
.er-free input.bad { border: 2px solid var(--danger); background: var(--danger-soft); }
.er-sched { background: var(--warn-soft); }
.er-cx { min-width: 44px; min-height: 44px; }
.er-sum { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--surface-2); }
.er-sum > div:empty { display: none; }
@media (max-width: 640px) {
  .show-free .er-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nm nm" "q free" "err err"; }
  .show-free .er-row .er-q { justify-self: start; }
  .show-free .er-head { display: none; }
  .show-free .er-row:not(.er-head) .er-free > span { display: inline; color: var(--ink-2); }
  .show-free .er-free input { width: 4.5rem; }
}
/* พับอุปกรณ์ที่ไม่ค่อยใช้ (+ อุปกรณ์อื่น) */
.af-bar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; }
.af-open { min-height: 44px; }
.af-bar .af-q, .af-bar .af-none { display: none; }
.af-shown .af-bar .af-q { display: block; flex: 1 1 12rem; min-height: 44px; }
.af-empty .af-bar .af-none { display: block; flex-basis: 100%; }
.af-root:not(.af-shown) .af-more, .af-root .af-more.af-miss { display: none !important; }
/* ติดตามผล / ใบแจ้ง: การ์ดทีละเรื่อง ปุ่มเต็มกว้างบนมือถือ */
.rs-what { padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.rs-q { margin-bottom: 6px; font-weight: 600; }
.fu-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 48px; padding: 10px 12px; border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.fu-pick:hover { border-color: var(--brand); }
.fu-list { display: flex; flex-direction: column; gap: 8px; }
.fu-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.fu-top { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: 1.0625rem; }
.fu-what { margin: 2px 0; }
.fu-st { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin: 2px 0; }
.fu-age { color: var(--warn); }
.fu-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.fu-btns .btn { min-height: 44px; }
@media (max-width: 720px) {
  .fu-card { grid-template-columns: minmax(0, 1fr); }
  .fu-btns { gap: 10px 12px; }
  .fu-btns .btn { flex: 1 1 8rem; min-height: 48px; }
}
/* รายงาน */
.insp-range { gap: 8px; margin-bottom: 12px; }
.insp-range input[type=date] { width: auto; }
.insp-range .btn { min-height: 44px; }
.el-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(10.625rem, 100%), 1fr)); gap: 10px; }
.el-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.el-kpi-v { font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.el-kpi.ok .el-kpi-v { color: var(--ok); } .el-kpi.danger .el-kpi-v { color: var(--danger); } .el-kpi.warn .el-kpi-v { color: var(--warn); }
@media (max-width: 640px) { .el-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .el-kpi { padding: 8px 10px; } }
tr.el-bad td { background: var(--danger-soft); }
table.t.el-t { font-size: 1rem; }
table.t.el-t th { font-size: .9375rem; }
table.t.el-t td.small, table.t.el-t td .small { font-size: .9375rem; }
table.t.el-t .btn.sm { min-height: 40px; }
.tc-l { display: none; }
@media (max-width: 640px) {
  table.t-cards, table.t-cards tbody, table.t-cards tr, table.t-cards td { display: block; width: auto; }
  table.t-cards thead { display: none; }
  table.t-cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.t-cards tr:last-child { border-bottom: 0; }
  table.t.t-cards td { padding: 0; border: 0; }
  table.t.t-cards td.num { text-align: left; }
  .t-cards .tc-when { grid-column: 1 / -1; grid-row: 1; color: var(--ink-2); font-size: .9375rem; }
  .t-cards .tc-who { grid-column: 1; grid-row: 2; }
  .t-cards .tc-st { grid-column: 2; grid-row: 2; text-align: right; }
  .t-cards .tc-full, .t-cards .tc-by, .t-cards .tc-act { grid-column: 1 / -1; }
  .t-cards td:empty { display: none; }
  .t-cards .tc-l { display: inline; }
  .t-cards .tc-act .btn { width: 100%; min-height: 44px; margin-top: 6px; }
}
/* หน้าต่างตรวจความสะอาด */
.cl-items { display: flex; flex-direction: column; gap: 8px; }
.cl-items-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.cl-items-h .btn { min-height: 44px; }
.cl-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.cl-item.bad { background: var(--danger-soft); border-color: #f2c3b8; }
.cl-seg button { min-height: 44px; padding: 6px 14px; }
.cl-item.bad .cl-seg button.on { background: var(--danger); }
.cl-photo { min-height: 44px; }
@media (max-width: 640px) {
  .cl-seg { display: flex; width: 100%; flex-wrap: nowrap; }
  .cl-seg button { flex: 1 1 0; min-height: 48px; }
}
.cl-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; }
.cl-ph { position: relative; display: inline-block; }
.cl-ph button { position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: var(--danger); color: #fff; cursor: pointer; line-height: 1; }
.cl-items-edit { display: flex; flex-direction: column; gap: 6px; }
.cl-slip-prev { background: #fff; color: #000; border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow: auto; max-height: 640px; }
/* ค่าธรรมเนียม: เลือกหมวดแผงที่ต้องเสีย */
.fee-cats summary { cursor: pointer; white-space: nowrap; font-size: .875rem; color: var(--brand-2); }
.fee-cat-pop { min-width: 280px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
/* ---------- ค่าเช่าแผง ---------- */
/* ตัวกรองแถวเดียว: ค้นหา · โซน · หมวด · ประเภทการเช่า · [ตัวกรองเพิ่ม] — ที่เหลือพับไว้ */
.pr-fcard { margin-bottom: 10px; padding: 12px 14px; }
.pr-filters { display: grid; grid-template-columns: minmax(13rem, 2fr) repeat(3, minmax(8.5rem, 1fr)) auto; gap: 10px 12px; align-items: end; }
.pr-filters.pr-more { grid-template-columns: repeat(auto-fill, minmax(min(11rem, 100%), 1fr)); margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.pr-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; }
.pr-f > span { font-size: .875rem; color: var(--ink-2); font-weight: 500; }
.pr-f select, .pr-f input { width: 100%; min-width: 0; }
.pr-fbtns .btn { min-height: 38px; }
#fMore.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.pr-range { display: flex; align-items: center; gap: 6px; }
.pr-range input { flex: 1; }
@media (max-width: 1000px) { .pr-filters:not(.pr-more) { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pr-q { grid-column: 1 / -1; } }
@media (max-width: 560px) {
  .pr-filters:not(.pr-more), .pr-filters.pr-more { grid-template-columns: 1fr 1fr; }
  .pr-more .pr-f:has(.pr-range) { grid-column: 1 / -1; }
}
@media (max-width: 640px) { .pr-f select, .pr-f input, .pr-fbtns .btn, .pr-bar .btn { min-height: 44px; } .pr-fbtns .btn { width: 100%; } .pr-gbox { min-height: 44px; } }
.pr-bar { margin-bottom: 8px; gap: 8px 12px; position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 6px 0; flex-wrap: wrap; }
.pr-bar .btn { min-height: 38px; }
.pr-tip { color: var(--ink-2); font-size: .9375rem; }
.pr-xlmenu { min-width: 270px; padding: 6px; gap: 4px; }
.pr-xlmenu .btn { width: 100%; justify-content: flex-start; border-color: transparent; background: transparent; min-height: 44px; }
.pr-xlmenu .btn:hover { background: var(--surface-2); }
/* ตารางราคา: 16px · ราคาเด่น · หัวคอลัมน์ตัดบรรทัดได้ (เฉพาะ .pr-table) */
table.t.pr-table { font-size: 1rem; }
.pr-table th { white-space: normal; line-height: 1.35; vertical-align: bottom; }
.pr-table tr.pr-group td { background: var(--surface-2); padding-top: 8px; padding-bottom: 8px; }
.pr-table th.pr-sort { cursor: pointer; user-select: none; white-space: normal; }
.pr-table th.pr-sort:hover, .pr-table th.pr-sort.on { color: var(--brand); }
.pr-arrow { font-size: .8125rem; opacity: .6; white-space: nowrap; }
.pr-table th.pr-sort.on .pr-arrow { opacity: 1; }
.pr-sub, .pr-gstat { font-size: .875rem; color: var(--muted); font-weight: 400; }
.pr-code { font-size: 1.0625rem; }
.pr-price { font-size: 1.0625rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pr-per { font-size: .875rem; font-weight: 500; color: var(--muted); margin-left: 1px; }
.pr-diff { font-size: .875rem; }
.pr-table td.num { font-variant-numeric: tabular-nums; }
.pr-pend { display: block; width: fit-content; white-space: normal; font-size: .875rem; margin: 2px 0; text-align: left; border-radius: 8px; line-height: 1.4; padding: 2px 8px; }
.pr-table td.c-pend { min-width: 8.5rem; }
.pr-m { display: none; }
/* ช่องติ๊กเลือกแผง: กล่อง 22px · กดได้ทั้งช่อง 48px · กดที่แถวก็ได้ · แถวที่เลือกมีพื้นสี */
.t th.pr-pick, .t td.pr-pick { width: 52px; padding: 0; vertical-align: middle; }
.pr-table td.pr-pick { vertical-align: top; }
.pr-box { display: flex; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; cursor: pointer; margin: 0; }
.pr-box input { width: 22px; height: 22px; accent-color: var(--brand); cursor: pointer; margin: 0; }
.pr-gbox { display: inline-flex; min-width: 44px; min-height: 40px; vertical-align: middle; margin: -8px 2px -8px -10px; }
.pr-table tbody tr[data-rid] { cursor: pointer; }
.pr-table tbody tr[data-rid]:hover td { background: var(--surface-2); }
.pr-table tbody tr.is-picked td, .pr-table tbody tr.is-picked:hover td { background: var(--brand-soft); }
#prList.has-sel { padding-bottom: 120px; }
.pr-selbar .info b { font-size: 1.0625rem; }
.pr-selbar .info div { opacity: .85; }
.pr-selbar .pr-hidn { color: #ffd479; }
.pr-selbar .btn { min-height: 44px; }
.pr-selbar .sel-go { font-weight: 700; }
@media (max-width: 640px) {
  .selbar .sel-go { flex: 2 1 10rem; }
  /* แท็บ 4 อัน: 2 × 2 ไม่หลุดจอ */
  .pr-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; overflow: visible; }
  .pr-tabs button { white-space: normal; min-height: 48px; padding: 8px 6px; line-height: 1.35; }
}
/* มือถือ: เหลือ ติ๊ก · แผง (+ร้าน) · ราคา — ราคาอยู่คอลัมน์ที่ 3 ไม่ต้องเลื่อนขวา */
@media (max-width: 560px) {
  .pr-table .c-shop, .pr-table .c-zone, .pr-table .c-type, .pr-table .c-std, .pr-table .c-pend { display: none; }
  .pr-table .pr-m { display: block; font-size: .9375rem; color: var(--ink-2); line-height: 1.45; }
  .pr-table td.num .pr-m { margin-top: 4px; }
  .pr-table td, .pr-table th { padding-left: 8px; padding-right: 8px; }
}

/* หน้าต่างปรับราคา: ① ปรับอย่างไร ② มีผลวันไหน ③ ตรวจสอบ · แถบสรุปติดเหนือปุ่มยืนยัน */
.pa { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.pa-step { min-width: 0; }
.pa-step { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; }
.pa-h { display: flex; align-items: center; gap: 10px; font-size: 1.0625rem; margin: 0 0 10px; }
.pa-n { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--brand); color: #fff; font-size: .9375rem; font-weight: 700; flex: none; }
.pa-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.pa-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; min-height: 48px; }
.pa-opt input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--brand); flex: none; }
.pa-opt b { display: block; }
.pa-opt small { display: block; font-size: .875rem; color: var(--muted); line-height: 1.45; }
.pa-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.pa-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-start; }
.pa-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pa-l { font-size: .875rem; font-weight: 600; color: var(--ink-2); }
.pa-seg button { min-height: 38px; padding: 6px 14px; font-weight: 600; }
.pa-f input[type=date] { width: auto; min-width: 11rem; }
/* ช่องวันที่ (ตัวช่วย dd/mm/yyyy): ผิด = ขอบแดงที่ช่องที่เห็น */
.dmy:has(input[aria-invalid="true"]) .dmy-text { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-soft); }
.pa-f .dmy { width: auto; min-width: 11rem; }
@media (max-width: 640px) { .pa-f .dmy-text { min-height: 44px; } .pa-f .dmy-btn { min-width: 44px; min-height: 44px; } }
.inp-unit { display: inline-flex; align-items: stretch; max-width: 100%; }
.inp-unit input { width: 9rem; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.inp-unit .u { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--line-2); border-left: 0; border-radius: 0 8px 8px 0; background: var(--surface-2); color: var(--ink-2); font-weight: 600; white-space: nowrap; }
#paVal { font-size: 1.125rem; font-weight: 700; }
.pa-durn input { width: 5rem; border-radius: 8px; }
.pa-dur { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.pa-dur select { width: auto; }
.pa-radio { min-height: 38px; }
.pa-radio input { width: 20px; height: 20px; }
.pa-hint { font-size: .875rem; color: var(--muted); line-height: 1.5; }
.pa-why-f { margin-top: 12px; }
.pa-more { margin-top: 8px; font-size: .9375rem; }
.pa-more > summary { cursor: pointer; color: var(--brand-2); font-weight: 600; min-height: 36px; display: inline-flex; align-items: center; list-style: none; }
.pa-more > summary::-webkit-details-marker { display: none; }
.pa-more ul { margin: 4px 0 0; padding-left: 1.2em; color: var(--ink-2); }
.pa-more li + li { margin-top: 4px; }
.pa-table { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.pa-table table.t { font-size: .9375rem; }
.pa-table th { position: sticky; top: 0; z-index: 1; }
.pa-table tr.is-zero td { background: var(--danger-soft); }
.pa-table tr.is-half td { background: var(--warn-soft); }
.modal > footer.pa-foot { display: block; padding: 12px 18px; }
.pa-footin { display: grid; gap: 10px; }
.pa-footin > div:empty { display: none; }
.pa-sum { font-size: 1.125rem; line-height: 1.5; color: var(--ink); }
.pa-sum b { font-weight: 700; }
.pa-sum.is-none { color: var(--muted); font-size: 1rem; }
.pa-dot { color: var(--muted); margin: 0 3px; }
.pa-sub { font-size: .9375rem; color: var(--ink-2); }
.pa-warns { display: grid; gap: 8px; }
.pa-warn { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; padding: 6px 12px; border-radius: 8px; background: var(--warn-soft); border: 1px solid #f5d7a8; color: var(--warn); font-size: .9375rem; }
.pa-warn.danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.pa-tick { font-weight: 700; color: var(--ink); min-height: 40px; }
.pa-warn > .pa-tick { margin-left: auto; }
.pa-tick input { width: 22px; height: 22px; }
.pa-actions { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pa-actions > .btn { min-height: 44px; }
.pa-go { display: flex; flex-direction: row-reverse; align-items: center; gap: 4px 12px; flex-wrap: wrap; justify-content: flex-start; }
.pa-go .btn { min-height: 44px; min-width: 12rem; font-size: 1.0625rem; font-weight: 700; }
.pa-why { font-size: .9375rem; color: var(--danger); font-weight: 600; text-align: right; max-width: 22rem; }
.pa-why:empty { display: none; }
.pa-skip { flex-basis: 100%; margin: 2px 0 0; padding-left: 1.2em; }
.pa-file { min-height: 44px; margin-top: 8px; }
@media (max-width: 700px) { .pa-methods { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .pa-step { padding: 10px 12px 12px; }
  .pa-sum { font-size: 1.0625rem; }
  .pa-actions { flex-direction: column-reverse; align-items: stretch; }
  .pa-actions .spacer { display: none; }
  .pa-actions > .btn { min-height: 48px; }
  .pa-go { flex-direction: column; align-items: stretch; }
  .pa-warn > .pa-tick { margin-left: 0; }
  .pa-go .btn { width: 100%; min-height: 48px; }
  .pa-why { text-align: left; }
  .pa-seg button, .pa-radio { min-height: 44px; }
}
/* ประวัติการปรับราคา */
.pr-hist { margin-bottom: 10px; }
.pr-hist.is-off { opacity: .62; }
.pr-hist.is-off:hover, .pr-hist.is-off:focus-within { opacity: .9; }
.pr-hhead { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }
.pr-htitle { flex: 1 1 18rem; min-width: 0; }
.pr-htitle > b { font-size: 1.0625rem; }
.pr-hmeta { font-size: .9375rem; color: var(--ink-2); }
.pr-hrev { margin-top: 6px; font-weight: 600; color: var(--ink-2); }
.pr-hitems { margin-top: 6px; }
.pr-hitems > summary { cursor: pointer; color: var(--brand-2); font-weight: 600; min-height: 36px; display: inline-flex; align-items: center; }
.pr-hlist { columns: 2 18rem; margin-top: 6px; font-size: .9375rem; }
.pr-hlist > div { break-inside: avoid; padding: 2px 0; }
.pr-hact { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.pr-hact .btn { min-height: 44px; }
/* ค่าเทศกาล */
.fs-intro { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; margin-bottom: 12px; }
.fs-intro-text { flex: 1 1 20rem; min-width: 0; }
.fs-intro h3 { font-size: 1.0625rem; }
.fs-intro p { margin: 2px 0 0; color: var(--ink-2); }
.fs-intro > .btn { min-height: 44px; }
.fs-card { margin-bottom: 10px; }
.fs-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-start; }
.fs-title { flex: 1 1 16rem; min-width: 0; }
.fs-title > b { font-size: 1.125rem; }
.fs-range { font-size: .9375rem; color: var(--ink-2); margin-top: 2px; }
.fs-money { text-align: right; font-size: .9375rem; }
.fs-rules { margin-top: 8px; }
.fs-rules table.t { font-size: .9375rem; }
.fs-no { width: 4.5rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.fs-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.fs-act .btn { min-height: 44px; }
.fs-act [data-del] { margin-right: 16px; }
.fs-sum { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; font-size: .9375rem; align-items: center; }
.fs-rule { padding: 10px 12px; }
.fs-rule.is-dead { border-color: var(--warn); background: #fffaf0; }
.fs-rule-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.fs-mv { min-width: 44px; min-height: 44px; padding: 0; }
.fs-rm { min-height: 44px; margin-left: 16px; }
.fs-rule-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 10px; align-items: end; }
.fs-rule-body .field { margin: 0; min-width: 0; }
.fs-rule-body div.field > span { display: block; font-size: .875rem; color: var(--ink-2); margin-bottom: 4px; font-weight: 500; }
.fs-amt .inp-unit { display: flex; }
.fs-amt .inp-unit input { width: 100%; }
.fs-rnote { margin-top: 8px; font-size: .9375rem; }
.fs-rnote:empty { display: none; }
@media (max-width: 640px) {
  .pa-more > summary, .pr-hitems > summary { min-height: 44px; }
  #fsRuleAdd { min-height: 44px; }
  .fs-dates .dmy-text { min-height: 44px; }
  .fs-dates .dmy-btn { min-width: 44px; min-height: 44px; }
}

/* หน้าภาพรวม: การ์ดกดเข้าหน้าข้อมูล · งานประจำ · แจ้งเตือน */
.card.go { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.card.go:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.go-arrow { color: var(--muted); font-size: .875rem; font-weight: 400; margin-left: auto; white-space: nowrap; }
.task-sec + .task-sec { margin-top: 12px; }
.task-h { font-weight: 600; font-size: .875rem; margin-bottom: 4px; }
.task-h.danger { color: var(--danger); } .task-h.ok { color: var(--ok); } .task-h.muted { color: var(--muted); }
.task-row, .notice-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child, .notice-row:last-child { border-bottom: 0; }
.notice-row.acked { opacity: .65; }
.task-row[data-task] { cursor: pointer; }
/* Hotspot (โซนราคาพิเศษ) */
/* แบบ ก (11 พ.ย. 2569): ป้าย Hotspot แถวบน → แถวแก้ไข → ผังเต็มความกว้าง (ใช้ .map-card/.zoombar/.seat-grid ของหน้าผังแผง) → แถบบันทึกติดล่างจอ */
.hs-intro { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; margin-bottom: 8px; }
.hs-intro p { margin: 0; color: var(--ink-2); }
.hs-intro .pa-more { margin-top: 0; }
.hs-intro .pa-more[open] { flex-basis: 100%; }
.hs-intro-m { display: none; }
@media (max-width: 640px) {
  /* มือถือ: คำอธิบายย้ายเข้าไปใน "วิธีคิด ▸" ให้ป้าย Hotspot ขึ้นมาใกล้บนสุด */
  .hs-intro > p { display: none; }
  .hs-intro-m { display: list-item; }
}
.hs-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.hs-pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 12px; max-width: 100%;
  border: 1.5px solid var(--line-2); border-radius: 99px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 1rem; line-height: 1.4; cursor: pointer;
}
.hs-pill:hover { background: var(--surface-2); }
.hs-pill:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.hs-pill .hs-pn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-pill .hs-pc { color: var(--ink-2); white-space: nowrap; }
.hs-pill.on { border: 3px solid var(--hs); padding: 0 14px 0 10px; background: color-mix(in srgb, var(--hs) 14%, var(--surface)); font-weight: 700; }
.hs-pill.on .hs-pc { color: var(--ink); }
.hs-pill.add { border-style: dashed; border-color: var(--brand); color: var(--brand); font-weight: 600; }
.hs-sw { flex: none; display: inline-block; width: 16px; height: 16px; border-radius: 4px; background: var(--hs); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.hs-editor { margin-bottom: 12px; }
.hs-edit { display: flex; flex-direction: column; gap: 12px; }
.hs-erow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.hs-erow .field { margin: 0; min-width: 0; }
.hs-edit div.field > span { display: block; font-size: .875rem; color: var(--ink-2); margin-bottom: 4px; font-weight: 500; }
.hs-color { width: 44px; height: 44px; padding: 2px; flex: none; }
.hs-fname { flex: 1 1 12rem; }
.hs-fname input { width: 100%; min-height: 44px; }
.hs-famt { flex: 0 1 10.5rem; }
.hs-famt .inp-unit { display: flex; }
.hs-famt .inp-unit input { width: 100%; min-height: 44px; }
.hs-seg button { min-height: 40px; padding: 6px 14px; }
.hs-fmode .hs-seg button { min-height: 38px; }
.hs-erow2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.hs-tool button { min-height: 44px; padding: 6px 16px; font-weight: 600; }
.hs-del { min-height: 44px; margin-left: 24px; }
.hs-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; color: var(--ink-2); }
.hs-empty .btn { min-height: 48px; font-size: 1.0625rem; }
.hs-mapcard { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.hs-mapcard > .zoombar { margin: 0; }
.hs-mapcard > .hs-wrap { flex: 1 1 100%; }
.hs-maphead { flex: 1 1 24rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.hs-mode { font-size: 1rem; color: var(--ink-2); line-height: 1.5; }
.hs-mode b { color: var(--ink); }
.hs-modechip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; margin-right: 4px; border: 2px solid var(--hs); border-radius: 99px; font-weight: 700; color: var(--ink); background: color-mix(in srgb, var(--hs) 12%, var(--surface)); }
.hs-bar .info div { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hs-step { margin: 0 0 6px; }
.hs-opts { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 20px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.hs-opts > .hs-step { flex: 1 1 100%; margin: 0; }
.hs-opts .pa-tick { flex: 1 1 18rem; }
.hs-chg { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: .9375rem; }
.hs-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
@media (max-width: 640px) {
  .hs-seg button { min-height: 44px; }
  .hs-fname { flex: 1 1 calc(100% - 64px); }
  .hs-fmode { flex: 1 1 100%; }
  .hs-fmode .hs-seg { display: flex; }
  .hs-fmode .hs-seg button, .hs-tool button { flex: 1; min-height: 44px; }
  .hs-famt { flex: 1 1 calc(50% - 7px); }
  .hs-tool { display: flex; flex-wrap: nowrap; flex: 1 1 100%; }
  .hs-tool .hs-long { display: none; }
  .hs-erow2 > .spacer { display: none; }
  .hs-del { flex: 1 1 100%; margin: 8px 0 0; }
  .hs-mapcard { align-items: stretch; }
  .hs-mapcard > .hs-wrap { flex: none; min-width: 0; max-width: 100%; }
  .hs-maphead { flex: none; }
  .hs-mode { font-size: 1.0625rem; }
  #hsGrid .seat-grid { --bw: 2.6667rem; --bh: 2.5556rem; }
  #hsGrid .seat-grid, #hsGrid .seat-grid .run { gap: calc(8px * var(--z, 1)); }
}
.hs-wrap { position: relative; overflow: auto; user-select: none; touch-action: pan-x pan-y; padding-bottom: 6px; }
.hs-rect { position: absolute; border: 2px dashed var(--brand); background: rgba(13, 110, 90, .08); pointer-events: none; z-index: 2; }
.seat.hot { border-color: var(--hs); box-shadow: inset 0 0 0 2px var(--hs); }
.hs-wrap .seat.hot { background: color-mix(in srgb, var(--hs) 22%, #fff); }
.seat.hot::before { content: "★"; position: absolute; top: 1px; left: 3px; font-size: .78em; color: var(--hs); line-height: 1; }
input.phone-bad { border-color: var(--danger) !important; background: var(--danger-soft); }
.task-row[data-task]:hover b, .task-row[data-task]:hover s { color: var(--brand); text-decoration: underline; }
.notice-detail { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pct { color: var(--muted); font-size: .875rem; margin-left: 6px; display: inline-block; min-width: 58px; text-align: right; }

/* ---- การจองแผง (ค่าจอง) ---- */
.bk-pick .seat { cursor: pointer; }
.bk-pick .seat.st-free:hover { outline: 2px solid var(--accent); }
.bk-pick .seat.pick { background: var(--st-sel); border-color: var(--st-sel-ink); color: var(--st-sel-ink); outline: 2px solid var(--st-sel); }
.bk-pick .seat.na { opacity: .45; cursor: not-allowed; }
.bk-summary { display: flex; gap: 10px; flex-wrap: wrap; }
.bk-summary > div { flex: 1; min-width: 140px; }
.bk-summary b { font-size: 1.35rem; display: block; }
/* ผังแผงกว้างในหน้าต่าง: ไม่ดันหน้าต่างเกินจอ (เลื่อนผังในกรอบแทน) */
.modal-wrap > .modal { min-width: 0; }

/* ---------- เมนูรวมปุ่ม (เช่น "จัดการมิเตอร์ ▾") ---------- */
.dd-menu { position: relative; }
.dd-menu > summary { list-style: none; cursor: pointer; }
.dd-menu > summary::-webkit-details-marker { display: none; }
.dd-menu .dd-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 290px; background: var(--surface, #fff); border: 1px solid var(--line-2, var(--line)); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 6px; }
.dd-menu .dd-group + .dd-group { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.dd-menu .dd-title { font-size: .8125rem; font-weight: 700; color: var(--muted); padding: 6px 10px 2px; letter-spacing: .02em; }
.dd-menu .dd-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 7px; font: inherit; font-size: .875rem; color: var(--ink); text-decoration: none; cursor: pointer; }
.dd-menu .dd-item:hover { background: var(--surface-2); }
.dd-menu .dd-sub { display: block; font-size: .875rem; color: var(--muted); }

/* ---------- ค่าน้ำ-ค่าไฟ (มิเตอร์) — ใช้เฉพาะหน้านี้ · มือถือมาก่อน (เดินจดกลางตลาด) ---------- */
/* ตารางในหน้านี้และหน้าต่างของหน้านี้: ตัวหนังสือ 15px (เดิม 14px) */
.mtr table.t, .mtr-modal table.t { font-size: .9375rem; }
.mtr table.t th, .mtr-modal table.t th { font-size: .9375rem; }
.mtr-head { margin-bottom: 12px; }
.mtr-tabs { margin-bottom: 12px; }
.mtr-tabs button { min-height: 44px; }
.mtr-menu .dd-item { font-size: 1rem; padding: 10px 12px; }
.mtr-menu.up .dd-panel { top: auto; bottom: calc(100% + 6px); min-width: 260px; }
.mtr-menu .dd-item.danger { border-top: 1px solid var(--line); margin-top: 4px; }
/* แถบรอบจด: บรรทัดเดียว + แถบความคืบหน้า */
.mst { padding: 10px 14px; margin-bottom: 12px; }
.mst-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.mst-t { font-size: 1rem; }
.mst-n b { font-variant-numeric: tabular-nums; }
.mst-left { font: inherit; font-weight: 700; color: var(--warn); background: var(--warn-soft); border: 1px solid #f5d7a8; border-radius: 99px; padding: 2px 12px; min-height: 36px; cursor: pointer; }
.mst-left.due { color: var(--danger); background: var(--danger-soft); border-color: #f2c3b8; }
.mst-left:hover { border-color: currentColor; }
.mst-br { display: none; }
.mst-ok { font-weight: 600; color: var(--ok); }
.mst-date { font-size: .875rem; color: var(--muted); }
.mst-msel { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; color: var(--ink-2); }
.mst-msel select { width: auto; min-height: 40px; }
.mst-bar { height: 10px; margin: 8px 0 2px; }
.mst-bar i { background: var(--brand); }
.mst-pend { margin-top: 8px; }
.mst-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mst-refund { margin-bottom: 12px; }
/* ค้นหา + ตัวกรอง + ปุ่มเดินจด */
.mtr-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.mtr-bar input[type=search] { flex: 1 1 16rem; max-width: 26rem; min-height: 44px; }
.mtr-bar select { width: auto; min-height: 44px; }
.mtr-walk { display: none; min-height: 48px; font-weight: 700; }
.mtr-how { margin-bottom: 10px; color: var(--ink-2); }
.mtr-how > summary { cursor: pointer; display: inline-flex; align-items: center; min-height: 32px; color: var(--brand); font-weight: 600; font-size: .9375rem; }
.mtr-how > div { padding: 6px 0 2px; line-height: 1.7; }
.mtr-ro { margin-bottom: 10px; }
.mtr-save { display: flex; align-items: center; gap: 10px; }
.mtr-save:not(.has-pending) { display: none; }
.mtr-save .btn { min-height: 48px; font-weight: 700; }
/* กลุ่มโซน: หัวกลุ่มกดพับ/เปิด · "จดแล้ว x/y" */
.mz + .mz { margin-top: 14px; }
.mz-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; width: 100%; min-height: 48px; padding: 6px 12px; margin-bottom: 8px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.mz-head:hover { border-color: var(--brand); }
.mz-head.full { background: var(--ok-soft); border-color: #bfe3cc; }
.mz-name { font-weight: 700; font-size: 1.0625rem; }
.mz-n { color: var(--ink-2); }
.mz-n b { font-variant-numeric: tabular-nums; color: var(--ink); }
.mz-chev { width: 1.2em; color: var(--brand); font-weight: 700; }
.mz-hint { margin-left: auto; font-size: .875rem; color: var(--muted); }
/* การ์ดทีละมิเตอร์: สถานะเป็นป้ายคำ + ไอคอน มุมขวาบน · กรอบ 2px + พื้นอ่อนเฉพาะ "ยังไม่บันทึก" / "ผิดปกติ" */
.mc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(20.625rem, 100%), 1fr)); gap: 12px; align-items: start; }
.mc { background: var(--surface, #fff); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.mc.mc-dirty { border: 2px solid var(--warn); background: var(--warn-soft); padding: 11px 13px; }
.mc.mc-abn { border: 2px solid var(--danger); background: var(--danger-soft); padding: 11px 13px; }
.mc.mc-off { background: var(--surface-2); }
.mc-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.mc .mc-code { font-size: 1.1875rem; font-weight: 700; padding: 0; min-height: 32px; }
.mc-money { margin-left: auto; white-space: nowrap; }
.mc-stat { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: .875rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.mc-stat.todo { color: var(--ink-2); background: var(--surface-2); border-color: var(--line-2); }
.mc-stat.done { color: var(--ok); background: var(--ok-soft); border-color: #bfe3cc; }
.mc-stat.dirty { color: var(--warn); background: #fff; border-color: var(--warn); }
.mc-stat.abn, .mc-stat.bad { color: var(--danger); background: #fff; border-color: var(--danger); }
.mc-stat.off { color: var(--ink-2); background: var(--surface-2); border-color: var(--line-2); }
.mc-who { font-size: .9375rem; color: var(--ink-2); margin-top: -4px; }
.mc-nums { display: grid; grid-template-columns: 1fr auto 1.3fr; align-items: end; gap: 10px; padding: 10px 0; border-top: 1px dashed var(--line-2); border-bottom: 1px dashed var(--line-2); }
.mc-lbl { font-size: .875rem; color: var(--muted); margin-bottom: 3px; }
.mc-big { font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.mc-arrow { color: var(--muted); font-size: 1.125rem; padding-bottom: 8px; }
.mc-input { width: 100%; font-size: 1.375rem; font-weight: 700; text-align: right; padding: 8px 10px; min-height: 48px; font-variant-numeric: tabular-nums; }
.mc-input.sm { font-size: 1rem; padding: 6px 8px; min-height: 44px; }
.mc-calc { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; font-size: .9375rem; }
.mc-amt { font-size: 1.1875rem; }
.mc-bad { color: var(--danger); font-weight: 600; }
.mc-msg { font-size: .9375rem; line-height: 1.5; padding: 6px 10px; border-radius: 8px; border: 1px solid; }
.mc-msg + .mc-msg { margin-top: 6px; }
.mc-msg.bad { color: var(--danger); background: #fff; border-color: #f2c3b8; font-weight: 600; }
.mc-msg.warn { color: var(--warn); background: #fff; border-color: #f5d7a8; font-weight: 600; }
.mc-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.mc-foot .btn { min-height: 44px; }
.mc-act { display: inline-flex; gap: 16px; margin-left: auto; }
.mc-act:empty { display: none; }
.mc-save { min-width: 6.5rem; font-weight: 700; }
.mc .mg-thumb { width: 44px; height: 44px; }
.mc.mc-dirty [data-charge] { display: none; }
/* การ์ดที่จดแล้ว: ย่อเหลือบรรทัดเดียว (กดเพื่อเปิดแก้) */
.mc.mc-mini { padding: 0; gap: 0; background: var(--surface-2); border-color: var(--line); }
.mc-line .badge, .mc-v { flex: none; }
.mc-line { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; width: 100%; min-height: 48px; padding: 6px 12px; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; border-radius: 10px; }
.mc-line:hover { background: var(--surface); }
.mc-ok { color: var(--ok); font-weight: 700; }
.mc-c { font-size: 1.0625rem; flex: none; white-space: nowrap; }
.mc-ok, .mc-a, .mc-chev { flex: none; white-space: nowrap; }
.mc-s { flex: 1 1 5em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.mc-v { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.mc-a { font-weight: 700; font-variant-numeric: tabular-nums; }
.mc-chev { color: var(--brand); font-weight: 700; }
.badge.info { background: var(--brand-soft); color: var(--brand-2); }
/* แผงที่ยังไม่จด: กดได้ → ไปการ์ดนั้น */
.chip-go { cursor: pointer; border: 1px solid var(--line-2, var(--line)); background: var(--surface, #fff); font: inherit; min-height: 40px; padding: 4px 12px; }
.chip-go:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
@keyframes mcFlash { 0%, 60% { box-shadow: 0 0 0 4px rgba(242,165,22,.55); } 100% { box-shadow: none; } }
.mc.mc-flash { animation: mcFlash 1.8s ease-out; }
@media (prefers-reduced-motion: reduce) { .mc.mc-flash { animation: none; outline: 3px solid var(--accent); } }
/* หน้าต่างยืนยันบันทึก: บรรทัดต่อมิเตอร์ + ยอดรวม */
.cf-list { display: flex; flex-direction: column; gap: 8px; }
.cf-line { padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px; }
.cf-line.abn { border-color: var(--danger); background: var(--danger-soft); }
.cf-calc { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; margin-top: 2px; }
.cf-amt { font-size: 1.125rem; }
.cf-eff { font-size: .9375rem; margin-top: 4px; color: var(--ink-2); }
.cf-eff.warn { color: var(--warn); font-weight: 600; }
.cf-eff.bad { color: var(--danger); font-weight: 600; }
.cf-total { margin-top: 10px; }
/* ใช้ค่าเฉลี่ย: ตัวเลือกเป็นแถว ช่องตัวเลขอยู่ในบรรทัด (มือถือไม่ล้น) */
.cm-opts { display: flex; flex-direction: column; gap: 8px; }
.cm-opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; }
.cm-opt:has(input[type=radio]:checked) { border-color: var(--brand); background: var(--brand-soft); }
.cm-opt > input[type=radio] { width: 20px; height: 20px; margin-top: 4px; flex: none; accent-color: var(--brand); }
.cm-in { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.cm-in input { width: 5.5rem; min-height: 40px; text-align: right; }
.cm-new { flex-wrap: wrap; gap: 4px 12px; }
/* ช่องตัวเลข + หน่วยติดช่อง */
.in-unit { display: flex; align-items: center; gap: 8px; }
.in-unit input { flex: 1; min-width: 0; }
.in-unit > span { white-space: nowrap; color: var(--ink-2); }
/* นำเข้า: ปุ่มเลือกไฟล์ภาษาไทย */
.io-file-in { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.io-file label.btn { cursor: pointer; }
.io-file:focus-within label.btn { outline: 2px solid var(--brand); outline-offset: 1px; }
/* ออกใบแจ้งหนี้: แถบสรุปติดล่างจอ */
.mtr-ibar { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 -4px 16px rgba(16, 24, 22, .08); }
.mib-sum { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mib-sum b { font-size: 1.375rem; font-variant-numeric: tabular-nums; }
.mtr-ibar .btn { margin-left: auto; min-height: 48px; font-weight: 700; }
tr.mtr-sub td { background: var(--surface-2); border-top: 0; }
.mtr-sub-t { font-weight: 600; color: var(--ink-2); }
/* โหมดเดินจด (มือถือ): ทีละมิเตอร์เต็มจอ */
.mw { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; flex-direction: column; }
.mw-top { display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; background: var(--brand-2); color: #fff; }
.mw-title { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.mw-count { font-weight: 700; font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, .16); border-radius: 99px; padding: 0 10px; }
.mw-exit { min-height: 48px; background: #fff; color: var(--brand-2); border-color: #fff; font-weight: 700; }
.mw-bar { height: 8px; border-radius: 0; }
.mw-bar i { background: var(--brand); border-radius: 0; }
.mw-body { flex: 1; overflow-y: auto; padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.mw-zone { color: var(--ink-2); font-size: .9375rem; }
.mw-code { font-size: 1.75rem; font-weight: 700; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mw-who { color: var(--ink-2); margin-top: -6px; }
.mw-nums { display: grid; gap: 12px; }
.mw-prevn { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; }
.mw-prevn b { font-size: 1.75rem; font-variant-numeric: tabular-nums; }
.mw-in { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.mw-input { font-size: 2rem; font-weight: 700; text-align: right; min-height: 64px; padding: 8px 14px; border-width: 2px; font-variant-numeric: tabular-nums; }
.mw-input.sm { font-size: 1.25rem; min-height: 48px; width: 9rem; }
.mw-calc { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 1rem; }
.mw-amt { font-size: 1.75rem; font-variant-numeric: tabular-nums; }
.mw-photo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mw-photo .btn { min-height: 52px; }
.mw-snap { flex: 1 1 100%; font-weight: 700; }
.mw-snap.need { border: 2px solid var(--warn); color: var(--warn); }
.mw-thumb { width: 72px; height: 72px; padding: 0; cursor: zoom-in; }
.mw-skip { align-self: flex-start; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.mw-done { margin: auto 0; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.mw-done-t { font-size: 1.5rem; font-weight: 700; color: var(--ok); }
.mw-foot { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line-2); box-shadow: 0 -4px 16px rgba(16, 24, 22, .08); }
.mw-why { color: var(--danger); font-weight: 600; font-size: .9375rem; min-height: 0; }
.mw-why:not(:empty) { margin-bottom: 6px; }
.mw-btns { display: flex; gap: 16px; }
.mw-btns .btn { min-height: 56px; font-size: 1.0625rem; white-space: normal; line-height: 1.3; }
.mw-prev { flex: 1 1 0; }
.mw-next { flex: 2 1 0; font-weight: 700; }
@media (max-width: 640px) {
  /* ชื่อหน้า/คำอธิบายซ่อน (ซ้ำกับแถบบน) · ปุ่มสลับไฟ/น้ำ + เมนูจัดการ แถวเดียว */
  .mtr-title { display: none; }
  .mtr-head { margin-bottom: 10px; }
  .mtr-tools { width: 100%; flex-wrap: nowrap; }
  .mtr-tools .seg { flex: 1; min-width: 0; flex-wrap: nowrap; }
  .mtr-tools .seg button { padding: 6px 6px; min-height: 44px; }
  html[data-fs] .mtr-tools .seg button { white-space: normal; line-height: 1.25; }
  .mtr-tools .dd-menu > summary { min-height: 44px; padding: 6px 10px; white-space: normal; line-height: 1.25; text-align: center; }
  /* แท็บ 3 ช่องกว้างเท่ากัน ไม่ตัดคำ (ตัวใหญ่ขึ้นบรรทัดใหม่แทน) */
  .mtr-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; overflow: visible; }
  .mtr-tabs button { white-space: normal; line-height: 1.3; padding: 8px 4px; min-height: 48px; text-align: center; }
  .mst { padding: 8px 12px; }
  .mst-row { gap: 2px 10px; }
  .mst-date { display: none; }
  .mst-msel > span { display: none; }
  .mst-msel select { min-height: 44px; max-width: 11rem; }
  .mst-br { display: block; flex-basis: 100%; height: 0; }
  .mst-left { min-height: 44px; }
  .chip-go { min-height: 44px; }
  .mtr-bar { flex-wrap: nowrap; }
  .mtr-bar input[type=search] { flex: 1 1 8rem; min-width: 0; max-width: none; }
  .mtr-bar select { flex: none; max-width: 9.5rem; }
  /* วิธีจดไปอยู่ท้ายรายการ · การ์ดขึ้นมาเร็วขึ้น */
  .mtr-g { display: flex; flex-direction: column; }
  .mtr-g > #gTable { order: 2; }
  .mtr-g > .mtr-how { order: 3; margin: 14px 0 0; }
  .mtr-g > .mtr-save { order: 4; }
  .mtr-save.can-walk { display: flex; }
  .mtr-save > .spacer { display: none; }
  /* การ์ดย่อ: บรรทัดเดียวจริงบนมือถือ (เลขมิเตอร์ดูได้เมื่อกดเปิด) */
  .mc-line .mc-v { display: none; }
  .mtr-walk { display: inline-flex; flex: 1 1 0; white-space: normal; line-height: 1.3; }
  .mtr-save.has-pending #gSaveAll { flex: 1.4 1 0; white-space: normal; line-height: 1.3; }
  .mc-foot .btn, .mc .mc-code { min-height: 48px; }
  .mc-act { width: 100%; justify-content: space-between; }
  .mc-save { flex: 1; }
  .mtr-save { position: sticky; bottom: 0; margin: 10px -16px -90px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line-2); box-shadow: 0 -4px 16px rgba(16, 24, 22, .08); }
  .mtr-save #gInfo { display: none; }
  .mtr-ibar .btn { flex: 1 1 100%; margin: 0; }
  /* ตารางในหน้านี้ → การ์ด (ไม่ต้องเลื่อนซ้าย-ขวา) */
  table.mtr-cards, table.mtr-cards tbody, table.mtr-cards tr, table.mtr-cards td { display: block; width: auto; }
  table.mtr-cards thead { display: none; }
  table.mtr-cards tr { padding: 10px 12px; border-bottom: 1px solid var(--line); position: relative; }
  table.mtr-cards tr:last-child { border-bottom: 0; }
  table.t.mtr-cards td { padding: 2px 0; border: 0; text-align: left; white-space: normal; }
  table.mtr-cards td[data-l] { display: flex; justify-content: space-between; gap: 12px; }
  table.mtr-cards td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: .875rem; flex: none; }
  table.mtr-cards td:empty, table.mtr-cards td[data-l=""] { display: none; }
  table.mtr-cards td.mc-pick { position: absolute; right: 12px; top: 10px; }
  table.mtr-cards td.mc-pick input { width: 26px; height: 26px; }
  table.mtr-cards td.mc-main { padding-right: 40px; font-size: 1.0625rem; }
  table.mtr-cards td.mc-act-c .btn { width: 100%; min-height: 44px; margin-top: 6px; }
  tr.mtr-sub { margin-left: 16px; border-radius: 0 0 8px 8px; }
}
/* หน้ารับชำระ: ค่าปรับจ่ายช้า */
.late-box { border: 1px solid var(--warn, #e0a100); background: rgba(242,165,22,.08); border-radius: 10px; padding: 10px 12px; gap: 8px; }
.late-box .seg { flex-wrap: wrap; }
/* เส้นคั่นกลุ่มแท็บ (ตั้งค่าตลาด) */
.tabs .tab-sep { flex: 0 0 1px; align-self: center; height: 20px; background: var(--line); margin: 0 6px; }

/* ---- เข้าระบบด้วย PIN ---- */
.login .pin-input { text-align: center; font-size: 1.625rem; letter-spacing: 10px; padding: 10px; }
.login .pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.login .pin-pad .btn { width: auto; min-height: 52px; font-size: 1.25rem; font-weight: 600; }
.login .pin-pad .btn.ghost { font-size: .9375rem; font-weight: 400; }
.login .link-btn { display: block; width: 100%; background: none; border: 0; padding: 6px; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; }
.login .link-btn.small { font-size: .875rem; }

/* ---- รายงาน: เป้ารายได้ · บันทึกประจำวัน · แผงและผู้ค้า ---- */
.tg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16.25rem, 100%), 1fr)); gap: 12px 24px; margin-top: 10px; }
.tg-row { display: flex; flex-direction: column; gap: 6px; }
.tg-track { height: 14px; }
.seg.wrap { flex-wrap: wrap; }
.hb-row.pct-row { grid-template-columns: minmax(70px, 30%) 1fr 3.5rem 3.75rem; }
.rf-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rf-row:last-child { border-bottom: 0; }
.rf-row > b { min-width: 110px; font-size: .875rem; }
.rf-row .check { font-size: .875rem; }
.rf-all { margin-left: auto; display: inline-flex; gap: 2px; }
/* รายงาน: เลือกชนิดกราฟ · กราฟเส้น · กราฟวงกลม · การ์ดตัวเลขกดได้ */
.ct-head { display: flex; justify-content: flex-end; margin: -4px 0 6px; }
.ct-sw button { padding: 3px 10px; font-size: .875rem; }
.cc-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
.cc-dot { position: absolute; width: 7px; height: 7px; border-radius: 50%; transform: translate(-50%, 50%); pointer-events: none; z-index: 3; box-shadow: 0 0 0 2px var(--surface); }
.pie-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.pie { position: relative; width: 170px; height: 170px; border-radius: 50%; flex: 0 0 auto; }
.pie-hole { position: absolute; inset: 26%; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.pie-hole b { font-size: .875rem; font-variant-numeric: tabular-nums; } .pie-hole small { color: var(--muted); font-size: .8125rem; }
.pie-legend { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pl-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 3.5rem; gap: 8px; align-items: center; font-size: .875rem; }
.pl-row i { width: 12px; height: 12px; border-radius: 3px; } .pl-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-val { text-align: right; font-variant-numeric: tabular-nums; } .pl-pct { text-align: right; color: var(--muted); font-size: .875rem; }
.kpi-go { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.kpi-go:hover, .kpi-go:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); outline: none; }
.kpi-go .go { font-size: .875rem; color: var(--brand); margin-top: 6px; }
.xl-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(12.5rem, 100%), 1fr)); gap: 8px 16px; }

/* ---------- บิล / รับชำระ ---------- */
.tabs .tab-n { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 99px; font-size: .8125rem; font-weight: 700; line-height: 18px; text-align: center; background: var(--surface-2); color: var(--ink-2); }
.tabs .tab-n:empty { display: none; }
.tabs .tab-n.warn { background: var(--danger-soft); color: var(--danger); }
.b-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; margin-bottom: 12px; }
.b-total .val .unit { font-size: .9375rem; font-weight: 600; color: var(--ink-2); }
.b-total .lbl { font-size: .875rem; color: var(--ink-2); font-weight: 600; }
.b-total .val { font-size: 1.625rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.b-total .cnt { font-size: .875rem; color: var(--muted); }
.b-total.warn .val { color: var(--warn); } .b-total.ok .val { color: var(--ok); } .b-total.danger .val { color: var(--danger); }
.b-act-row { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.row-dd > summary.btn { min-width: 32px; justify-content: center; font-weight: 700; letter-spacing: .05em; }
.dd-menu .dd-item.danger { color: var(--danger); }
.dd-menu .dd-item.danger .dd-sub { color: var(--danger); opacity: .75; }
.dd-menu .dd-item + .dd-item.danger { border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; margin-top: 2px; }
.t.rows-click tbody tr[data-inv]:hover td { background: var(--brand-soft); }

/* บิล: ตาราง */
.b-filter { flex-wrap: wrap; gap: 8px 12px; }
.b-dates { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.b-date-lbl { font-weight: 600; color: var(--ink-2); }
#bList.is-loading { opacity: .5; transition: opacity .15s ease-out; pointer-events: none; }
.b-table .b-id b { display: block; font-size: .9375rem; }
.b-table .b-id .link { color: var(--muted); }
.b-table .b-id .link:hover { color: var(--brand); text-decoration: underline; }
.b-table .b-who { min-width: 120px; max-width: 200px; }
.b-table .b-item { max-width: 340px; }
.b-sum { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.b-sum1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.b-table tr.b-group td { background: var(--surface-2); font-weight: 700; font-size: .875rem; color: var(--ink-2); padding-top: 8px; padding-bottom: 8px; }
.b-table tr.b-group td span { font-weight: 500; color: var(--muted); margin-left: 6px; }
.b-table tr.b-group.late td { color: var(--danger); }
.b-refund { color: var(--brand); }
.b-st-inline { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
summary.btn:focus-visible, .link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 1150px) { .b-table .b-item { max-width: 160px; } .b-table .b-who { min-width: 0; max-width: 115px; } .b-table .b-status { display: none; } .b-table .b-st-inline { display: block; margin-top: 3px; } .b-sum1 { max-width: 160px; } .b-table td.b-when { white-space: normal; min-width: 92px; } .b-table td.b-act .btn.sm { padding-left: 8px; padding-right: 8px; } .b-table td, .b-table th { padding-left: 7px; padding-right: 7px; } }

/* รับชำระ: บิลที่จ่าย · บิลค้างอื่นของผู้ค้า (ติ๊กจ่ายรวม) · หน้าสรุปหลังรับเงิน */
.pay-bill { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.pay-sum { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; margin-top: 2px; }
.pay-more { display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); border: 1px solid #f5d7a8; }
.pay-more > .row b { color: var(--warn); }
.pay-list { display: grid; gap: 4px; max-height: 210px; overflow-y: auto; }
.pay-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.pay-row.on { border-color: var(--brand); background: var(--brand-soft); }
.pay-row.off { cursor: default; opacity: .8; }
.pay-row input { width: 18px; height: 18px; flex: none; }
.pay-row-main { flex: 1; min-width: 0; display: grid; }
.pay-done { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 18px 8px 8px; }
.pay-done-mark { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.875rem; font-weight: 700; color: #fff; background: var(--ok); animation: payIn .35s cubic-bezier(.16,1,.3,1); }
.pay-done-title { font-size: 1.375rem; font-weight: 700; }
.pay-done-change { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; min-width: 260px; margin: 6px 0; padding: 14px 18px; border-radius: 12px; background: var(--ok-soft); }
.pay-done-change span { font-weight: 600; color: var(--ink-2); }
.pay-done-change b { font-size: 2.125rem; color: var(--ok); font-variant-numeric: tabular-nums; }
.pay-done-change.zero { background: var(--surface-2); } .pay-done-change.zero b { color: var(--ink-2); font-size: 1.625rem; }
@keyframes payIn { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pay-done-mark { animation: none; } }

/* ---------- หน้าผู้ค้า: หัวการ์ดมีเส้นคั่น · การ์ดยอดค้างเด่น · กล่องแผง (ขอบ 1px + ป้ายสีประเภทการเช่า) ---------- */
.v-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.v-head h2 { margin: 0; font-size: 1.0313rem; font-weight: 700; }
.v-head .badge { white-space: normal; }
.card .v-head + .table-wrap table.t th { border-top: 0; }
.v-sec { margin-top: 16px; }
.v-top > .card { display: flex; flex-direction: column; }
.v-hint { font-size: .875rem; color: var(--muted); padding: 8px 16px 6px; }
.v-regular { background: var(--st-regular); color: #fff; border-color: var(--st-regular); }
.v-money.owe { border-color: #f2c3b8; background: var(--danger-soft); }
.v-money.owe .v-head { border-bottom-color: #f2c3b8; }
.v-money.owe h2, .v-money.owe .v-money-amt, .v-money.owe .v-money-sub { color: var(--danger); }
.v-money.clear .v-money-amt { color: var(--ok); }
.v-money-amt { font-size: 1.875rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.v-money-sub { font-size: .875rem; margin-top: 2px; }
.v-money-btn { margin-top: 12px; width: 100%; justify-content: center; font-size: .9375rem; min-height: 42px; }
.v-money-hint { margin-top: 4px; color: var(--muted); }
.v-money.owe .v-money-hint { color: #8a3b28; }
.v-month { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.v-month b { color: var(--ink); font-weight: 600; }
.v-money.owe .v-month { border-top-color: #f2c3b8; color: #8a3b28; }
.v-rent { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.v-rent + .v-rent { margin-top: 10px; }
.badge.v-mode { color: color-mix(in srgb, var(--c) 82%, #000); background: color-mix(in srgb, var(--c) 10%, #fff); border-color: color-mix(in srgb, var(--c) 32%, #fff); font-weight: 600; }
.v-owe { color: var(--danger); font-variant-numeric: tabular-nums; }
table.v-list tbody tr:focus-visible td { background: var(--brand-soft); }
table.v-list tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* ---------- ผังแผง: แถบวันที่ + คำอธิบายสีพับได้ ---------- */
.map-tools .date-nav { display: flex; align-items: center; gap: 4px; }
.map-tools .date-nav input { width: auto; }
.legend-wrap { margin: 4px 0 12px; }
.legend-wrap > summary { display: inline-flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer; list-style: none; font-size: .875rem; font-weight: 600; color: var(--ink-2, var(--ink)); }
.legend-wrap > summary::-webkit-details-marker { display: none; }
.legend-wrap > summary::before { content: ''; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease-out; }
.legend-wrap[open] > summary::before { transform: rotate(45deg); }
.legend-wrap .lg-sum { font-weight: 400; color: var(--muted); }
.legend-wrap[open] .lg-sum { display: none; }
.legend-wrap .legend { margin: 6px 0 0; }
.legend .zero { display: none; }
@media (max-width: 640px) {
  .map-tools { width: 100%; }
  .map-tools .date-nav { width: 100%; }
  .map-tools .date-nav input { flex: 1; min-width: 0; }
  .map-tools .map-label { flex: 1; min-width: 0; }
  .map-tools .map-label select { flex: 1; min-width: 0; }
}

/* ---------- ฟอร์มเช่าแผง: เลขลำดับการกรอก · ช่องฟรีซ่อน · ยอดรวมที่แถบล่าง ---------- */
#rentForm { counter-reset: rstep; }
#rentForm .sec-title[data-n]::before {
  counter-increment: rstep; content: counter(rstep);
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; vertical-align: 1px;
  border-radius: 50%; background: var(--brand); color: #fff; font-size: .875rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
#rentForm > :empty, #extraBox > :empty { display: none; }
#rentForm:not(.sp-on) .afree { display: none; }
#extraBox { gap: 10px; }
#extraBox > :not(:first-child) .sec-title { font-size: .875rem; margin: 0 0 4px; }
#depBox.dep-empty .dep-h { display: none; }
#depBox.dep-empty #cDepAdd { margin-top: 0 !important; }
.sp-wrap { margin-top: -4px; }
.foot-total { display: inline-flex; align-items: baseline; gap: 8px; margin-right: 6px; font-size: .875rem; color: var(--muted); }
.foot-total b { font-size: 1.125rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.foot-total:empty { display: none; }
.steps .st-x { font-style: normal; }
@media (max-width: 560px) {
  .steps .st-x { display: none; }
  .rent-foot [data-close], .rent-foot .spacer { display: none; }
  .rent-foot .foot-total { flex: 1 1 100%; justify-content: space-between; margin: 0 0 2px; }
  .rent-foot #rentSave { flex: 1; }
  .choice { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
  .choice label { padding: 8px 10px; }
  .choice small { display: block; font-size: .875rem; line-height: 1.4; }
}

/* ---------- รายละเอียดแผง: ยอดเงินแบบกระชับ 2 ช่อง ---------- */
.sb-money { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sb-money button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.sb-money button:hover { border-color: var(--brand); }
.sb-money span { font-size: .875rem; color: var(--muted); }
.sb-money b { font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.sb-money .due b { color: var(--danger); }
/* ปุ่มไปต่อในฟอร์มเช่า: บอกว่ากด Enter ได้ (เฉพาะจอที่มีคีย์บอร์ด/เมาส์) */
@media (hover: hover) and (min-width: 700px) {
  .rent-foot #rentSave::after { content: 'Enter'; margin-left: 8px; padding: 1px 6px; border: 1px solid rgba(255,255,255,.45); border-radius: 5px; font-size: .8125rem; font-weight: 500; opacity: .85; }
}
.rent-foot #rentSave:disabled::after { display: none; }

/* ---------- ผังแผง: ค้นหาแผง + มือถือผังเต็มความกว้างจอ ---------- */
.map-find { display: flex; align-items: center; gap: 8px; }
.map-find input { width: 13.125rem; }
.seat-grid.finding .seat:not(.found) { opacity: .28; }
.seat.found { box-shadow: 0 0 0 3px var(--ink); z-index: 1; }
@media (max-width: 640px) {
  .map-find { width: 100%; }
  .map-find input { flex: 1; width: auto; min-width: 0; font-size: 1rem; }
  .map-card { margin: 0 -16px; padding: 10px 8px; border-radius: 0; border-left: 0; border-right: 0; }
  .zoombar { justify-content: center; }
}

/* ---------- ฟอร์มเช่า: แจ้งเมื่อระบบเปลี่ยนประเภทการเช่า/โหมดผู้ค้าให้ · ยอดเปลี่ยนมาก ---------- */
.type-note { margin-top: 8px; font-size: .875rem; line-height: 1.5; }
.foot-total.jump { animation: total-jump 1.6s ease-out; border-radius: 8px; }
@keyframes total-jump { 0%, 35% { background: var(--warn-soft); box-shadow: 0 0 0 6px var(--warn-soft); } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .foot-total.jump { animation: none; background: var(--warn-soft); } }

/* ---------- รายละเอียดแผง: แถบค้างชำระ + หัวข้อพับได้ ---------- */
.sb-due { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; background: var(--danger-soft); border: 1px solid #f2c3b8; }
.sb-due > div { flex: 1; display: flex; align-items: baseline; gap: 10px; color: var(--danger); }
.sb-due span { font-size: .875rem; }
.sb-due b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.sb-fold > summary { cursor: pointer; list-style: none; margin-bottom: 0; }
.sb-fold > summary::-webkit-details-marker { display: none; }
.sb-fold > summary::after { content: ""; width: 7px; height: 7px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s ease-out; flex: none; }
.sb-fold[open] > summary::after { transform: rotate(-135deg); }
.sb-fold[open] > summary { margin-bottom: 10px; }
.sb-fold-act { gap: 8px; margin-bottom: 8px; }
.sb-fold-act:not(:has(> :not(.spacer):not(a))) { margin-bottom: 4px; }

/* ---------- ฟอร์มเช่า: เงินประกัน/ค่าธรรมเนียม/ค่าส่วนกลาง พับเป็นบรรทัดสรุป ---------- */
.fee-fold > summary { display: flex; align-items: baseline; gap: 10px; cursor: pointer; list-style: none; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: .875rem; }
.fee-fold > summary::-webkit-details-marker { display: none; }
.fee-fold > summary #feeSum { flex: 1; min-width: 0; }
.fee-fold .ff-edit { color: var(--brand); font-size: .875rem; white-space: nowrap; }
.fee-fold[open] .ff-edit { visibility: hidden; }

/* ---------- หน้าตรวจสอบ: รวมยอดค้างเกินกำหนด ---------- */
.debt-box { display: grid; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); border: 1px solid #f5d7a8; }
.debt-list { display: grid; gap: 4px; font-size: .875rem; padding-left: 26px; }
.debt-list > div { display: flex; justify-content: space-between; gap: 12px; }
.debt-list b, .debt-total b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.debt-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed #f0c98a; padding-top: 8px; }
.debt-total b { font-size: 1.125rem; }

/* ---------- บิลของแผง: มือถือแสดงเป็นการ์ด (ไม่ต้องเลื่อนซ้ายขวา) ---------- */
@media (max-width: 560px) {
  .bill-list, .bill-list tbody { display: block; }
  .bill-list thead { display: none; }
  .bill-list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
  table.t.bill-list td { display: block; padding: 0; border: 0; background: none; text-align: left; }
  table.t.bill-list td.bl-amt { text-align: right; }
  .bill-list .bl-who { display: none; }
  .bill-list .bl-what { grid-column: 1; grid-row: 1; }
  .bill-list .bl-amt { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 1.0625rem; font-weight: 700; }
  .bill-list .bl-item { white-space: normal; }
  .bill-list .bl-date { grid-column: 1; font-size: .875rem; color: var(--muted); }
  .bill-list .bl-act { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 8px; }
  .bill-list .bl-act .btn { flex: 1; min-height: 44px; }
  .bill-list td.empty { grid-column: 1 / -1; }
}
.debt-list > div > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- บิล / รับชำระ: ยอดแยกที่มา · แจ้งผิดใต้ช่อง · บิลค้างอื่นแบบพับ ---------- */
/* หัวคอลัมน์ที่ซ่อนไว้ (sr-only) ต้องอยู่ในกรอบตาราง ไม่งั้นดันทั้งหน้าให้เลื่อนซ้ายขวาบนมือถือ */
.table-wrap { position: relative; }
.cp-due-box { display: grid; gap: 4px; }
.cp-due-note { font-size: .875rem; color: var(--ink-2); padding: 0 14px; font-variant-numeric: tabular-nums; }
.field-err { margin-top: 6px; font-size: .875rem; font-weight: 600; color: var(--danger); }
.has-err input, input[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-soft); }
.pay-more-head { gap: 8px; flex-wrap: wrap; }
.pay-more-body { display: grid; gap: 6px; }
#pMoreT[aria-expanded="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); }
.b-q { max-width: 280px; }

/* ---------- บิล / รับชำระ บนมือถือ: บิลเป็นการ์ด เห็นยอดและปุ่มรับชำระทันที · ปุ่มกดง่าย (สูง ≥ 44px) ---------- */
@media (max-width: 640px) {
  .b-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; overflow: visible; }
  .b-tabs button { min-height: 44px; padding: 8px 4px; white-space: normal; line-height: 1.4; }
  .b-filter .b-q { max-width: none; flex: 1 1 100%; font-size: 1rem; min-height: 44px; }
  .b-dates { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  @media (max-width: 480px) { .b-dates { grid-template-columns: 1fr; } }
  .b-dates .b-date-lbl { grid-column: 1 / -1; }
  .b-dates label { min-width: 0; }
  .b-dates label input { flex: 1; min-width: 0; width: 100% !important; }
  .b-dates .btn { min-height: 40px; }
  .b-dates .dmy { flex: 1; min-width: 0; width: auto; }
  .b-dates .dmy-text { min-height: 44px; }
  .b-dates .dmy-btn { min-width: 40px; min-height: 40px; }
  .b-card { background: none; border: 0; box-shadow: none; }
  .b-card > .table-wrap { overflow: visible; }
  .b-table, .b-table tbody { display: block; }
  .b-table thead { display: none; }
  .b-table tr[data-inv] { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  table.t.b-table td { display: block; padding: 0; border: 0; background: none; text-align: left; max-width: none; min-width: 0; white-space: normal; }
  table.t.b-table td.b-id { grid-column: 1; grid-row: 1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
  .b-table .b-id b { display: inline; font-size: 1.0625rem; }
  .b-table .b-id .link { font-size: .875rem; padding: 4px 0; }
  table.t.b-table td.num { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-size: 1.125rem; font-weight: 700; }
  .b-table td.b-who { grid-column: 1; grid-row: 2; font-weight: 600; }
  .b-table td.b-item { grid-column: 1 / -1; color: var(--ink-2); }
  .b-table .b-sum1 { max-width: none; }
  table.t.b-table td.b-when { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .875rem; color: var(--ink-2); }
  .b-table .b-st-inline { display: block; margin: 0; }
  table.t.b-table td.b-status { display: none; }
  .b-table td.b-act { grid-column: 1 / -1; margin-top: 8px; }
  .b-table .b-act-row { justify-content: stretch; gap: 8px; }
  .b-table .b-act-row > .btn { flex: 1; min-height: 44px; font-size: .9375rem; }
  .b-table .row-dd > summary { min-width: 48px; min-height: 44px; display: grid; place-items: center; font-size: 1.125rem; }
  .b-table .row-dd .dd-item { padding: 11px 12px; }
  .b-table tr.b-group { display: block; }
  .b-table tr.b-group td { display: block; padding: 10px 2px 6px; background: none; }
  /* หน้ารับชำระ / หน้าต่างอื่นบนมือถือ: ปุ่มปิด ปุ่มท้าย ปุ่มเลือกค่าปรับ กดง่าย */
  .modal > header .icon-btn { min-width: 44px; min-height: 44px; }
  .modal > footer .btn { min-height: 44px; }
  .modal > footer .btn.primary { flex: 1; }
  .late-box .seg button, .lf-chips .btn, .pay-more .btn { min-height: 44px; }
  .pay-row { min-height: 52px; }
  .pay-row input { width: 22px; height: 22px; }
}

/* เช่ารายวัน: ปฏิทินเลือกวันที่จะลง (ไม่ต้องติดกัน) */
.dp-head { margin-bottom: 6px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-width: 420px; }
.dp-wd { text-align: center; font-size: .875rem; color: var(--muted); padding: 2px 0; }
.dp-wd.hol { color: var(--danger); }
.dp-day { min-height: 44px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; font: inherit; padding: 2px; }
.dp-day small { font-size: .8125rem; color: var(--muted); }
.dp-day.hol b { color: var(--danger); }
.dp-day:hover:not(:disabled) { border-color: var(--brand); }
.dp-day.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.dp-day.on b, .dp-day.on small { color: #fff; }
.dp-day:disabled { opacity: .35; cursor: default; background: var(--surface-2); }
.dp-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* จำกัดพื้นที่: หน้าจอทับให้ยืนยันตำแหน่ง GPS */
.geo-block { position: fixed; inset: 0; z-index: 9999; background: rgba(16, 24, 22, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.geo-card { max-width: 440px; width: 100%; }
.geo-card .btn { min-height: 44px; }

/* ---------- เข้าระบบด้วย PIN แบบปลดล็อกมือถือ (ปุ่มกลม · จุดแสดงจำนวนหลัก) ---------- */
.login.lock { color: #fff; }
.lock-box { width: min(340px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; }
.lock-box img { border-radius: 14px; }
.lock-box h1 { margin: 12px 0 2px; color: #fff; font-size: 1.375rem; }
.lock-sub { font-size: .9375rem; color: rgba(255, 255, 255, .8); }
.pin-dots { display: flex; gap: 16px; justify-content: center; margin: 22px 0 6px; min-height: 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .85); transition: background .12s; }
.pin-dots i.on { background: #fff; }
.pin-dots.shake { animation: pinShake .4s; }
@keyframes pinShake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-7px); } 80% { transform: translateX(7px); } }
@media (prefers-reduced-motion: reduce) { .pin-dots.shake { animation: none; } }
.lock-msg { min-height: 40px; font-size: .875rem; color: #ffd3c9; padding: 4px 8px; display: flex; align-items: center; justify-content: center; }
.lock-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 24px; justify-content: center; margin-top: 4px; }
.lock-key { width: 76px; height: 76px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); color: #fff; font: inherit; cursor: pointer; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; transition: background .1s; }
.lock-key b { font-size: 1.875rem; font-weight: 500; line-height: 1; }
.lock-key:hover { background: rgba(255, 255, 255, .24); }
.lock-key:active { background: rgba(255, 255, 255, .45); }
.lock-key:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lock-key.txt { background: transparent; font-size: 1rem; }
.lock-key.txt:hover { background: rgba(255, 255, 255, .1); }
.lock-box .lock-go { margin-top: 20px; width: 100%; max-width: 276px; min-height: 48px; background: #fff; color: var(--brand-2); border-color: #fff; }
.lock-box .link-btn { margin-top: 14px; color: rgba(255, 255, 255, .85); }
@media (max-width: 360px) { .lock-pad { grid-template-columns: repeat(3, 68px); gap: 12px 18px; } .lock-key { width: 68px; height: 68px; } }
.dp-trigger { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 8px; justify-content: space-between; text-align: left; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.dp-trigger:hover:not(:disabled) { border-color: var(--brand); }
.dp-trigger:disabled { background: var(--surface-2); cursor: default; }
.dp-trigger span:first-child { overflow: hidden; text-overflow: ellipsis; }
.dp-count { flex: none; font-size: .875rem; font-weight: 600; color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: 2px 10px; }
.dp-pop { border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); padding: 10px; box-shadow: var(--shadow); max-width: 440px; }
.dp-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-nav .btn { font-size: 1.125rem; min-width: 40px; }
.dp-day.today:not(.on) { border-color: var(--accent); }
.dp-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-top: 8px; color: var(--muted); }

/* อ่านบัตรประชาชน: แถบสถานะเครื่องอ่าน + ปุ่มอ่านบัตร */
.idc-bar { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--brand); border-radius: var(--radius); background: var(--brand-soft); }
.idc-bar.off { border-color: var(--line-2); background: var(--surface-2); color: var(--muted); }
.idc-bar .link-btn { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; }
.idc-old { margin-top: 6px; }
.idc-old .btn { margin-left: 6px; }
.idc-kv dd b { font-size: 1.1em; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: #b9dfc6; }
.modal .link-btn { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; }

/* ========== ผังแผง: ปรับหน้าจอรอบตรวจ 11 พ.ย. 2569 (กระทบเฉพาะหน้าผังแผง/รายละเอียดแผง/ฟอร์มเช่า + toast ที่มีปุ่ม) ========== */
/* คำอธิบายใต้ตัวเลือกประเภทการเช่า / "กดเพื่อเลือกวันที่จะลง" ไม่ต่ำกว่า 14px */
.choice small, #dayStartField small { font-size: .875rem; }
/* ชื่อใต้รหัสแผง: ขนาดเท่ารหัส (14px ที่ซูม 100% บนคอม) บรรทัดเดียว ตัดท้าย · line-height กันสระบน-ล่างถูกตัด */
.seat .who { line-height: 1.25; }
@media (min-width: 641px) { .seat .who, .seat.big .who { font-size: 1em; } }

/* ช่วงที่แจ้งหยุด: ปุ่มมีคำ "ยกเลิกการหยุด" (เดิม × เล็ก) */
.pause-list { display: grid; gap: 6px; margin-top: 6px; }
.pause-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pause-item .btn { min-height: 36px; }

/* ร้านหยุดวันนี้: ปุ่มด่วนบนสุดของรายละเอียดแผง */
.sb-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; padding: 12px; border: 1.5px dashed var(--st-paused-line); border-radius: 12px; background: var(--surface-2); }
.sb-quick-btn { min-height: 48px; font-size: 1.0625rem; font-weight: 700; background: var(--surface); border: 1.5px solid var(--ink); color: var(--ink); }
.sb-quick-btn:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--ink); }
/* การ์ดยืนยันร้านหยุด: รหัสแผงตัวใหญ่ อ่านชัดก่อนกดบันทึก */
.qp-card { text-align: center; padding: 16px 12px; border: 2px dashed var(--st-paused-line); border-radius: 14px; background: var(--surface-2); }
.qp-code { font-size: 2.25rem; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; }
.qp-shop { margin-top: 4px; font-size: 1.25rem; font-weight: 700; line-height: 1.45; }
.qp-person { margin-top: 2px; color: var(--ink-2); line-height: 1.5; }
.qp-day { margin-top: 10px; font-size: 1.125rem; line-height: 1.5; }
.modal .link-btn.qp-more { display: inline-block; margin-top: 6px; padding: 10px 0; min-height: 44px; }

/* แถบปุ่มฝั่งขวาของกล่องผู้เช่า (เปลี่ยนแปลงการเช่า / ตั้งเป็นแผงว่าง) */
.sb-right { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* ข้อความแจ้งที่มีปุ่ม (เช่น "เลิกทำ") */
.toast.has-act { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; }
.toast.has-act .toast-msg { flex: 1; min-width: 0; }
.toast-act { flex: none; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1.5px solid rgba(255, 255, 255, .85); background: transparent; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.toast-act:hover { background: rgba(255, 255, 255, .15); }
.toast-act:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

@media (max-width: 640px) {
  /* แถบบนสุด: ปุ่มพิมพ์ผังตรวจไม่ใช้บนมือถือ · "แสดงใต้รหัส" ย้ายไปในหัวข้อพับ (map.js) */
  .map-tools #mPrint { display: none; }
  .legend-wrap > .map-label { display: flex; margin: 8px 0 4px; }
  .legend-wrap > .map-label select { flex: 1; min-width: 0; min-height: 44px; }
  /* ปุ่มเลื่อนวัน ‹ › / วันนี้ / ช่องวันที่ ≥ 44px */
  .map-tools .date-nav { gap: 6px; }
  .map-tools .date-nav .btn { min-width: 48px; min-height: 48px; }
  .map-tools .date-nav [data-act=prev], .map-tools .date-nav [data-act=next] { font-size: 1.375rem; padding: 0; }
  .map-tools .date-nav input { min-height: 48px; }

  /* ผัง: แผงขยายตามขนาดตัวอักษรที่เลือก (rem) · ระยะห่างระหว่างแผง 8px ที่ 100% */
  #mGrid .seat-grid { --bw: 2.6667rem; --bh: 2.5556rem; }
  #mGrid .seat-grid, #mGrid .seat-grid .run { gap: calc(8px * var(--z, 1)); }

  /* ปุ่มซูม: ใหญ่ 48px และติดขอบล่างของจอขณะเลื่อนดูผัง (หลบขึ้นเหนือแถบเลือกแผง) */
  .map-card { display: flex; flex-direction: column; }
  .map-card > .zoombar {
    order: 2; position: sticky; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 5;
    flex-wrap: wrap; align-self: center; margin: 8px 0 0; padding: 6px; gap: 6px;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  }
  .map-card.has-sel > .zoombar { bottom: calc(var(--selbar-h, 120px) + 20px + env(safe-area-inset-bottom, 0px)); }
  .zoombar button { width: 48px; height: 48px; font-size: 1.375rem; }
  .zoombar button.wide { width: auto; min-width: 48px; padding: 0 12px; font-size: 1rem; }
  .zoombar span { min-width: 3.2em; font-size: 1rem; }
  /* ปุ่ม "100%" ไม่ใช้บนมือถือ (ค่าเริ่มต้นมือถือคือ 125% · กด − / + แทน) — แถบซูมอยู่แถวเดียว ไม่บังผัง */
  .zoombar [data-zoom=reset] { display: none; }

  /* แถบเลือกแผง: ข้อความแถวบน · ปุ่มแถวล่าง · ปุ่มหลักกว้างที่สุด (ตัวใหญ่ล้นไปบรรทัดใหม่เอง ไม่ทับกัน) */
  .selbar { flex-wrap: wrap; gap: 8px; width: calc(100% - 16px); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); padding: 10px 12px; }
  .selbar .info { flex: 1 1 100%; }
  .selbar .btn { flex: 1 1 auto; min-height: 48px; }
  .selbar #selGo { flex: 2 1 10rem; font-weight: 700; }

  /* รายละเอียดแผง: ปุ่มสูง ≥ 44px ห่างกัน 8px · ปุ่มฝั่งขวา (เปลี่ยนแปลงการเช่า / ตั้งเป็นแผงว่าง สีแดง) แยกแถวล่างมีเส้นคั่น */
  .sb-actions { gap: 8px; }
  .sb-actions > .spacer { display: none; }
  .sb-right { flex: 1 1 100%; gap: 8px; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
  .rental-box .btn, .sb-free .btn, .sb-due .btn, .pause-item .btn, .sb-fold .btn { min-height: 44px; }
  .sb-quick-btn { flex: 1 1 100%; }

  /* ฟอร์มเช่า: แถบอ่านบัตรไม่ใช้บนมือถือ (เครื่องอ่านบัตรต่อกับคอม) */
  #rentForm .idc-bar { display: none; }
}
@media (max-width: 560px) {
  /* แถบล่างฟอร์มเช่าบนมือถือ: ยอดชำระ + "พักไว้ในตะกร้า" แถวเดียวกัน · ปุ่มไปต่อเต็มแถว (เดิมสูง 163px → ~110px) */
  .modal > footer.rent-foot { padding: 8px 12px; gap: 6px 8px; align-items: center; }
  .rent-foot .foot-total { flex: 1 1 auto; min-width: 0; margin: 0; }
  .rent-foot #rentSave { flex: 1 1 100%; }
}

/* หน้าต่างแผง: การเงินเหลือการ์ดเดียว (ค้างชำระ) · ตารางบิลค้างเด่นที่ "ค้างค่าอะไร" */
.sb-money.one { grid-template-columns: 1fr; }
.bill-list .bl-kind { font-size: 1.0625rem; }
.bill-list .bl-period { font-weight: 600; }
.bill-list td.bl-what { min-width: 220px; }
.bill-list .bl-no { margin-top: 2px; }

/* รายงานตรวจไฟ: 4 การ์ดสรุป (ตรวจแล้ว % · ทำผิด · เงินที่เก็บ · รอติดตาม) */
.el-kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.el-kpis.four .el-kpi-v { font-size: 1.125rem; }
.el-kpi-pct { font-size: .9375rem; font-weight: 600; color: var(--muted); }
.el-kpi-bar { margin: 6px 0 4px; }
@media (max-width: 900px) { .el-kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.el-kpi-bar i { background: var(--brand); }
/* การ์ดสรุปที่กดได้ (ทางลัดไปดูรายละเอียด) */
.el-kpi-go { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.el-kpi-go:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.el-kpi-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.el-kpi-more { float: right; color: var(--brand); font-weight: 600; }
/* หน้าต่างแผง: มิเตอร์กดดูรายละเอียดได้ */
.sb-meter-go { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.sb-meter-go:hover { border-color: var(--brand); }
.sb-meter-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sb-meter-more { margin-left: auto; color: var(--brand); font-weight: 600; font-size: .875rem; }

/* รายงาน: แท็บขึ้นบรรทัดใหม่แทนการเลื่อนข้าง (ขยายตัวอักษรแล้วไม่หาย) */
.tabs.rp-tabs { flex-wrap: wrap; overflow: visible; row-gap: 2px; }
/* รายงาน → ภาพรวม: เรื่องที่ต้องดู (ระดับบอกด้วยคำ+ไอคอน + แถบสีซ้าย) */
.att-list { display: flex; flex-direction: column; }
.att-row { display: grid; grid-template-columns: 6.5rem 1fr auto auto; align-items: center; gap: 6px 16px; padding: 12px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.att-row:hover, .att-row:focus-visible { background: var(--surface-2); outline: none; }
.att-row:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.att-lv { justify-self: start; font-weight: 700; font-size: .875rem; padding: 3px 10px; border-radius: 99px; white-space: nowrap; background: var(--brand-soft); color: var(--brand); }
.att-danger .att-lv { background: var(--danger-soft); color: var(--danger); }
.att-warn .att-lv { background: var(--warn-soft); color: var(--warn); }
.att-txt { display: flex; flex-direction: column; min-width: 0; }
.att-amt { font-size: 1.125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.att-danger .att-amt { color: var(--danger); }
.att-go { color: var(--brand); font-weight: 600; font-size: .875rem; white-space: nowrap; }
.att-none { color: var(--ok); font-weight: 600; border-top: 1px solid var(--line); }
@media (max-width: 700px) { .att-row { grid-template-columns: 1fr auto; } .att-txt { grid-column: 1 / -1; order: -1; } .att-go { display: none; } }
/* รายงาน → แผงและผู้ค้า: แถบทางลัดหัวข้อ ติดบนจอตอนเลื่อน */
.rp-jump { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 0; margin-bottom: 2px; background: var(--bg); }
#rBody [id^="sec-"] { scroll-margin-top: 64px; }
@media (max-width: 900px) { .rp-jump { position: static; } }

/* ตั้งค่าตลาด: เลือกสีแถบเมนู (ชุดสี 8 สี) */
.side-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: 8px; }
.side-sw { display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.side-sw input { position: absolute; opacity: 0; pointer-events: none; }
.side-sw-box { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 8px; color: #fff; font-weight: 600; font-size: .875rem; border: 3px solid transparent; }
.side-sw input:checked + .side-sw-box { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.side-sw input:focus-visible + .side-sw-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.side-sw input:checked ~ .small { font-weight: 700; }
