:root {
  --cream: #F7F2E7;
  --cream2: #EFE8D8;
  --line: #E1D8C4;
  --ink: #3B2A1E;
  --ink2: #6B5744;
  --muted: #8A7360;
  --accent: #B9713F;
  --accent-tint: #F0DFCB;
  --good: #4B7B5B;
  --good-tint: #E3EDE3;
  --bad: #B5482E;
  --bad-tint: #F5DCD2;

  --header-h: 56px;
  --nav-h: 78px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, input {
  font-family: inherit;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--cream);
}

/* ---------- Header ---------- */
.app-header {
  height: var(--header-h);
  padding-top: env(safe-area-inset-top);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 16px;
  padding-right: 10px;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}

.app-logo {
  height: 24px;
  width: auto;
  display: block;
}

.header-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--cream2);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--cream2);
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.sync-badge.syncing {
  color: var(--accent);
  background: var(--accent-tint);
}

.sync-badge.offline {
  color: var(--bad);
  background: var(--bad-tint);
}

/* ---------- Views ---------- */
.views {
  flex: 1;
  min-height: 0;
  position: relative;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
}

.view.active {
  display: block;
}

.view-scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px calc(var(--nav-h) + 28px);
  /* Fills the full width on phone and iPad alike. Only past ~1100px
     (iPad Pro landscape and larger) does a cap kick in, so text lines
     don't run edge-to-edge into unreadable widths. */
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Tablet (iPad) adjustments — use the extra width instead of
   leaving it empty ---------- */
@media (min-width: 700px) {
  .view-scroll {
    padding-left: 28px;
    padding-right: 28px;
  }
  .room-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .breakfast-room-card .pill-group,
  #paymentGroup {
    flex-wrap: wrap;
  }
}

@media (min-width: 900px) {
  .view-scroll {
    padding-left: 36px;
    padding-right: 36px;
  }
  .room-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.page-title {
  font-size: 20px;
  font-weight: 800;
}

.page-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}

.page-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 6px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

/* ---------- Cards ---------- */
.card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 14.5px;
  font-weight: 700;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-title-row .card-title {
  margin: 0;
}

.pie-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 4px;
}

.pie-filter-row .pie-gran-select,
.pie-filter-row .pie-month-input,
.pie-filter-row .pie-quarter-select,
.pie-filter-row .pie-quarter-year,
.pie-filter-row .pie-year-input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 8px;
  font-size: 12px;
  color: var(--ink2);
  background: #fff;
  flex-shrink: 0;
}

.pie-filter-row .pie-quarter-year,
.pie-filter-row .pie-year-input {
  width: 90px;
}

.card-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  margin-bottom: 12px;
}

.req {
  color: var(--bad);
}

.field {
  margin-top: 12px;
}

.field:first-of-type {
  margin-top: 12px;
}

.field label,
.field-block > label,
.sub-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink2);
  margin-bottom: 6px;
}

.field-block {
  margin-top: 16px;
}

input[type="text"],
input[type="number"],
input[type="time"],
input[type="date"] {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--cream);
  padding: 0 12px;
  font-size: 15px;
  color: var(--ink);
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="time"]:focus,
input[type="date"]:focus {
  border-color: var(--accent);
  background: #fff;
}

.textarea-note {
  width: 100%;
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--cream);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  resize: vertical;
  font-family: inherit;
}

