/* =========================================================
   Solomon Hill — hotel management app
   ========================================================= */
:root {
  --bg: #f4f3ee;
  --surface: #ffffff;
  --surface-2: #f8f7f2;
  --line: #e6e3d9;
  --ink: #18221a;
  --ink-2: #4a564c;
  --muted: #7a857b;
  --primary: #12681a;
  --primary-ink: #ffffff;
  --primary-soft: #e5f0e2;
  --gold: #d9a52e;
  --gold-soft: #fbf1d7;
  --brown: #553d1f;
  --sidebar: #0b3d10;
  --sidebar-ink: rgba(255, 255, 255, .78);
  --bar: #2f8a38;
  --bar-hover: #12681a;
  /* status colours: always shown with a text label */
  --s-available: #2e7d32; --s-available-bg: #e6f4e7;
  --s-occupied: #1f5fbf;  --s-occupied-bg: #e5eefc;
  --s-reserved: #a86b00;  --s-reserved-bg: #fdf0d5;
  --s-dirty: #b5480f;     --s-dirty-bg: #fde9de;
  --s-maint: #5c6370;     --s-maint-bg: #eceef1;
  --s-cancel: #b42318;    --s-cancel-bg: #fde7e5;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 16, .05), 0 6px 20px -10px rgba(16, 40, 16, .18);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .35);
  --font: 'Kantumruy Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1410;
  --surface: #161e18;
  --surface-2: #1c261e;
  --line: #2a362c;
  --ink: #e8efe8;
  --ink-2: #b7c3b8;
  --muted: #84928a;
  --primary: #3fa34a;
  --primary-ink: #06200a;
  --primary-soft: #1d3320;
  --gold-soft: #3a3016;
  --sidebar: #08160a;
  --bar: #4caf55;
  --bar-hover: #7ccf83;
  --s-available: #6fcf76; --s-available-bg: #173219;
  --s-occupied: #7fb0ff;  --s-occupied-bg: #172741;
  --s-reserved: #f0bd57;  --s-reserved-bg: #3b2d10;
  --s-dirty: #ff9a66;     --s-dirty-bg: #3d2215;
  --s-maint: #aab2bf;     --s-maint-bg: #262b33;
  --s-cancel: #ff8a80;    --s-cancel-bg: #3d1a17;
  --danger: #ff8a80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
html[lang="km"] body { line-height: 1.75; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
[hidden] { display: none !important; }
.ic { flex: none; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #2b1f05; }
.btn-gold:hover { background: var(--gold); filter: brightness(1.06); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--s-cancel-bg); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; padding: 11px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.field input, .field select, .field textarea, .input {
  width: 100%; min-width: 0; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font-size: 14px; font-weight: 400; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.field small { font-weight: 400; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { accent-color: var(--primary); width: 16px; height: 16px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.form-error { color: var(--danger); margin: 0; font-weight: 500; }

/* ---------- language switch ---------- */
.lang-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.lang-switch button { border: 0; background: transparent; padding: 3px 11px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.lang-switch button.active { background: var(--primary); color: var(--primary-ink); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: #12681a; display: grid; place-items: center; padding: 40px; }
.login-art img { width: min(460px, 90%); border-radius: 24px; }
.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; position: relative; background: var(--surface); }
.login-panel > .lang-switch { position: absolute; top: 20px; right: 20px; }
.login-form { width: min(380px, 100%); display: grid; gap: 14px; }
.login-form h1 { margin: 0; font-size: 28px; }
.login-form .muted { margin: -8px 0 8px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: 13.5px; justify-self: center; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sb-name { font-family: 'Great Vibes', cursive; font-size: 27px; color: #fff; line-height: 1; }
.sb-sub { font-size: 11.5px; opacity: .7; margin-top: 3px; }
.sb-nav { padding: 12px; display: grid; gap: 2px; }
.sb-group { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; opacity: .5; padding: 14px 12px 6px; }
html[lang="km"] .sb-group { letter-spacing: 0; font-size: 12px; }
.sb-nav a, .sb-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--sidebar-ink); text-decoration: none; font-weight: 500; position: relative;
}
.sb-nav a:hover, .sb-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sb-nav a.active { background: rgba(217, 165, 46, .16); color: #fff; }
.sb-nav a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--gold); }
.sb-nav a.active .ic { color: var(--gold); }
.sb-badge { margin-left: auto; background: var(--gold); color: #2b1f05; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.sb-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.tb-title { font-weight: 700; font-size: 17px; }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--brown); font-weight: 700; font-size: 13px; flex: none; }
.user-chip small { display: block; color: var(--muted); font-size: 11px; line-height: 1.2; }
.user-chip b { display: block; font-size: 13px; line-height: 1.2; }
.view { padding: 24px; max-width: 1480px; width: 100%; }
.only-mobile { display: none; }
.sb-overlay { display: none; }

/* ---------- page parts ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { margin: 0; font-size: 24px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { position: relative; }
.search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 34px; min-width: 220px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 15px; }
.cols { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: grid; gap: 16px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); font-weight: 500; font-size: 13px; }
.kpi-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.kpi-val { font-size: 28px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12.5px; color: var(--muted); }
.kpi.accent .kpi-ic { background: var(--gold-soft); color: var(--brown); }
:root[data-theme="dark"] .kpi.accent .kpi-ic { color: var(--gold); }
a.kpi { text-decoration: none; color: inherit; }
a.kpi:hover { border-color: var(--gold); }

/* tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line); }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-available, .b-confirmed, .b-clean, .b-inspected { color: var(--s-available); background: var(--s-available-bg); }
.b-occupied, .b-checked_in { color: var(--s-occupied); background: var(--s-occupied-bg); }
.b-reserved, .b-pending { color: var(--s-reserved); background: var(--s-reserved-bg); }
.b-dirty { color: var(--s-dirty); background: var(--s-dirty-bg); }
.b-maintenance, .b-checked_out { color: var(--s-maint); background: var(--s-maint-bg); }
.b-cancelled { color: var(--s-cancel); background: var(--s-cancel-bg); }
.b-plain { color: var(--ink-2); background: var(--surface-2); }
.b-plain::before { display: none; }

/* list rows (arrivals etc.) */
.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-pill { min-width: 46px; text-align: center; padding: 4px 8px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px; }

/* bar chart (single series) */
.chart { position: relative; padding: 14px 18px 10px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; border-bottom: 1px solid var(--line); position: relative; }
.bars .gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); pointer-events: none; }
.bars .gridline span { position: absolute; right: 100%; top: -8px; padding-right: 6px; font-size: 11px; color: var(--muted); }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; cursor: default; }
.bar { width: min(100%, 26px); background: var(--bar); border-radius: 4px 4px 0 0; min-height: 2px; transition: background .15s; }
.bar-col:hover .bar { background: var(--bar-hover); }
.bar-col.is-today .bar { background: var(--gold); }
.bar-labels { display: flex; gap: 6px; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.chart.has-axis { padding-left: 46px; }
.tip {
  position: fixed; z-index: 300; pointer-events: none; background: var(--ink); color: var(--bg); padding: 7px 10px;
  border-radius: 8px; font-size: 12.5px; box-shadow: var(--shadow-lg); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px));
}
.tip b { display: block; }

/* horizontal meter bars */
.hbars { display: grid; gap: 12px; padding: 16px 18px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.hbar-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; background: var(--bar); }
.hbar-row b { font-variant-numeric: tabular-nums; }

/* status summary */
.status-strip { display: flex; height: 12px; border-radius: 999px; overflow: hidden; gap: 2px; margin: 16px 18px 6px; }
.status-strip span { display: block; height: 100%; }
.status-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; padding: 10px 18px 16px; }
.status-legend div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.status-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.status-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.c-available { background: var(--s-available); } .c-occupied { background: var(--s-occupied); }
.c-reserved { background: var(--s-reserved); } .c-dirty { background: var(--s-dirty); } .c-maintenance { background: var(--s-maint); }

/* ---------- room board ---------- */
.legend-row { display: flex; flex-wrap: wrap; gap: 8px; }
.floor { margin-bottom: 22px; }
.floor h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 10px; }
html[lang="km"] .floor h3 { letter-spacing: 0; font-size: 14px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.room-tile {
  text-align: left; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; box-shadow: var(--shadow);
  transition: transform .12s, border-color .15s;
}
.room-tile:hover { transform: translateY(-2px); border-color: var(--ink-2); }
.room-tile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.room-tile.st-available::before { background: var(--s-available); }
.room-tile.st-occupied::before { background: var(--s-occupied); }
.room-tile.st-reserved::before { background: var(--s-reserved); }
.room-tile.st-dirty::before { background: var(--s-dirty); }
.room-tile.st-maintenance::before { background: var(--s-maint); }
.rt-top { display: flex; justify-content: space-between; align-items: center; }
.rt-num { font-size: 22px; font-weight: 700; }
.rt-type { font-size: 12.5px; color: var(--muted); }
.rt-guest { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; min-height: 20px; }
.rt-guest span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- calendar ---------- */
.cal { overflow-x: auto; }
.cal-grid { min-width: 900px; }
.cal-row { display: grid; grid-template-columns: 130px repeat(var(--days), minmax(52px, 1fr)); position: relative; }
.cal-row + .cal-row { border-top: 1px solid var(--line); }
.cal-head { position: sticky; top: 0; background: var(--surface-2); z-index: 2; }
.cal-head > div { padding: 8px 4px; text-align: center; font-size: 12px; color: var(--muted); border-left: 1px solid var(--line); }
.cal-head > div b { display: block; font-size: 15px; color: var(--ink); }
.cal-head .is-today { background: var(--gold-soft); }
.cal-head .is-today b { color: var(--brown); }
:root[data-theme="dark"] .cal-head .is-today b { color: var(--gold); }
.cal-head .is-weekend b { color: var(--primary); }
.cal-room { padding: 8px 12px; grid-row: 1; grid-column: 1; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
.cal-room b { font-size: 14px; }
.cal-room small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-cell { grid-row: 1; height: 48px; border-left: 1px solid var(--line); cursor: pointer; }
.cal-cell:hover { background: var(--primary-soft); }
.cal-cell.is-today { background: color-mix(in srgb, var(--gold-soft) 60%, transparent); }
.cal-cell.ooo { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, transparent 6px, transparent 12px); cursor: not-allowed; }
.cal-bar {
  grid-row: 1; align-self: center; height: 34px; margin: 0 3px; border-radius: 8px; padding: 0 9px; z-index: 1;
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; cursor: pointer; overflow: hidden; white-space: nowrap;
  border: 1px solid transparent; transition: filter .15s;
}
.cal-bar:hover { filter: brightness(.95); }
.cal-bar span { overflow: hidden; text-overflow: ellipsis; }
.cal-bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.cal-bar.b-confirmed { background: var(--s-available-bg); color: var(--s-available); border-color: color-mix(in srgb, var(--s-available) 35%, transparent); }
.cal-bar.b-checked_in { background: var(--s-occupied-bg); color: var(--s-occupied); border-color: color-mix(in srgb, var(--s-occupied) 35%, transparent); }
.cal-bar.b-pending { background: var(--s-reserved-bg); color: var(--s-reserved); border-color: color-mix(in srgb, var(--s-reserved) 45%, transparent); border-style: dashed; }
.cal-bar.b-checked_out { background: var(--s-maint-bg); color: var(--s-maint); }
.cal-bar::before { display: none; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- modal & drawer ---------- */
.ov { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.ov-bg { position: absolute; inset: 0; background: rgba(5, 15, 6, .5); backdrop-filter: blur(3px); animation: fade .15s; }
.modal { position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2, .8, .2, 1); }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.ov.drawer { place-items: stretch end; padding: 0; }
.drawer-panel { position: relative; width: min(620px, 100vw); height: 100vh; background: var(--bg); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .22s cubic-bezier(.2, .8, .2, 1); }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 18px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; display: grid; gap: 16px; align-content: start; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding: 16px 18px; }
.kv div small { display: block; font-size: 12px; color: var(--muted); }
.kv div b { font-weight: 600; }
.folio td, .folio th { padding: 8px 18px; }
.folio .total td { font-size: 16px; }
.folio .balance td { color: var(--danger); }
.folio .balance.zero td { color: var(--s-available); }
.inline-form { display: grid; gap: 10px; padding: 14px 18px; border-top: 1px dashed var(--line); background: var(--surface-2); }
.inline-form .row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: end; }
.inline-form .row.pay { grid-template-columns: 1fr 1fr 1.4fr auto; }

.guest-switch { display: flex; gap: 6px; margin-bottom: 4px; }
.calc-box { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--gold-soft); gap: 10px; flex-wrap: wrap; }
.calc-box b { font-size: 20px; }

