/* Boutique look: burgundy rail, brass accents, door-plate room numbers (Barlow Condensed),
   a time ring on occupied rooms and a to-do queue beside the map. */
:root {
  --wine: #4A0E2B;       /* rail, primary buttons */
  --wine-2: #6A1A40;
  --brass: #B48A4A;
  --bg: #F5F4F2;         /* working surface */
  --paper: #FFFFFF;
  --ink: #231A20;
  --ink-2: #7D7378;
  --line: #E6E1DD;
  --hour: #C98A12;
  --combo: #D4602A;
  --night-stay: #A8123E;
  --day: #5B3A92;
  --auto: #3D7F78;
  --free: #2F8F5B;
  --occ: #C0152F;        /* occupied tile (red) */
  --dirty: #A39A94;
  --dirty-fill: #7A726D; /* dirty tile, dark enough for white text */
  --cleaning: #3B78C2;
  --warn: #D4602A;
  --focus: #B48A4A;
  --night: var(--wine);
  --r: 8px;
  --plate: 'Barlow Condensed', 'Be Vietnam Pro', sans-serif;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
body:has(#top:not([hidden])) { padding-left: 96px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

#training { background: repeating-linear-gradient(135deg, #F3E3C2 0 14px, #EBD5A8 14px 28px); color: #4A3500; text-align: center; font-weight: 600; font-size: 13px; padding: 4px 8px; }

/* Rail */
#top { position: fixed; inset: 0 auto 0 0; width: 96px; background: var(--wine); color: #F2E3EA; display: flex; flex-direction: column; align-items: stretch; padding: 18px 0 14px; z-index: 5; }
.brand { font-family: var(--plate); font-size: 34px; font-weight: 700; color: #fff; text-align: center; line-height: 1; margin: 0 22px 18px; padding-bottom: 12px; border-bottom: 2px solid var(--brass); }
.brand small { display: block; font-family: 'Be Vietnam Pro'; font-size: 10px; font-weight: 500; color: #E3C9D5; margin-top: 6px; letter-spacing: .2px; }
#top nav { display: flex; flex-direction: column; gap: 4px; }
.tab { background: none; border: 0; color: #E3C9D5; padding: 10px 4px; cursor: pointer; font-size: 12px; font-weight: 500; position: relative; }
.tab::before { content: ''; display: block; width: 30px; height: 3px; margin: 0 auto 6px; border-radius: 2px; background: transparent; }
.tab.on { color: #fff; font-weight: 700; }
.tab.on::before { background: var(--brass); }
.tab:hover { color: #fff; }
.pill { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--brass); color: #2B1500; font-size: 11px; font-weight: 700; margin-left: 2px; }
#top .right { margin-top: auto; display: grid; gap: 8px; justify-items: center; text-align: center; font-size: 11px; padding: 0 8px; }
.clock { font-family: var(--plate); font-size: 30px; font-weight: 600; color: #fff; line-height: 1; }
#who { color: #E3C9D5; }
/* Freshness / connection chip: grey "cập nhật HH:MM" normally, red when the last refresh failed (app.js showConn) */
.conn { font-size: 10px; line-height: 1.3; color: #C9A9B8; }
.conn.bad { background: #A3122F; color: #fff; border-radius: 6px; padding: 4px 6px; font-weight: 700; }
.chip { border: 1px solid #8A4A68; background: transparent; color: #fff; border-radius: 6px; padding: 5px 6px; cursor: pointer; font-size: 11px; line-height: 1.35; width: 100%; }
#branch-pick option { color: var(--ink); }
.chip.closed { border-color: var(--brass); color: #F1D7A6; font-weight: 700; }
#top .ghost { color: #E3C9D5; font-size: 11px; padding: 4px 8px; }

.ghost { background: transparent; border: 1px solid currentColor; border-radius: 6px; padding: 6px 12px; cursor: pointer; opacity: .85; }
.primary { background: var(--wine); color: #fff; border: 0; border-radius: 6px; padding: 10px 18px; font-weight: 600; cursor: pointer; letter-spacing: .2px; }
.primary:hover { background: var(--wine-2); }
.primary:disabled { opacity: .5; cursor: progress; }
.danger { background: #fff; color: #A3122F; border: 1px solid #E4B5C1; border-radius: 6px; padding: 8px 14px; cursor: pointer; }
.err { color: #A3122F; min-height: 1.2em; margin: 6px 0 0; }

/* Login */
.login { display: grid; place-items: center; min-height: 100vh; background: var(--wine); }
.login-card { background: var(--paper); padding: 36px; border-radius: 10px; width: min(380px, 92vw); display: grid; gap: 14px; border-top: 4px solid var(--brass); }
.login-card h1 { margin: 0; font-family: var(--plate); font-size: 44px; font-weight: 600; line-height: 1; }
.login-card h1 span { display: block; font-family: 'Be Vietnam Pro'; font-size: 15px; font-weight: 400; color: var(--ink-2); margin-top: 6px; }
.login-card p { margin: 0; color: var(--ink-2); }
.pw-wrap { display: flex; gap: 6px; }
.pw-wrap input { flex: 1; min-width: 0; }
.pw-toggle { flex: none; padding: 0 12px; background: transparent; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-2); cursor: pointer; }
.login-card .check { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.login-card .check input { width: 18px; height: 18px; padding: 0; margin: 0; }
label, .field { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field .seg { justify-self: start; }
.fixed-val { font-size: 15px; color: var(--ink); padding: 8px 0; }
input, select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: #fff; color: var(--ink); font-size: 15px; min-width: 0; }
.paid-row input, .paid-row select { background: var(--bg); color: var(--ink); opacity: 1; font-weight: 600; }
.paid-row + .hint { margin: 2px 0 10px; }
input:focus, select:focus, textarea:focus { border-color: var(--brass); }
textarea { resize: vertical; min-height: 60px; }

/* Map view: heading + KPI cards, then map | to-do queue */
#map-view { padding: 20px 24px 24px; }
.hd { display: flex; align-items: end; gap: 24px; margin-bottom: 14px; }
.hd h1 { font-family: var(--plate); font-size: 42px; margin: 0; font-weight: 600; letter-spacing: .3px; line-height: 1; }
.hd p { margin: 0 0 3px; color: var(--ink-2); font-size: 13px; }
#kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 14px; text-align: left; }
button.kpi { cursor: pointer; }
.kpi small { font-size: 12px; color: var(--ink-2); }
.kpi b { display: block; font-family: var(--plate); font-size: 30px; font-weight: 600; line-height: 1.1; white-space: nowrap; }
.kpi .muted { font-size: 12px; }
.kpi.hot { border-color: #EBB394; background: #FBF0EA; }
.kpi.money b { font-size: clamp(20px, 1.75vw, 30px); }
.kpi.cash { display: flex; flex-direction: column; align-items: flex-start; }
.kpi-act { margin-top: 4px; border: 1px solid var(--brass); background: #fff; color: var(--wine); border-radius: 6px; padding: 4px 10px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.kpi-act:hover { background: #FBF5EA; }
.handover-cash { display: block; font-family: var(--plate); font-size: 34px; font-weight: 600; }
.kpi.hot b { color: var(--combo); }
.mix { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin-top: 5px; background: var(--line); }
.mix i { display: block; }
.board { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; align-items: start; }

#floors { display: grid; gap: 10px; }
.floor { display: grid; grid-template-columns: 34px 1fr; align-items: start; gap: 10px; }
.floor-no { font-family: var(--plate); color: var(--brass); font-size: 20px; font-weight: 600; padding-top: 6px; }
.floor-rooms { display: flex; flex-wrap: wrap; gap: 9px; }

/* Room tile: a door plate */
/* --ts: tile scale. 1.41 = √2, so a tile has twice the area of the old 140 × 142 one (Brian, 2026-11-07: staff found the text too small) */
.tag { --ts: 1.41; --c: var(--free); position: relative; width: calc(140px * var(--ts)); height: calc(142px * var(--ts)); background: var(--paper); border: 1px solid var(--line); border-radius: calc(6px * var(--ts));
  padding: calc(9px * var(--ts)) calc(10px * var(--ts)) calc(8px * var(--ts)); cursor: pointer; text-align: left; display: flex; flex-direction: column; overflow: visible; }
.tag:hover { border-color: var(--brass); }
.tag .no { font-family: var(--plate); font-size: calc(32px * var(--ts)); font-weight: 600; line-height: 1; }
.tag .type { font-size: calc(12.5px * var(--ts)); font-weight: 600; letter-spacing: .4px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(80px * var(--ts)); margin-top: calc(2px * var(--ts)); }
.tag .who { font-size: calc(11.5px * var(--ts)); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: auto; }
.tag .meta { display: flex; justify-content: space-between; align-items: baseline; font-size: calc(11.5px * var(--ts)); margin-top: calc(3px * var(--ts)); gap: calc(4px * var(--ts)); }
.tag .kind { color: var(--c); font-weight: 700; white-space: nowrap; }
.tag .money { font-weight: 700; }
.tag .note { margin-top: auto; font-size: calc(10.5px * var(--ts)); font-weight: 600; color: #7A5A1E; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag .note + .who { margin-top: calc(1px * var(--ts)); }
.tag .out { color: var(--ink-2); font-weight: 500; }
.tag .bal { font-size: calc(12px * var(--ts)); font-weight: 700; white-space: nowrap; margin-top: calc(2px * var(--ts)); }
.tag .bal.owe { color: #A3122F; }
.tag .bal.over { color: #1F7A4D; }
.tag .bal.paid { color: var(--ink-2); font-weight: 600; }
.tag .state { font-size: calc(11.5px * var(--ts)); color: var(--ink-2); margin-top: auto; }
.tag .state { display: flex; align-items: center; justify-content: space-between; min-height: calc(18px * var(--ts)); }
.tag .state .hk::before { content: ''; display: inline-block; width: calc(7px * var(--ts)); height: calc(7px * var(--ts)); border-radius: 50%; background: var(--c); margin-right: calc(5px * var(--ts)); }
.defect-badge { margin-left: auto; background: #fff; border-radius: calc(9px * var(--ts)); padding: 0 calc(6px * var(--ts)); font-size: calc(12px * var(--ts)); font-weight: 700; line-height: calc(18px * var(--ts)); color: #B87500; }
.defect-badge.hi { color: #A3122F; }
/* Tile fill = room state (the colours FO are used to): green free & clean, red occupied, grey dirty, blue cleaning.
   --c stays the stay-type colour (ring, kind chip, legend). */
.tag.free, .tag.occ, .tag.dirty, .tag.cleaning { color: #fff; border-color: transparent; }
.tag.free { background: var(--free); }
.tag.occ { background: var(--occ); }
.tag.dirty { --c: var(--dirty); background: var(--dirty-fill); }
.tag.cleaning { --c: var(--cleaning); background: var(--cleaning); }
.tag.maintenance { --c: #C9B79A; opacity: .55; }
.tag.maintenance .no { color: #8A7A5E; }
.tag.free:hover, .tag.occ:hover, .tag.dirty:hover, .tag.cleaning:hover { border-color: transparent; filter: brightness(1.08); }
.tag.free .type, .tag.occ .type, .tag.dirty .type, .tag.cleaning .type,
.tag.free .state, .tag.dirty .state, .tag.cleaning .state, .tag.occ .out { color: rgba(255,255,255,.88); }
/* Key features on a free tile: the first ones that fit in three lines */
.tag .feat { margin-top: calc(5px * var(--ts)); font-size: calc(10.5px * var(--ts)); font-weight: 500; line-height: 1.3; color: rgba(255,255,255,.92);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.ci-feat { display: inline-block; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.ci-feat .tv55 { width: 17px; height: 17px; vertical-align: -3px; margin-right: 5px; color: var(--ink); }
.tag .feat .tv55 { width: calc(15px * var(--ts)); height: calc(15px * var(--ts)); vertical-align: -3px; margin-right: calc(4px * var(--ts)); }
.tag.dirty .state .hk::before, .tag.cleaning .state .hk::before { background: #fff; }
.tag.occ .note { color: #FFE3A3; }
.tag.occ .kind { background: #fff; color: var(--c); padding: 0 calc(5px * var(--ts)); border-radius: calc(3px * var(--ts)); }
.tag.occ .bal.owe { background: #fff; color: #A3122F; padding: 0 calc(5px * var(--ts)); border-radius: calc(3px * var(--ts)); align-self: flex-start; }
.tag.occ .bal.over { background: #fff; color: #1F7A4D; padding: 0 calc(5px * var(--ts)); border-radius: calc(3px * var(--ts)); align-self: flex-start; }
.tag.occ .bal.paid { color: rgba(255,255,255,.88); }
/* Open maintenance job: ⚠ badge in the free tile's bottom row; ⚠ after the number on occupied tiles (the ring takes the corner) */
.defect-mark { font-family: 'Be Vietnam Pro'; font-size: calc(14px * var(--ts)); font-weight: 700; margin-left: calc(4px * var(--ts)); vertical-align: calc(6px * var(--ts)); color: #B87500; }
.defect-mark.hi { color: #A3122F; }
.sev-urgent, .sev-high { color: #A3122F; }
.sev-normal, .sev-low { color: #8A5300; }
.tag.m-hour { --c: var(--hour); }
.tag.m-combo { --c: var(--combo); }
.tag.m-night { --c: var(--night-stay); }
.tag.m-day { --c: var(--day); }
.tag.m-auto { --c: var(--auto); }
/* Time ring: share of the booked time already used */
.ring { position: absolute; top: calc(8px * var(--ts)); right: calc(8px * var(--ts)); width: calc(40px * var(--ts)); height: calc(40px * var(--ts)); border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p) * 1%), #ffffff40 0); display: grid; place-items: center; }
.ring span { width: calc(31px * var(--ts)); height: calc(31px * var(--ts)); border-radius: 50%; background: var(--occ); display: grid; place-items: center; font-size: calc(9.5px * var(--ts)); font-weight: 600; color: #fff; }
.ring.full { background: var(--warn); }
.ring.full span { color: #FFD9C7; }
.tag.alert { outline: 2px solid var(--warn); outline-offset: 1px; }
.tag.alert .alert-text { position: absolute; left: calc(8px * var(--ts)); top: calc(-9px * var(--ts)); background: var(--warn); color: #fff; font-size: calc(10px * var(--ts)); font-weight: 700; padding: calc(1px * var(--ts)) calc(7px * var(--ts)); border-radius: calc(8px * var(--ts)); white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .tag.alert.call { animation: ring 1.6s ease-in-out infinite; }
  @keyframes ring { 50% { outline-offset: 4px; outline-color: color-mix(in srgb, var(--warn) 45%, transparent); } }
}

#legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--ink-2); margin: 14px 0 0 44px; }
#legend b { color: var(--ink); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* To-do queue */
.queue { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 14px 10px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.queue h2 { font-size: 15px; margin: 0 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
.queue h2 span { font-family: var(--plate); color: var(--brass); font-size: 22px; }
/* Việc cần làm — Apple Reminders style (Brian, 2026-11-04; public/todo.js): coloured group titles with a count, collapsible,
   hairline rows with a ring, at most 5 per group until "Xem thêm" */
#todo { display: grid; gap: 14px; }
.todo-h { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; padding: 2px 0 4px; cursor: pointer;
  font-size: 15px; font-weight: 700; color: var(--g); text-align: left; }
.todo-chev { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: 0 4px 3px 2px; transition: transform .15s; }
.todo-g.closed .todo-chev { transform: rotate(-45deg); margin-bottom: 0; }
.todo-n { margin-left: auto; font-family: var(--plate); font-size: 20px; font-weight: 600; color: var(--ink-2); }
.todo-l { list-style: none; margin: 0; padding: 0; }
.todo-l li + li .todo-i { border-top: 1px solid var(--line); }   /* inset hairline, after the ring */
.todo-r { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: center; }
.todo-i { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; border: 0; border-radius: 0;
  background: none; padding: 9px 2px; text-align: left; cursor: pointer; font-size: 13.5px; }
.todo-i:hover { background: #FAF6F2; }
.todo-c { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--g); padding: 0; background: none; position: relative; }
.todo-c.tick { cursor: pointer; }
.todo-c.tick:hover::after, .todo-c.tick:focus-visible::after, .todo-r.done .todo-c::after, .todo-c.ticking::after {
  content: ''; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px; border: solid var(--g); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.todo-r.done .todo-c, .todo-c.ticking { background: var(--g); }
.todo-r.done .todo-c::after, .todo-c.ticking::after { border-color: #fff; }
/* done in the app (no tick): a small dot instead of a ring */
.todo-c.dot { width: 10px; height: 10px; border: 0; background: var(--g); justify-self: center; }
.todo-r.hot .todo-c.tick { background: color-mix(in srgb, var(--g) 15%, transparent); }
.todo-r.done .todo-1 { color: var(--ink-2); text-decoration: line-through; }
.todo-t { min-width: 0; }
.todo-1 { display: block; line-height: 1.35; }   /* the title wraps, as in Reminders; the detail line stays one line */
.todo-1 b { font-family: var(--plate); font-size: 17px; font-weight: 600; margin-right: 6px; }
.todo-t small { display: block; color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-go { font-size: 12.5px; font-weight: 600; color: var(--g); white-space: nowrap; }
.todo-more { border: 0; background: none; padding: 6px 0 0 32px; color: var(--ink-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.todo-more:hover { color: var(--ink); }
.empty { color: var(--ink-2); font-size: 13px; padding: 8px 2px; }

/* Drawer */
#drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--paper); border-left: 1px solid var(--line);
  overflow-y: auto; z-index: 10; padding: 24px 26px 40px; box-shadow: -18px 0 40px rgba(74,14,43,.14); }
#drawer .k { font-size: 12px; color: var(--brass); font-weight: 700; margin: 0; }
#drawer h2 { margin: 2px 0 0; font-family: var(--plate); font-size: 64px; line-height: .95; font-weight: 600; }
#drawer h2 small { font-family: 'Be Vietnam Pro'; font-size: 15px; color: var(--ink-2); font-weight: 400; margin-left: 6px; }
#drawer .sub { color: var(--ink-2); margin: 8px 0 16px; font-size: 13.5px; line-height: 1.6; }
#drawer > .x { position: absolute; top: 12px; right: 12px; z-index: 2; width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); font-size: 30px; line-height: 1; cursor: pointer; }
#drawer > .x:hover { background: var(--bg); }
#drawer .drawer-foot { display: flex; justify-content: flex-end; position: sticky; bottom: -40px; background: var(--paper);
  margin: 16px -26px -40px; padding: 12px 26px 16px; border-top: 1px solid var(--line); }
.section { border-top: 1px solid var(--line); padding: 14px 0; }
.section h3 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.rows { display: grid; gap: 4px; font-size: 14px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row [data-void] { padding: 1px 8px; font-size: 12px; margin-left: 6px; }
.row .muted, .muted { color: var(--ink-2); }
.row.total { font-weight: 700; font-size: 17px; border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 4px; }
.row.due { font-family: var(--plate); font-weight: 600; color: var(--wine); font-size: 28px; line-height: 1.1; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btns button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 8px 12px; cursor: pointer; font-size: 13.5px; }
.btns button:hover { border-color: var(--brass); }
.btns button.primary { background: var(--wine); color: #fff; border-color: var(--wine); }
#drawer .btns button.primary[data-act="checkout"] { width: 100%; padding: 13px; font-size: 15px; }
/* Khách báo trả phòng (2026-10-30): its own big target at the top of the Trả phòng form */
.outreq-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; min-height: 76px; margin: 4px 0 14px; padding: 14px 16px;
  background: var(--occ); color: #fff; border: 0; border-radius: var(--r); font-size: 20px; font-weight: 700; cursor: pointer; }
.outreq-btn small { font-size: 12.5px; font-weight: 400; line-height: 1.4; opacity: .95; }
.outreq-btn:hover { filter: brightness(1.06); }
.outreq-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.outreq-btn:disabled { opacity: .6; cursor: wait; }
.outreq.done { display: grid; gap: 4px; justify-items: start; margin: 4px 0 14px; padding: 12px 14px; background: #EAF5EE; border-left: 4px solid var(--free); border-radius: var(--r); font-size: 14px; }
.outreq.done b { font-size: 17px; }
.btns button.mgr::after { content: ' (QL)'; color: var(--ink-2); font-size: 12px; }
.void { text-decoration: line-through; opacity: .55; }
.hint { font-size: 13px; color: var(--ink-2); margin: 6px 0 0; }
.hint.warn { color: var(--warn); }
.ota-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.ota-days:empty { display: none; }
.callout { background: #FBF5EA; border-left: 3px solid var(--brass); padding: 10px 14px; font-size: 13.5px; line-height: 1.5; margin-bottom: 12px; }
.callout.ok { background: #EAF5EE; border-left-color: var(--free); }
.callout.bad { background: #FBF0EA; border-left-color: var(--warn); }
.callout.rev details { margin-top: 6px; }
.callout.rev summary { cursor: pointer; color: var(--ink-2); }
.callout.rev .rows { margin-top: 6px; }

/* Dialogs */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(760px, 96vw); max-height: 92vh; box-shadow: 0 30px 80px rgba(74,14,43,.35); color: var(--ink); border-top: 4px solid var(--brass); }
dialog::backdrop { background: rgba(43,10,26,.5); }
/* minmax(0, 1fr): a long option ("Khách chuyển khoản / trả ngoài hóa đơn") must not widen the dialog past a phone screen */
dialog form, dialog .body { padding: 22px 24px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
dialog form > *, dialog .body > * { min-width: 0; }
dialog h2 { margin: 0; font-size: 22px; font-weight: 700; padding-right: 44px; }
dialog .x { position: absolute; top: 12px; right: 12px; z-index: 2; width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); font-size: 30px; line-height: 1; cursor: pointer; }
dialog .x:hover { background: var(--bg); color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg label { display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 14px; cursor: pointer; font-size: 14px; color: var(--ink); font-weight: 500; }
.seg input:checked + span { background: var(--wine); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.actions { display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: -22px; background: var(--paper); padding: 12px 0 2px; margin-top: -4px; border-top: 1px solid var(--line); }
/* One scrollbar: a form scrolls inside the dialog, so the dialog itself must not (its 4px top border made the form 4px too tall) */
dialog form { overflow-y: auto; max-height: calc(92vh - 4px); }
dialog:has(> form) { overflow: hidden; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 12px; }
legend { font-weight: 700; font-size: 13px; padding: 0 6px; color: var(--brass); }
.with-btn { display: flex; gap: 6px; }
.with-btn select { flex: 1; min-width: 0; }
.field > .with-btn { min-width: 0; }   /* a grid item: else the longest option sets the width */
.out-at { display: flex; gap: 6px; }
.out-at input[type=date] { flex: 1; }
.out-at input[type=time] { width: 9em; }
.ghost.small { padding: 4px 8px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.payrow { display: grid; grid-template-columns: 160px 1fr auto; gap: 8px; align-items: center; }

/* Pages */
.page { padding: 24px; max-width: 1160px; }
.page h1 { font-family: var(--plate); font-size: 40px; margin: 0 0 14px; font-weight: 600; line-height: 1; }
.page h2 { font-weight: 700; }
table.list { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; font-size: 14px; }
table.list th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #FAF8F6; }
table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.list tr:last-child td { border-bottom: 0; }
table.list tr[data-bill] { cursor: pointer; }
table.list tr[data-bill]:hover td, table.list tr[data-bill]:focus-visible td { background: #FAF6F2; }
table.list tr[data-bill]:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.bill-dlg h2 small, .bk-dlg h2 small { font-size: 15px; color: var(--ink-2); font-weight: 400; margin-left: 6px; }
.bill-dlg .actions { bottom: 0; }   /* the dialog scrolls here, not a form — the form rule (-22px) would cut the button */
.bill-edit { display: grid; gap: 10px; }
/* Thêm dịch vụ: several items at once */
.svc-list { display: grid; gap: 12px; }
.svc-g { display: grid; gap: 2px; }
.svc-g h3 { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--brass); }
.svc-row { display: flex; align-items: center; gap: 8px; border-radius: 6px; padding: 2px 4px; }
.svc-row.on { background: #FBF3E4; }
.svc-name { flex: 1; text-align: left; border: 0; background: none; padding: 8px 4px; font-size: 14px; color: var(--ink); cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.svc-row.on .svc-name { font-weight: 600; }
.svc-qty { display: inline-flex; align-items: center; gap: 4px; }
.svc-qty button { width: 34px; height: 34px; border: 1px solid var(--line); background: #fff; border-radius: 6px; font-size: 18px; line-height: 1; cursor: pointer; color: var(--ink); }
.svc-qty button:hover { border-color: var(--brass); }
.svc-qty output { min-width: 24px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.svc-row:not(.on) .svc-qty output { color: var(--ink-2); font-weight: 400; }
.svc-sum { margin-right: auto; align-self: center; font-size: 14px; }
form:has(.svc-list) .actions button { white-space: nowrap; }
/* Phiếu thu - chi */
.vk { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; color: #fff; }
.vk.thu { background: #2E7D4F; }
.vk.chi { background: var(--wine); }
table.list tr[data-voucher] { cursor: pointer; }
table.list tr[data-voucher]:hover td, table.list tr[data-voucher]:focus-visible td { background: #FAF6F2; }
table.list tr.void td { color: var(--ink-2); text-decoration: line-through; }
table.list tr.void td:nth-child(8) { text-decoration: none; }
.toolbar .grow { flex: 1; }
.bill-edit h3 { margin-bottom: 0; }
.adj-row { display: grid; grid-template-columns: 150px 1fr 1.4fr auto; gap: 8px; }
.bill-edit .settle .btns { margin-top: 8px; align-items: center; }
@media (max-width: 640px) { .adj-row { grid-template-columns: 1fr 1fr; } .bill-edit .grid3 { grid-template-columns: 1fr; } }
.bill-dlg .sub { color: var(--ink-2); margin: -6px 0 0; font-size: 13.5px; line-height: 1.6; }
/* Booking past its arrival time, guest not checked in (Brian, 2026-10-22) */
table.list tr[data-bk] { cursor: pointer; }
table.list tr[data-bk]:hover td, table.list tr[data-bk]:focus-visible td { background: #FAF6F2; }
table.list tr[data-bk]:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.th-sort { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; font: inherit; color: inherit; }
.bk-list td:last-child .btns { min-width: 290px; }
.bk-list td:nth-child(6), .bk-list td:nth-child(7) { white-space: nowrap; }
.th-sort span { font-size: 10px; color: var(--ink-2); opacity: .45; }
.th-sort.on span, .th-sort:hover span { opacity: 1; color: var(--wine); }
.th-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
th.num .th-sort { flex-direction: row-reverse; }
details.bk-done { margin-top: 18px; }
details.bk-done > summary { cursor: pointer; font-weight: 700; font-size: 15px; color: var(--wine); padding: 8px 0; }
details.bk-done > table { margin-top: 6px; }
table.list tr.late td { background: #FBF0EA; }
table.list tr.late td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
.late-tag { color: var(--combo); }
.pill.late { background: var(--warn); color: #fff; }
table.list td.num, table.list th.num { text-align: right; }
.toolbar { display: flex; gap: 10px; align-items: end; margin-bottom: 14px; flex-wrap: wrap; }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; max-width: 90vw; white-space: pre-line; }
#toast.show { opacity: 1; }
#toast.bad { background: #A3122F; }

@media (max-width: 1440px) {
  .board { grid-template-columns: minmax(0, 1fr) 300px; }
  .tag { width: calc(132px * var(--ts)); }
  .floor-rooms { gap: 8px; }
}
@media (max-width: 1280px) {
  #kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .board { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 900px) {
  body:has(#top:not([hidden])) { padding-left: 0; padding-top: 0; }
  /* Tabs get their own full-width row and wrap: squeezed beside the chips, a phone showed only Sơ đồ and half of Đặt phòng (2026-10-30) */
  #top { position: sticky; top: 0; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 6px 12px; gap: 6px 10px; }
  .brand { font-size: 26px; margin: 0; padding: 0 10px 0 0; border-bottom: 0; border-right: 2px solid var(--brass); }
  .brand small { display: none; }
  #top nav { order: 2; flex: 1 0 100%; flex-direction: row; flex-wrap: wrap; gap: 2px 4px; }
  table.list { display: block; overflow-x: auto; }   /* wide tables (Đặt phòng, Hóa đơn) scroll inside, not the page */
  .tab { white-space: nowrap; padding: 6px 8px; }
  .tab::before { display: none; }
  .tab.on { box-shadow: inset 0 -2px 0 var(--brass); }
  #top .right { order: 1; margin: 0 0 0 auto; display: flex; gap: 8px; min-width: 0; }
  .clock, #who, #cust-screen { display: none; }   /* no second monitor on a phone */
  .chip { width: auto; white-space: nowrap; }
  /* The freshness chip must stay visible on a phone; clip it rather than push the header sideways */
  .conn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
  #map-view { padding: 14px 16px; }
  .board { grid-template-columns: 1fr; }
  .hd { flex-wrap: wrap; gap: 4px 14px; }
  .hd h1 { white-space: nowrap; }
  .queue { position: static; max-height: none; order: -1; }
  #kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .floor { grid-template-columns: 1fr; gap: 4px; }
  .tag { --ts: 1.2; width: calc(50% - 5px); }   /* phone: two per row, the text a step smaller than desktop to fit the half width */
  #legend { margin-left: 0; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .page { padding: 16px; }
}

/* Sơ đồ phòng | Lịch phòng switch */
.hd .view-switch { margin-left: auto; align-self: center; background: var(--paper); }
.ci-tabs { justify-self: start; }
.tag .held { font-size: calc(10.5px * var(--ts)); font-weight: 700; background: #fff; color: #2E4FA3; padding: 0 calc(5px * var(--ts)); border-radius: calc(3px * var(--ts)); white-space: nowrap; }

/* Lịch phòng: rooms × days, bars positioned in px (--colw per day) */
:root { --book: #2E4FA3; --book-loose: #DCE4F7; --stay-out: #B9B0AB; }
#calendar { --lab: 92px; }
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.cal-bar .ghost { color: var(--ink); padding: 7px 12px; }
.cal-nav { display: inline-flex; align-items: center; gap: 6px; }
.cal-nav input { padding: 6px 8px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink-2); }
.sw { display: inline-block; width: 18px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw.stay { background: var(--occ); } .sw.book { background: var(--book); } .sw.out { background: var(--stay-out); }
.sw.loose { background: var(--book-loose); border: 1px dashed var(--book); }
.cal-bar .hint { margin: 0; }
.cal-scroll { overflow: auto; max-height: calc(100vh - 150px); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.cal { position: relative; width: calc(var(--lab) + var(--days) * var(--colw)); }
.cal-row { display: grid; grid-template-columns: var(--lab) calc(var(--days) * var(--colw)); border-bottom: 1px solid var(--line); }
.cal-lab { position: sticky; left: 0; z-index: 2; background: var(--paper); border: 0; border-right: 1px solid var(--line); text-align: left;
  padding: 4px 10px; font: inherit; display: flex; align-items: center; gap: 6px; min-width: 0; }
button.cal-lab { cursor: pointer; }
.cal-lab.room b { font-family: var(--plate); font-size: 20px; font-weight: 600; line-height: 1; }
.cal-lab.room small { color: var(--ink-2); font-size: 11px; }
.cal-lab.room::before { content: ''; width: 4px; align-self: stretch; border-radius: 2px; background: var(--free); margin: 2px 0; }
.cal-lab.hk-dirty::before { background: var(--dirty-fill); } .cal-lab.hk-cleaning::before { background: var(--cleaning); }
.cal-lab.hk-maintenance { opacity: .55; } .cal-lab.hk-maintenance::before { background: #C9B79A; }
.cal-lab.room:hover b { color: var(--wine); }
.cal-lab.loose { font-size: 12px; font-weight: 700; color: var(--book); background: #F3F6FD; }
/* Header: date, weekday, sold · occupancy · free — sticky on vertical scroll */
.cal-head { position: sticky; top: 0; z-index: 4; background: var(--paper); border-bottom: 2px solid var(--line); }
.cal-head .cal-lab { z-index: 5; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; font-weight: 700; font-size: 13px; }
.cal-head .cal-lab small { font-weight: 500; font-size: 10.5px; }
.cal-days { display: grid; grid-template-columns: repeat(var(--days), var(--colw)); }
.cd { display: grid; justify-items: center; align-content: center; gap: 1px; padding: 6px 4px; border-left: 1px solid var(--line); font-size: 12px; min-width: 0; }
.cd > b { font-size: 13px; } .cd > small { color: var(--ink-2); font-size: 11px; }
.cd.we { background: #FBF8F4; }
.cd.today { background: #F7ECEF; box-shadow: inset 0 3px 0 var(--wine); }
.occ-line { display: flex; align-items: center; gap: 6px; width: 100%; justify-content: center; }
.occ-line small { color: var(--ink-2); font-size: 10.5px; }
.pbar { flex: none; width: 40px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--occ); }
.sold { color: var(--occ); font-weight: 700; }
.free { color: var(--free); font-weight: 700; }
.cd .free { font-family: var(--plate); font-size: 22px; line-height: 1; }
.cd .free.neg { color: #fff; background: var(--warn); border-radius: 4px; padding: 0 6px; }
.cal.narrow .pbar, .cal.narrow .occ-line small { display: none; }
/* Type group row: free rooms of that type per day */
.cal-row.grp { background: #F4F1EE; }
.cal-row.grp .cal-lab { background: #F4F1EE; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cal-cells { display: grid; grid-template-columns: repeat(var(--days), var(--colw)); }
.cal-cells span { text-align: center; font-weight: 700; color: var(--free); padding: 5px 0; border-left: 1px solid var(--line); }
.cal-cells span.none { color: var(--ink-2); font-weight: 500; }
.cal-cells span.neg { color: var(--warn); font-weight: 700; }
/* Room track: day lines (and 3-hour lines when zoomed in), bars, drag selection */
.cal-track { position: relative; cursor: cell; touch-action: pan-y;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: var(--colw) 100%; }
.cal.fine .cal-track { background-image: linear-gradient(to right, var(--line) 1px, transparent 1px), linear-gradient(to right, #F1EDEA 1px, transparent 1px);
  background-size: var(--colw) 100%, calc(var(--colw) / 8) 100%; }
.cal-track:not([data-track]) { cursor: default; }
.cbar { position: absolute; height: 30px; border: 0; border-radius: 5px; padding: 2px 6px; color: #fff; text-align: left; cursor: pointer; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 5px; align-content: center; font-size: 11.5px; line-height: 1.2; z-index: 1; }
.cbar b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cbar small { grid-column: 1 / -1; font-size: 10px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.cbar .chip { background: #fff; color: var(--ink); font-size: 9.5px; font-weight: 700; border-radius: 3px; padding: 0 4px; align-self: center; }
.cbar:hover { filter: brightness(1.1); z-index: 3; }
.cbar.stay { background: var(--occ); }
.cbar.stay .chip { color: var(--occ); }
.cbar.stay.over { box-shadow: inset -6px 0 0 var(--warn); }
.cbar.out { background: var(--stay-out); }
.cbar.book { background: var(--book); }
.cbar.book .chip { color: var(--book); }
.cbar.book.loose { background: var(--book-loose); color: var(--book); outline: 1px dashed var(--book); outline-offset: -1px; }
.cbar.book.loose .chip { background: var(--book); color: #fff; }
.cbar.late { box-shadow: inset 0 0 0 2px var(--warn); }
.cbar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cbar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-sel { position: absolute; top: 2px; bottom: 2px; background: color-mix(in srgb, var(--brass) 28%, transparent); outline: 2px solid var(--brass); border-radius: 5px; pointer-events: none; z-index: 2; }
.cal-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--occ); z-index: 3; pointer-events: none; }
@media (max-width: 900px) {
  #calendar { --lab: 66px; }
  .cal-scroll { max-height: calc(100vh - 190px); }
  .cal-bar .hint { display: none; }
  .hd .view-switch { margin-left: 0; }
}

/* Cài đặt */
.set-h { font-size: 18px; margin: 4px 0 4px; }
.set-intro { max-width: 760px; margin-bottom: 14px; }
.set-card { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.set-form { display: grid; gap: 10px; }
.set-form h3 { margin: 0; font-size: 16px; }
.set-form textarea { resize: vertical; }
.set-form details summary { cursor: pointer; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.set-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; margin-top: 8px; }
.set-rooms label { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 6px; }
.set-rooms label span { font-weight: 700; color: var(--ink); }
.set-form .actions { display: flex; justify-content: flex-end; }
.set-preview { display: grid; gap: 6px; align-content: start; }
.preview-tile .tag { cursor: default; }
@media (max-width: 640px) { .set-card { grid-template-columns: 1fr; } }
.pill + .pill { margin-left: 4px; }

/* Tiền phòng dự kiến / Ở thêm (2026-10-25) */
details.est { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; margin: 10px 0; background: var(--paper); }
details.est.section { border-width: 1px; padding: 8px 12px; }
details.est > summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--wine); }
details.est[open] > summary { margin-bottom: 8px; }
details.est .row.due { font-size: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chips button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.chips button b { font-size: 14px; color: var(--ink); }
.chips button.on { border-color: var(--wine); background: #F7EEF2; }
.chips button.on span { color: var(--wine); }
details.est label.until { display: block; margin: 4px 0 10px; font-size: 13px; }

/* Right-click menu on a room tile */
/* no iOS callout / text selection on a press-and-hold */
.tag { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
#tile-menu { position: fixed; z-index: 60; min-width: 180px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 8px 24px rgba(40, 20, 20, .18); padding: 4px; }
#tile-menu .tm-head { font-weight: 700; font-size: 13px; padding: 6px 10px 4px; color: var(--ink-2); }
#tile-menu .tm-head span { font-weight: 400; }
#tile-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; border-radius: 6px; padding: 9px 10px; font: inherit; font-size: 14px; cursor: pointer; color: inherit; }
#tile-menu button:hover:not(:disabled), #tile-menu button:focus-visible { background: #FAF6F2; outline: none; color: var(--wine); }
#tile-menu button:disabled { cursor: not-allowed; color: var(--ink-2); opacity: .7; }
#tile-menu button small { display: block; font-size: 11.5px; }
#tile-menu button small.tm-warn { color: var(--warn); }

/* Kho */
table.stock-list td.stock-low { color: var(--warn); }
table.stock-list td.stock-over { color: var(--free); }
table.stock-list td.stock-fo { background: #FBF5EA; }
table.stock-list .stock-auto { color: var(--ink-2); }
table.stock-list small.stock-auto { display: block; font-size: 11px; }
.stock-tabs { margin-bottom: 14px; }
.sales-presets { display: flex; gap: 6px; flex-wrap: wrap; align-self: center; }
#sales-form .check { align-self: center; }
table.sales-list tfoot th { border-top: 1px solid var(--line); border-bottom: 0; color: var(--ink); font-size: 14px; }
table.sales-list tfoot th.num { text-align: right; }
table.sales-list td:first-child { min-width: 8.5em; }
table.stock-list input { width: 76px; padding: 6px 8px; font-size: 15px; text-align: right; }
table.stock-list td:last-child input { width: 160px; text-align: left; }
table.stock-list .stock-new { font-size: 11px; padding: 1px 6px; border-radius: 8px; background: #EAF3EC; color: var(--free); }
table.stock-list td.stock-own { font-size: 12.5px; }
.stock-moves { margin-top: 24px; }
.stock-moves h2 { font-size: 18px; margin: 0 0 8px; }
dialog select[name=stt] { width: 100%; }
.stock-editbar { position: sticky; top: 0; z-index: 3; }
.stock-editbar label { margin-top: 8px; }
.stock-editbar .btns { margin-top: 8px; }

/* Hóa đơn → Giao tiền quản lý */
h2.bills-sub { font-size: 18px; margin: 28px 0 10px; }
h2.bills-sub .muted { font-size: 14px; font-weight: 400; }

/* Booking confirmation with payment QR (2026-10-30) */
.bk-confirm .row.total { font-weight: 700; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 8px; }
.bk-confirm .row.due { font-size: 20px; font-weight: 700; color: var(--free); }
.qr-box { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: center; margin: 12px 0; }
.qr-img img { width: 220px; height: 220px; display: block; border: 1px solid var(--line); border-radius: 8px; }
.qr-img .callout { grid-column: 1 / -1; }
.qr-bank { display: grid; gap: 4px; font-size: 14px; }
.qr-bank > b:first-child { font-size: 26px; color: var(--free); }
@media (max-width: 640px) { .qr-box { grid-template-columns: 1fr; justify-items: center; } }

/* Anyroom Residential (res.html) — only selectors that exist on that page; the hotel screens are unaffected */
#support { display: block; text-align: center; text-decoration: none; }
.res-set { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 16px; }
.res-set h2 { font-size: 17px; margin: 0 0 12px; }
.res-set form.grid3 { align-items: end; }
.res-set table.list { margin-top: 4px; }
.res-person { position: relative; }
.res-vehicle { align-items: end; }
@media (max-width: 640px) { .res-set form.grid3, #dlg .grid3 { grid-template-columns: 1fr; } }
/* Residential R2: wide tables scroll inside their box on a phone (never the page); meter round; bill lines */
.res-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r); }
.res-scroll > table.list { min-width: 640px; }
.mt-cell { display: grid; gap: 3px; min-width: 130px; }
.mt-cell input { width: 100%; max-width: 160px; }
.mt-cell .muted { font-size: 12.5px; }
.mt-use { font-size: 12px; color: var(--ink-2); min-height: 1em; }
.mt-use.bad { color: var(--warn); font-weight: 600; }
table.res-lines { margin: 4px 0 8px; }
table.res-lines td { padding: 7px 10px; vertical-align: top; }
table.res-lines td.num, .res-scroll td.num { text-align: right; white-space: nowrap; }
.res-adj, .res-fee { align-items: end; }
#drawer .section .btns { flex-wrap: wrap; }
dialog .body #payf { padding: 0; }
.gc-title { margin: 16px 0 2px; font-size: 18px; }
.gc-row { display: grid; grid-template-columns: 150px 150px 1fr; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 13.5px; font-weight: 500; }
.gc-row input[data-money], .gc-row b { text-align: right; }
.gc-head { color: var(--ink-2); font-size: 12px; }
.gc-total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 700; }
.gc-total b { font-size: 17px; padding-right: 10px; }
form.gc .check { display: flex; }
form.gc details { margin: 10px 0; }
@media (max-width: 640px) { .gc-row { grid-template-columns: 1fr 1fr; } .gc-row > :nth-child(3) { grid-column: 1 / -1; } }

/* Nhận phòng: old guests with the typed name (Kiểm tra next to Họ tên) */
.name-hits { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 4px 0 12px; display: grid; gap: 6px; max-height: 280px; overflow-y: auto; }
.name-hits-head { font-size: 12.5px; color: var(--ink-2); }
.name-hit { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 12px; align-items: baseline; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; cursor: pointer; font: inherit; color: inherit; }
.name-hit:hover, .name-hit:focus-visible { border-color: var(--brass); background: #FBF5EA; }
.name-hit span { font-size: 13px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .name-hit { grid-template-columns: 1fr; } }

/* Danh sách đen (2026-11-17) */
.bl-tag { color: #fff; background: var(--occ); border-radius: 4px; padding: 0 5px; font-size: 12px; }
.callout.bl { background: #FBEAEA; border-left-color: var(--occ); }
.bl-found { display: grid; gap: 6px; margin: 4px 0 12px; max-height: 240px; overflow-y: auto; }
.bl-found .name-hit[disabled] { opacity: .55; cursor: default; }
.bl-list td { vertical-align: top; }
.bl-list small { color: var(--ink-2); }