.textarea-note:focus {
  border-color: var(--accent);
  background: #fff;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- Capture box ---------- */
.capture-box {
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  background: var(--cream);
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.capture-box-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.capture-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.capture-result.hidden,
.hidden {
  display: none !important;
}

.capture-result img {
  width: 100%;
  height: 220px;
  /* "contain" so the preview always shows the whole photo at its real
     proportions (letterboxed if needed) instead of cropping/zooming into
     it like "cover" did — that cropping is what looked "distorted". */
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: block;
}

/* ---------- Buttons ---------- */
.btn-ghost-sm {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink2);
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 20px;
}

.btn-primary {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 14px;
  background: var(--ink);
  color: var(--cream);
  font-size: 15px;
  font-weight: 800;
  margin-top: 4px;
}

.btn-primary:disabled {
  opacity: 0.45;
}

.form-error {
  color: var(--bad);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  margin-top: 10px;
  min-height: 16px;
}

.form-error:not(:empty) {
  background: #FBEAE8;
  border: 1px solid #E8B9B3;
  border-radius: 10px;
  padding: 10px 12px;
}

/* ---------- Signature ---------- */
.sig-wrap {
  position: relative;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  background: var(--cream);
  height: 160px;
  overflow: hidden;
}

#sigPad {
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
}

.sig-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}

.sig-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.sig-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.sig-status.signed {
  color: var(--good);
}

/* ---------- Pills ---------- */
.pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  flex: 1;
  min-width: 90px;
  padding: 11px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink2);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.pill.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

/* Removable quick-pick chip (user-defined expense categories / item names):
   a select-me label plus a small × to drop it from the shortcut list. */
.pill-chip {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-width: 110px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.pill-chip.selected {
  background: var(--ink);
  border-color: var(--ink);
}

.pill-chip-label {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px 6px 11px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink2);
  text-align: left;
}

.pill-chip.selected .pill-chip-label {
  color: var(--cream);
}

