:root {
  --agoda: #c0392b;
  --roomscope: #2471a3;
  --direct: #1e8449;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #2c3e50;
  --muted: #7f8c8d;
  --green: #27ae60;
  --urgent: #e74c3c;
  --line: #06c755;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', Tahoma, 'Noto Sans Thai', sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a5276, #117864);
}
.login-card {
  background: var(--card); border-radius: 16px; padding: 36px 32px;
  width: 340px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.login-card input {
  width: 100%; padding: 12px; font-size: 24px; text-align: center;
  letter-spacing: 8px; border: 2px solid #d5dbdb; border-radius: 10px; margin-bottom: 14px;
}
.login-card button {
  width: 100%; padding: 12px; font-size: 16px; border: 0; border-radius: 10px;
  background: #117864; color: #fff; cursor: pointer; font-weight: 600;
}
.login-card .err { color: var(--urgent); font-size: 13px; margin-top: 10px; min-height: 18px; }
.login-card .hint { color: var(--muted); font-size: 12px; margin-top: 14px; }

/* ---------- layout ---------- */
header.topbar {
  background: #1a5276; color: #fff; padding: 10px 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
header.topbar h1 { font-size: 18px; flex: 1; }
header.topbar .badge-demo { background: #f39c12; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; }
header.topbar button { background: rgba(255,255,255,.15); color: #fff; border: 0; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.main { display: grid; grid-template-columns: 1fr 330px; gap: 14px; padding: 14px; max-width: 1500px; margin: 0 auto; }
@media (max-width: 980px) { .main { grid-template-columns: 1fr; } }
.card { background: var(--card); border-radius: 12px; padding: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.card h2 { font-size: 15px; margin-bottom: 10px; }

/* ---------- conflict banner ---------- */
.banner {
  background: var(--urgent); color: #fff; border-radius: 12px; padding: 12px 16px;
  margin: 14px 14px 0; max-width: 1472px; font-weight: 600; display: none;
  animation: blink 1.2s infinite;
}
@keyframes blink { 50% { opacity: .75; } }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cal-head .month-label { font-weight: 700; font-size: 16px; flex: 1; text-align: center; }
.cal-head button { border: 1px solid #d5dbdb; background: #fff; border-radius: 8px; padding: 5px 14px; cursor: pointer; font-size: 15px; }
.cal-scroll { overflow-x: auto; }
table.cal { border-collapse: collapse; width: 100%; min-width: 900px; }
table.cal th, table.cal td { border: 1px solid #e5e8e8; text-align: center; }
table.cal th { background: #eaf2f8; font-size: 11px; padding: 4px 1px; min-width: 26px; }
table.cal th.today { background: #f9e79f; }
table.cal td.house-name {
  text-align: left; padding: 6px 8px; font-size: 13px; font-weight: 600;
  white-space: nowrap; background: #fbfcfc; position: sticky; left: 0;
}
table.cal td.day { height: 38px; padding: 1px; position: relative; cursor: default; }
table.cal td.day.today { background: #fef9e7; }
.chip {
  display: block; height: 16px; border-radius: 4px; font-size: 10px; color: #fff;
  line-height: 16px; overflow: hidden; cursor: pointer; margin-bottom: 1px;
}
.chip.agoda { background: var(--agoda); }
.chip.roomscope { background: var(--roomscope); }
.chip.direct { background: var(--direct); }
.chip.pending { outline: 2px dashed #f39c12; outline-offset: -2px; }
.chip.hold { opacity: .65; outline: 2px dotted #7d3c98; outline-offset: -2px; }
.btn-confirm { background: #7d3c98; color: #fff; }
.pending-item.hold-item { border-color: #d2b4de; background: #f5eef8; }
.pending-item .src.direct { color: var(--direct); }
td.day.conflict { background: #fadbd8; box-shadow: inset 0 0 0 2px var(--urgent); }
.legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }

/* ---------- pending ---------- */
.pending-item {
  border: 1px solid #f5cba7; background: #fef5e7; border-radius: 10px;
  padding: 10px; margin-bottom: 8px; font-size: 13px;
}
.pending-item .src { font-weight: 700; }
.pending-item .src.agoda { color: var(--agoda); }
.pending-item .src.roomscope { color: var(--roomscope); }
.pending-item .actions { margin-top: 8px; display: flex; gap: 6px; }
.pending-item button {
  border: 0; border-radius: 7px; padding: 6px 10px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.btn-done { background: var(--green); color: #fff; }
.btn-cancel { background: #ecf0f1; color: var(--muted); }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 12px 0; }

/* ---------- LINE feed ---------- */
.line-head { display: flex; align-items: center; gap: 8px; }
.line-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.noti {
  border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; font-size: 12.5px;
  background: #eafaf1; border: 1px solid #d4efdf;
}
.noti.warn { background: #fef9e7; border-color: #f9e79f; }
.noti.urgent { background: #fdedec; border-color: #f5b7b1; font-weight: 600; }
.noti .time { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }

/* ---------- simulate ---------- */
.sim-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.sim-buttons button {
  flex: 1; border: 0; border-radius: 10px; padding: 10px; color: #fff;
  cursor: pointer; font-size: 13px; font-weight: 600; min-width: 130px;
}
.sim-agoda { background: var(--agoda); }
.sim-roomscope { background: var(--roomscope); }
.sim-note { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

/* ---------- modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: 14px; padding: 20px; width: 360px; max-width: 92vw; }
.modal h3 { margin-bottom: 12px; font-size: 16px; }
.modal .row { margin-bottom: 10px; font-size: 13.5px; }
.modal label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.modal select, .modal input {
  width: 100%; padding: 8px; border: 1px solid #d5dbdb; border-radius: 8px; font-size: 14px;
}
.modal .modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal .modal-actions button {
  flex: 1; padding: 10px; border: 0; border-radius: 9px; cursor: pointer; font-weight: 600;
}
.btn-primary { background: #117864; color: #fff; }
.btn-ghost { background: #ecf0f1; }
/* ---------- public booking page ---------- */
.book-body { background: linear-gradient(160deg, #eafaf1, #d4efdf 60%, #fcf3cf); min-height: 100vh; font-family: 'Prompt', 'Segoe UI', sans-serif; }
.book-wrap { max-width: 560px; margin: 0 auto; padding: 18px 14px 40px; }
.book-hero-img {
  background: linear-gradient(120deg, #145a32, #1e8449 55%, #f1c40f);
  background-size: cover; background-position: center; min-height: 190px;
  display: flex; align-items: flex-end;
}
.hero-overlay {
  width: 100%; padding: 46px 18px 16px; color: #fff; text-align: center;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.hero-overlay h1 { font-size: 28px; font-weight: 700; }
.hero-overlay h1 span { font-weight: 400; font-size: 20px; opacity: .9; }
.hero-overlay p { font-size: 14px; margin-top: 2px; }
.hero-badges { margin-top: 8px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.hero-badges span {
  background: rgba(255,255,255,.18); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.35); border-radius: 20px;
  padding: 3px 10px; font-size: 11.5px;
}
.step-no {
  display: inline-flex; width: 22px; height: 22px; border-radius: 50%;
  background: var(--direct); color: #fff; font-size: 13px;
  align-items: center; justify-content: center; margin-right: 6px;
}
.book-card { margin-bottom: 14px; }
.book-dates { display: flex; gap: 10px; }
.book-dates > div { flex: 1; }
.book-dates label, .book-card .row label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.book-dates input, .book-dates select, .book-card .row input {
  width: 100%; padding: 10px; border: 1px solid #d5dbdb; border-radius: 9px; font-size: 15px;
}
.book-card .row { margin-bottom: 10px; }
.house-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.house-btn {
  border: 2px solid #a9dfbf; background: #fff; border-radius: 14px; padding: 0;
  text-align: left; cursor: pointer; display: flex; flex-direction: column;
  overflow: hidden; font-family: inherit; transition: transform .12s, box-shadow .12s;
}
.house-btn:not(.full):hover { border-color: var(--direct); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20,90,50,.18); }
.house-btn .himg { width: 100%; height: 92px; object-fit: cover; display: block; background: #d5f5e3; }
.house-btn .himg-ph {
  width: 100%; height: 92px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #d5f5e3, #fcf3cf); font-size: 30px;
}
.house-btn .hbody { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.house-btn .hname { font-weight: 600; font-size: 13.5px; }
.house-btn .hcap { font-size: 11.5px; color: var(--muted); }
.house-btn .hstat { font-size: 12.5px; color: var(--direct); font-weight: 600; }
.house-btn.full { border-color: #e5e8e8; cursor: not-allowed; }
.house-btn.full .himg, .house-btn.full .himg-ph { filter: grayscale(1); opacity: .6; }
.house-btn.full .hstat { color: #cb4335; }
.pay-qr { display: block; max-width: 220px; width: 100%; margin: 10px auto; border-radius: 10px; border: 1px solid #e5e8e8; }
.book-summary {
  background: #eafaf1; border: 1px solid #a9dfbf; border-radius: 10px;
  padding: 10px 12px; font-size: 14px; margin-bottom: 12px;
}
.policy-box {
  background: #fbfcfc; border: 1px solid #e5e8e8; border-radius: 10px;
  padding: 10px 12px; margin: 4px 0 10px; font-size: 13px;
}
.policy-box summary { cursor: pointer; font-size: 13px; color: #6e5b00; }
.policy-box ul { margin: 8px 0 2px 18px; line-height: 1.8; color: #4d5656; }
.accept-row {
  display: flex; gap: 8px; align-items: flex-start; font-size: 13px;
  margin-bottom: 8px; cursor: pointer; color: #2c3e50;
}
.accept-row input { margin-top: 3px; width: 16px; height: 16px; }
.amenity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.amenity-grid span {
  background: #f8fbf9; border: 1px solid #e8f3ec; border-radius: 9px;
  padding: 8px 10px; font-size: 12.5px; color: #34495e;
}
.poi-list { list-style: none; margin: 4px 0 12px; }
.poi-list li {
  display: flex; justify-content: space-between; font-size: 12.5px; color: #4d5656;
  padding: 5px 2px; border-bottom: 1px dashed #eaeded;
}
.poi-list li span { color: var(--muted); white-space: nowrap; margin-left: 10px; }
.info-card p { font-size: 13px; line-height: 1.8; margin-bottom: 10px; color: #4d5656; }
.info-card .info-thanks { color: #145a32; }
.fb-link { color: #1a5276; font-weight: 600; text-decoration: none; }
.fb-link:hover { text-decoration: underline; }
.book-actions { display: flex; gap: 8px; margin-top: 6px; }
.book-actions button { flex: 1; padding: 12px; border: 0; border-radius: 10px; font-weight: 600; cursor: pointer; font-size: 15px; }
.book-card .err { color: var(--urgent); font-size: 13px; min-height: 18px; margin-bottom: 6px; }
.book-success { text-align: center; }
.big-check { font-size: 44px; }
.ref-box {
  background: #fef9e7; border: 1px solid #f7dc6f; border-radius: 10px;
  padding: 12px; margin: 12px 0; font-size: 14.5px;
}
.ref-box .mail-note { font-size: 12px; color: var(--muted); }
.pay-box {
  text-align: left; background: #fdfefe; border: 1px solid #d5dbdb; border-radius: 10px;
  padding: 12px; margin-bottom: 14px; font-size: 13.5px;
}
.pay-box #payInfo { margin: 8px 0; white-space: pre-line; }
.pay-note { font-size: 12px; color: var(--muted); }
.book-success .btn-primary { width: 100%; padding: 12px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 600; }
.book-foot { text-align: center; font-size: 11.5px; color: #7d8a8a; margin-top: 6px; }

/* ---------- gallery ---------- */
.pic-badge {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  background: rgba(0,0,0,.55); color: #fff; border-radius: 14px;
  padding: 2px 8px; font-size: 11px; cursor: zoom-in;
}
.house-btn { position: relative; }
.gal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 100;
  display: none; align-items: center; justify-content: center;
}
.gal-bg.open { display: flex; }
.gal-bg img { max-width: 92vw; max-height: 84vh; border-radius: 8px; object-fit: contain; }
.gal-close, .gal-nav {
  position: fixed; background: rgba(255,255,255,.15); color: #fff; border: 0;
  border-radius: 50%; width: 42px; height: 42px; font-size: 22px; cursor: pointer; z-index: 101;
}
.gal-close { top: 14px; right: 14px; }
.gal-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.gal-next { right: 8px; top: 50%; transform: translateY(-50%); }
.gal-count {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 13px; background: rgba(0,0,0,.4); border-radius: 12px; padding: 3px 12px;
}

/* ---------- image manager ---------- */
.modal.modal-wide { width: 560px; max-height: 86vh; overflow-y: auto; }
.img-hint {
  background: #fef9e7; border: 1px solid #f7dc6f; border-radius: 9px;
  padding: 9px 11px; font-size: 11.5px; line-height: 1.7; margin-bottom: 10px; color: #6e5b00;
}
.img-row .isize { font-weight: 400; font-size: 10.5px; color: var(--muted); margin-left: 4px; }
.img-row-house { display: block; }
.gthumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.gthumb { position: relative; display: inline-block; }
.gthumb img { width: 72px; height: 50px; object-fit: cover; border-radius: 7px; border: 1px solid #e5e8e8; display: block; }
.gthumb .gdel {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  border: 0; border-radius: 50%; background: var(--urgent); color: #fff;
  font-size: 10px; line-height: 18px; padding: 0; cursor: pointer;
}
.gempty { font-size: 11.5px; color: var(--muted); }
.gadd { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; }
.img-rows { display: flex; flex-direction: column; gap: 8px; }
.img-row {
  display: grid; grid-template-columns: 64px 1fr auto auto; gap: 8px;
  align-items: center; border: 1px solid #e5e8e8; border-radius: 10px; padding: 8px;
}
.img-row .ithumb {
  width: 64px; height: 44px; object-fit: cover; border-radius: 7px;
  background: #f0f3f4; display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.img-row .ilabel { font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.img-row input { width: 100%; padding: 6px 8px; border: 1px solid #d5dbdb; border-radius: 7px; font-size: 12px; }
.img-row button {
  border: 0; border-radius: 7px; padding: 7px 10px; cursor: pointer;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.img-row .btn-link { background: #d6eaf8; color: #1a5276; }
.img-row .btn-up { background: #117864; color: #fff; }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #2c3e50; color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 14px; opacity: 0; transition: opacity .3s; z-index: 60; pointer-events: none;
}
.toast.show { opacity: 1; }