.photo-prev { width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: var(--surface-2) center / cover no-repeat; border: 1px solid var(--line); }
.amen-picks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.thumb { width: 64px; height: 44px; border-radius: 8px; background: var(--surface-2) center / cover no-repeat; }

.msg { padding: 16px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.msg:last-child { border-bottom: 0; }
.msg.unread { background: color-mix(in srgb, var(--gold-soft) 45%, transparent); }
.msg-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.msg p { margin: 0; white-space: pre-wrap; }

.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.setting-row:last-child { border-bottom: 0; }
.setting-row p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- food & drink orders (POS) ---------- */
.text-danger { color: var(--danger) !important; }
.text-warn { color: var(--s-reserved) !important; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pos-item {
  display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 12px; min-height: 128px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; box-shadow: var(--shadow);
  transition: transform .1s, border-color .15s;
}
.pos-item:hover:not([disabled]) { border-color: var(--primary); transform: translateY(-2px); }
.pos-item:active:not([disabled]) { transform: scale(.98); }
.pos-item.is-out { opacity: .5; cursor: not-allowed; }
.pos-name { font-weight: 600; font-size: 14px; line-height: 1.35; flex: 1; }
.pos-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.pos-foot b { font-size: 15px; }
.pos-foot small { font-size: 11.5px; color: var(--muted); }
.pos-ic { width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; flex: none; }
.pc-food { background: var(--s-dirty-bg); color: var(--s-dirty); }
.pc-drink { background: var(--s-occupied-bg); color: var(--s-occupied); }
.pc-snack { background: var(--s-reserved-bg); color: var(--s-reserved); }
.pc-service { background: var(--primary-soft); color: var(--primary); }
.pc-facility { background: color-mix(in srgb, #0891b2 14%, var(--surface)); color: #0e7490; }
:root[data-theme="dark"] .pc-facility { color: #5fd3ea; }
.cust-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.stat-chip { display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; }
.stat-chip small { display: block; font-size: 12px; color: var(--muted); }
.stat-chip b { font-size: 20px; line-height: 1.1; }
.pos-cart { position: sticky; top: 72px; display: flex; flex-direction: column; max-height: calc(100vh - 90px); }
.pos-target { padding: 12px 16px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.pos-target .seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.cart-lines { flex: 1; overflow-y: auto; min-height: 120px; }
.cart-line { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.cart-line .grow { flex: 1; min-width: 0; }
.cart-line .cell-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qty { display: flex; align-items: center; gap: 2px; background: var(--surface-2); border-radius: 10px; }
.qty .icon-btn { width: 30px; height: 30px; }
.qty b { min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.pos-sum { padding: 14px 16px; display: grid; gap: 8px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.pos-total { display: flex; justify-content: space-between; align-items: baseline; }
.pos-total b { font-size: 26px; }

/* ---------- inventory ---------- */
.lvl { height: 5px; border-radius: 999px; background: var(--surface-2); margin-top: 5px; overflow: hidden; max-width: 160px; }
.lvl-fill { height: 100%; border-radius: 999px; }
.lvl-ok { background: var(--s-available); }
.lvl-low { background: var(--s-reserved); }
.lvl-out { background: var(--danger); }
tr.inactive td { opacity: .5; }
.recipe-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 36px; gap: 8px; align-items: center; }

@media (max-width: 1100px) {
  .pos { grid-template-columns: minmax(0, 1fr); }
  .pos-cart { position: static; max-height: none; }
}

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 400; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); animation: pop .2s; max-width: 380px; }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .cols-3-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: 260px; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; }
  .sb-overlay.open { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .4); }
  .only-mobile { display: inline-grid; }
  .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px; }
  .login-art img { width: 160px; border-radius: 18px; }
}
@media (max-width: 640px) {
  .view { padding: 16px; }
  .topbar { padding: 8px 12px; }
  .user-chip > div { display: none; }
  .user-chip { padding: 3px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .search input { min-width: 0; width: 100%; }
  .search { flex: 1; }
  .kv { grid-template-columns: 1fr; }
  .inline-form .row, .inline-form .row.pay { grid-template-columns: 1fr 1fr; }
  .tb-title { font-size: 15px; }
  .kpi-val { font-size: 24px; }
}

@media print {
  .sidebar, .topbar, .toolbar, .btn { display: none !important; }
  .app { display: block; }
}

/* login captcha */
.captcha-row { display: flex; gap: 8px; align-items: center; }
.captcha-row img { border-radius: 10px; background: #f4f1e6; }
.captcha input { text-transform: uppercase; letter-spacing: .2em; }

/* row selection in inventory tables */
.tbl .sel-col { width: 40px; padding-right: 0; cursor: pointer; }
.tbl .sel-col input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--green, #1d8a27); }

/* stock adjustment */
.adj-tbl .adj-input { max-width: 130px; padding: 6px 10px; font-variant-numeric: tabular-nums; }
.adj-up { color: var(--s-available); }
.adj-down { color: var(--danger); }
.adj-bar { position: sticky; bottom: 12px; margin-top: 12px; padding: 12px 16px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; z-index: 5; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.adj-settings .seg { align-self: start; }

/* foreign guests (immigration) */
.notice { display: flex; gap: 10px; align-items: center; padding: 12px 16px; margin-bottom: 16px; background: var(--gold-soft); color: var(--ink-2); flex-wrap: wrap; }
.notice > span { flex: 1; min-width: 220px; }
.form-sub { margin: 10px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3, var(--ink-2)); }

/* installable app */
.install-btn { margin-top: 10px; }
.install-link { width: 100%; border: 0; background: transparent; font: inherit; cursor: pointer; text-align: left; }
.install-steps ol { margin: 8px 0 14px 20px; padding: 0; display: grid; gap: 6px; }
.offline-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 200; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px);
  padding: 10px 14px; border-radius: 12px; background: var(--danger); color: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.25); font-size: 14px; }
.ov[hidden], .offline-bar[hidden] { display: none !important; }
/* installed app on phones: keep clear of the notch and home bar */
@media (display-mode: standalone) {
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
  .view { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}
/* stock adjustment on phones: keep item, on hand, the box to type in, and the difference */
@media (max-width: 640px) {
  .adj-tbl th:nth-child(2), .adj-tbl td:nth-child(2), .adj-tbl th:nth-child(6), .adj-tbl td:nth-child(6) { display: none; }
  .adj-tbl td:first-child { min-width: 0 !important; }
  .adj-tbl td:nth-child(4) { min-width: 0 !important; }
  .adj-tbl .adj-input { max-width: 90px; }
}
/* the category tabs on Food & drink scroll sideways on small screens instead of widening the page */
.pos .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.pos .seg button { white-space: nowrap; flex: none; }
/* on narrow screens a wide chart scrolls inside its card instead of widening the page */
.chart { overflow-x: auto; }
/* phones: long page titles in the top bar shorten instead of pushing the buttons off screen */
.tb-title { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-actions { flex: none; }
/* phones: list rows (e.g. bookings to confirm) wrap their buttons onto a second line */
@media (max-width: 640px) {
  .list-row { flex-wrap: wrap; padding: 10px 14px; }
  .list-row .grow { flex: 1 1 140px; }
}

/* passport / ID scan in the new reservation form */
.scan-row { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-2); }
.scan-row .scan-status { flex: 1 1 220px; font-size: 13px; line-height: 1.45; }
.text-ok { color: var(--s-available); }
.field .scanned { border-color: var(--s-available) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-available) 18%, transparent); }
.field .scan-check { border-color: var(--s-reserved) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-reserved) 22%, transparent); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* payment methods & QR */
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.pm-card { display: flex; gap: 14px; align-items: center; padding: 14px; cursor: pointer; }
.pm-card.inactive { opacity: .6; }
.pm-qr { width: 92px; height: 92px; flex: none; border-radius: 12px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; text-align: center; font-size: 12px; overflow: hidden; }
.pm-qr img { width: 100%; height: 100%; object-fit: contain; }
.pm-info { flex: 1; min-width: 0; }
.pm-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; color: var(--muted); }
.pm-upload { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.pm-upload .pm-qr { width: 140px; height: 140px; }
.show-qr { margin-top: 8px; }
.qr-screen { position: fixed; inset: 0; z-index: 300; background: rgba(10, 30, 12, .82); display: grid; place-items: center; padding: 16px; }
.qr-card { background: #fff; color: #111; border-radius: 22px; padding: 24px 22px 18px; width: min(420px, 100%); max-height: 100%; overflow: auto; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.qr-hotel { font-weight: 700; font-size: 18px; }
.qr-method { color: #5b665c; margin-top: 2px; }
.qr-img { width: min(320px, 80vw); height: min(320px, 80vw); object-fit: contain; margin: 14px auto 6px; display: block; image-rendering: pixelated; }
.qr-amount { font-size: 34px; font-weight: 800; letter-spacing: -.01em; }
.qr-riel { color: #5b665c; }
.qr-acct { margin-top: 10px; font-size: 14px; }
.qr-help { margin-top: 10px; color: #5b665c; font-size: 14px; }
.qr-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.qr-actions .btn { min-width: 140px; }

/* online payment of website bookings */
.op-card { margin-bottom: 14px; border-color: var(--gold, #d8a531); }
.op-proof { max-width: 160px; max-height: 220px; border-radius: 10px; border: 1px solid var(--line); display: block; margin-top: 4px; }
.op-actions { padding: 0 18px 16px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.op-actions p { flex-basis: 100%; margin: 0 0 4px; }

/* reports: revenue filter */
.rep-filter { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.hbar-row.clickable { cursor: pointer; border-radius: 8px; }
.hbar-row.clickable:hover { background: var(--surface-2); }
.hbar-row.is-active { background: var(--gold-soft); outline: 1px solid var(--gold, #d8a531); }