.pill-chip-x {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.pill-chip.selected .pill-chip-x {
  color: var(--cream);
  opacity: 0.7;
}

/* ---------- Booking channel colors ----------
   Matches Bank's own paper/Excel booking-sheet color code:
   red = LINE/FB/phone with bill, purple = Agoda, no color = LINE/FB/phone
   no bill, brown = sugar factory no breakfast, blue = Booking.com,
   orange = sugar factory with breakfast, yellow = LINE/FB/phone unpaid. */
.pill-subgroup { margin-top: 4px; }

.pill-red.selected    { background: #C0392B; border-color: #C0392B; color: #fff; }
.pill-yellow.selected { background: #E1B300; border-color: #E1B300; color: #3B2A1E; }
.pill-brown.selected  { background: #6B4226; border-color: #6B4226; color: #fff; }
.pill-orange.selected { background: #D9822B; border-color: #D9822B; color: #fff; }
.pill-none.selected   { background: var(--ink); border-color: var(--ink); color: var(--cream); }

/* .checkin-item (booking cards) set a 4-side `border` shorthand of their
   own later in this file — these need the extra `.checkin-item` specificity
   (and border-left-color/width, not the `border-left` shorthand) so that
   shorthand doesn't reset the color back to the default line color. */
.checkin-item.chan-red,    .monitor-row.chan-red    { border-left-width: 6px; border-left-style: solid; border-left-color: #C0392B; background: #FBEAE7; }
.checkin-item.chan-purple, .monitor-row.chan-purple { border-left-width: 6px; border-left-style: solid; border-left-color: #8E44AD; background: #F1E7F5; }
.checkin-item.chan-blue,   .monitor-row.chan-blue   { border-left-width: 6px; border-left-style: solid; border-left-color: #2E86DE; background: #E6F0FB; }
.checkin-item.chan-brown,  .monitor-row.chan-brown  { border-left-width: 6px; border-left-style: solid; border-left-color: #6B4226; background: #EDE3DA; }
.checkin-item.chan-orange, .monitor-row.chan-orange { border-left-width: 6px; border-left-style: solid; border-left-color: #D9822B; background: #FBEBDA; }
.checkin-item.chan-yellow, .monitor-row.chan-yellow { border-left-width: 6px; border-left-style: solid; border-left-color: #E1B300; background: #FBF6DD; }

/* Same legend, filled solid — for the small month-table cells where a thin
   left border alone wouldn't read at a glance. */
td.month-room-cell.chan-red    { background: #C0392B; color: #fff; }
td.month-room-cell.chan-purple { background: #8E44AD; color: #fff; }
td.month-room-cell.chan-blue   { background: #2E86DE; color: #fff; }
td.month-room-cell.chan-brown  { background: #6B4226; color: #fff; }
td.month-room-cell.chan-orange { background: #D9822B; color: #fff; }
td.month-room-cell.chan-yellow { background: #E1B300; color: #3B2A1E; }

.monitor-row.chan-red,
.monitor-row.chan-purple,
.monitor-row.chan-blue,
.monitor-row.chan-brown,
.monitor-row.chan-orange,
.monitor-row.chan-yellow {
  padding-left: 10px;
  margin-left: -1px;
}

.channel-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.channel-dot.chan-red    { background: #C0392B; border: none; }
.channel-dot.chan-purple { background: #8E44AD; border: none; }
.channel-dot.chan-blue   { background: #2E86DE; border: none; }
.channel-dot.chan-brown  { background: #6B4226; border: none; }
.channel-dot.chan-orange { background: #D9822B; border: none; }
.channel-dot.chan-yellow { background: #E1B300; border: none; }
.channel-dot.chan-none   { background: #fff; border: 1.5px solid var(--line); }

/* ---------- Stepper ---------- */
.stepper {
  display: flex;
  align-items: center;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--cream);
  overflow: hidden;
}

.stepper-btn {
  width: 40px;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.stepper input {
  flex: 1;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  outline: none;
}

.sub-fields {
  margin-top: 12px;
}

.breakfast-drink-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.breakfast-drink-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 140px;
}

.breakfast-drink-item .stepper {
  height: 36px;
}

.breakfast-drink-item .stepper-btn {
  width: 32px;
  font-size: 16px;
}

.breakfast-drink-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------- Per-room breakfast ---------- */
.breakfast-rooms-hint {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--cream2);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.breakfast-room-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
  background: var(--cream);
}

.breakfast-room-card:first-child {
  margin-top: 0;
}

.breakfast-room-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
}

.breakfast-room-beds {
  font-weight: 600;
  color: var(--muted);
}

.pill.sm {
  padding: 8px 8px;
  font-size: 12px;
  min-width: 0;
}

/* ---------- Today list ---------- */
.today-list {
  margin-top: 22px;
}

.section-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 10px;
}

.empty-note {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--cream2);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.checkin-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
}

.checkin-item-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.checkin-avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 54px;
  flex-shrink: 0;
}

.checkin-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--cream2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  flex-shrink: 0;
  overflow: hidden;
}

.checkin-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.checkin-firstname {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink2);
  margin-top: 4px;
  max-width: 54px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkin-info {
  flex-grow: 1;
  min-width: 0;
}

.checkin-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.checkin-name-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.checkin-room-badge {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.checkin-name {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkin-item.checked-out {
  opacity: 0.6;
}

.checkin-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.6;
}

.checkin-time {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--good);
  background: var(--good-tint);
  padding: 5px 10px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.checkin-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.checkin-item-actions .btn-ghost-sm {
  align-self: auto;
}

/* ---------- Placeholder views ---------- */
.placeholder-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  margin-top: 8px;
}

.placeholder-title {
  font-size: 15px;
  font-weight: 800;
}

.placeholder-text {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 280px;
}

/* ---------- Finance dashboard ---------- */
.finance-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.finance-summary-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}

.finance-summary-card#financeNetCard {
  grid-column: 1 / -1;
}

.finance-summary-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.finance-summary-value {
  font-size: 19px;
  font-weight: 800;
}

.finance-revenue .finance-summary-value {
  color: var(--good);
}

.finance-expense .finance-summary-value {
  color: var(--bad);
}

.finance-summary-card.net-positive .finance-summary-value {
  color: var(--good);
}

.finance-summary-card.net-negative .finance-summary-value {
  color: var(--bad);
}

.finance-category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.finance-category-row:last-child {
  border-bottom: none;
}

.finance-category-name {
  color: var(--ink2);
}

.finance-category-amount {
  font-weight: 800;
  color: var(--bad);
}

.finance-chart-wrap {
  position: relative;
  margin-top: 12px;
  height: 220px;
}

.finance-chart-wrap-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.finance-chart-inner {
  height: 220px;
}

.finance-viewmode-card {
  background: var(--accent-tint);
  border-color: var(--accent);
}

.finance-compare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.finance-compare-row:last-child {
  border-bottom: none;
}

.finance-compare-row-label {
  color: var(--ink2);
  font-weight: 700;
  flex: 1 1 auto;
}

.finance-compare-row-values {
  display: flex;
  gap: 10px;
  font-weight: 800;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.finance-compare-row-values .cmp-rev { color: var(--good); }
.finance-compare-row-values .cmp-exp { color: var(--bad); }
.finance-compare-row-values .cmp-net { color: var(--ink); }

.finance-chart-wrap-pie {
  height: 220px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- "check-in started from a booking" banner ---------- */
.from-booking-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 14px;
}
.from-booking-banner .btn-ghost-sm {
  flex-shrink: 0;
}

/* ---------- Checkbox row (e.g. "ขอใบเสร็จ") ---------- */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.receipt-badge {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 3px 7px;
  border-radius: 8px;
  white-space: nowrap;
  margin-left: 6px;
}

/* ---------- Monitor: month table ---------- */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.month-nav-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.month-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.month-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 780px;
  font-size: 11px;
}

.month-table th,
.month-table td {
  border: 1px solid var(--line);
  padding: 4px 5px;
  text-align: left;
  vertical-align: top;
}

.month-table th {
  background: var(--cream2);
  color: var(--ink2);
  font-weight: 800;
  font-size: 10.5px;
  text-align: center;
  position: sticky;
  top: 0;
}

.month-table td.month-date-cell {
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  background: var(--cream2);
  position: sticky;
  left: 0;
}

.month-table td.month-date-cell.is-today {
  color: var(--accent);
}

.month-table td.month-room-cell {
  min-width: 64px;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-table td.month-room-cell-filled {
  cursor: pointer;
}

.month-table td.month-room-cell-filled:active {
  filter: brightness(0.9);
}

/* ---------- Monitor page ---------- */
.monitor-two-col {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
}

.monitor-col {
  flex: 1 1 260px;
  min-width: 220px;
}

.monitor-col:not(:last-child) {
  border-right: 1px solid var(--line);
  padding-right: 16px;
}

@media (max-width: 620px) {
  .monitor-col:not(:last-child) {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 14px;
  }
}

.monitor-col-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 4px;
}

.monitor-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.monitor-row:last-child {
  border-bottom: none;
}

.monitor-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.monitor-row-time {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.monitor-row-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.monitor-row-actions {
  margin-top: 8px;
}

.monitor-row-actions .btn-ghost-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.monitor-group-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  margin: 14px 0 6px;
}

.monitor-group-title:first-child {
  margin-top: 4px;
}

.monitor-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

.monitor-group-row .monitor-time-badge {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 800;
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  flex-shrink: 0;
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  flex-shrink: 0;
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--cream2);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 8px;
}

.nav-item {
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  padding: 0 2px;
}

.nav-item span {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active span {
  font-weight: 700;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 18px);
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: var(--cream);
  font-size: 13px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 30px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Capture result actions ---------- */
.capture-result-actions {
  display: flex;
  gap: 8px;
}

/* ---------- Scan status ---------- */
.scan-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink2);
  margin-bottom: 12px;
}

.scan-status.hidden { display: none; }

.scan-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.scan-note {
  font-size: 12px;
  color: var(--bad);
  font-weight: 600;
  margin-bottom: 12px;
}

.scan-status.scan-note-mode {
  background: var(--bad-tint);
  color: var(--bad);
}

/* ---------- Guest signature — small preview + full-screen signing modal ---------- */
.sig-preview-wrap {
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  height: 110px;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  overflow: hidden;
}

.sig-preview-wrap img {
  max-width: 100%;
  max-height: 100%;
}

.sig-preview-empty {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.sig-pad-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

.sig-modal-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.sig-modal-overlay.hidden { display: none; }

.sig-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sig-modal-title {
  font-size: 16px;
  font-weight: 800;
}

.sig-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--cream2);
  color: var(--ink);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sig-extra-preview {
  display: flex;
  gap: 14px;
  margin: -4px 0 10px;
}

.sig-extra-thumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.sig-extra-thumb img {
  height: 26px;
  max-width: 100px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

/* Three equal-sized handwriting boxes: phone, plate, signature — one guest,
   one screen, one pen, instead of typing phone/plate on a keyboard. */
.sig-modal-pads {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 18px 0;
  min-height: 0;
}

.sig-pad-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sig-pad-box-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.sig-pad-box-label span {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink2);
}

.sig-pad-clear-btn {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 4px;
}

.sig-modal-pad-wrap {
  flex: 1;
  position: relative;
  border: 1.5px dashed var(--line);
  border-radius: 16px;
  background: var(--cream);
  touch-action: none;
  overflow: hidden;
  min-height: 0;
}

.sig-modal-pad-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.sig-modal-actions {
  display: flex;
  gap: 10px;
  padding: 14px 18px calc(env(safe-area-inset-bottom) + 14px);
  flex-shrink: 0;
}

.sig-modal-actions .btn-ghost-sm {
  flex: 1;
  text-align: center;
}

/* ---------- Guest summary (post-scan) ---------- */
.guest-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.guest-summary-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Room grid ---------- */
.room-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.room-btn {
  border: 1px solid var(--line);
  background: var(--cream);
  border-radius: 12px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.room-btn .room-no {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.room-btn .room-beds {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

.room-btn .room-price {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
}

.room-btn.selected .room-price {
  color: var(--cream);
}

.room-btn.selected {
  background: var(--ink);
  border-color: var(--ink);
}

.room-btn.selected .room-no,
.room-btn.selected .room-beds {
  color: var(--cream);
}

.room-btn.occupied {
  opacity: 0.45;
}

.room-btn.occupied .room-beds {
  color: var(--bad);
}

/* Booked-but-not-yet-checked-in rooms get the accent (amber/brown) color
   instead of red, so staff can tell "รอเช็กอิน" apart from "เช็กอินแล้ว" at a glance. */
.room-btn.pending .room-beds {
  color: var(--accent);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(59, 42, 30, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.hidden { display: none; }

.modal-sheet {
  width: 100%;
  max-width: 420px;
  background: var(--cream);
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
}

.modal-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.staff-photo-picker {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1.5px dashed var(--line);
  background: #fff;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.staff-photo-picker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.staff-photo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.staff-photo-empty span {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  max-width: 64px;
  line-height: 1.3;
}

.staff-signature-picker {
  width: 100%;
  height: 90px;
  border-radius: 12px;
  border: 1.5px dashed var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.staff-signature-picker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.staff-signature-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.staff-signature-empty span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions .btn-ghost-sm {
  flex: 1;
  text-align: center;
}

.btn-primary-sm {
  flex: 2;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--ink);
  color: var(--cream);
  font-size: 13.5px;
  font-weight: 800;
}

/* ---------- Header staff avatar ---------- */
.header-icon-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ---------- Desktop preview convenience ----------
   Only shows the floating phone-frame look when the page is opened as an
   ordinary browser tab (e.g. previewing on a desktop). Once added to the
   iPad/iPhone home screen and launched as a standalone app, this never
   applies, so the app always fills the entire screen edge to edge there. */
@media (min-width: 560px) and (display-mode: browser) {
  body {
    background: #EDE6D6;
  }
  #app {
    max-width: 420px;
    left: 50%;
    margin-left: -210px;
    top: 16px;
    bottom: 16px;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: 0 20px 60px rgba(59, 42, 30, 0.18);
  }
}
