:root {
  --brand: #6a5acd; --brand-soft: #efedfb; --ink: #101322; --muted: #667085; --line: #e7e8ee;
  --bg: #f7f8fb; --panel: #fff;
  --available: #0fa971; --occupied: #6a5acd; --reserved: #2f80ed; --cleaning: #e08a00;
  --danger: #c0362c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--bg); display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
#side { background: var(--panel); border-right: 1px solid var(--line); padding: 24px 16px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
.brand { display: flex; gap: 10px; align-items: center; font-size: 18px; margin: 0 4px 28px; }
.logo { background: var(--brand); color: #fff; border-radius: 10px; width: 38px; height: 38px; display: grid; place-items: center; flex: none; }
nav a { display: block; padding: 12px 16px; border-radius: 10px; color: var(--muted); text-decoration: none; margin-bottom: 4px; font-weight: 500; }
nav a:hover { background: var(--brand-soft); }
nav a.on { background: var(--brand); color: #fff; box-shadow: 0 8px 18px #6a5acd55; }
main { padding: 32px; min-width: 0; }
h1 { margin: 0; font-size: 28px; }
h2 { font-size: 17px; margin: 28px 0 12px; }
.sub { color: var(--muted); margin: 4px 0 0; }
header.page { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
button, .button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 9px; padding: 8px 14px; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.danger { color: var(--danger); }
button.small { padding: 4px 10px; font-size: 13px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #6a5acd88; outline-offset: 2px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--panel); border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 4px #1018280f; }
.stat span { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.stat b { font-size: 26px; }
.bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.bar input[type=search] { min-width: 260px; }
.spacer { flex: 1; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--c, #aaa); }
.Available { --c: var(--available); } .Occupied { --c: var(--occupied); } .Reserved { --c: var(--reserved); } .Cleaning { --c: var(--cleaning); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 20px; }
.room { background: var(--panel); border: 1px solid transparent; border-radius: 16px; padding: 18px; box-shadow: 0 2px 10px #10182812; display: flex; flex-direction: column; gap: 8px; }
.room.Occupied { background: var(--brand-soft); border-color: #d8d3f5; }
.room .top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.room .num { font-size: 30px; font-weight: 800; display: flex; justify-content: space-between; align-items: center; }
.room img { width: 100%; height: 130px; object-fit: cover; border-radius: 10px; }
.room .info { border: 1px dashed var(--line); border-radius: 10px; padding: 10px; font-size: 13px; color: var(--muted); }
.tag { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 2px 10px; }
.badge { display: inline-flex; align-items: center; border-radius: 20px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: #f1f2f6; white-space: nowrap; }
.table { background: var(--panel); border-radius: 12px; overflow-x: auto; box-shadow: 0 1px 4px #1018280f; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.num-cell { text-align: right; white-space: nowrap; }
.owed { color: var(--danger); font-weight: 600; }
.void { text-decoration: line-through; opacity: .55; }
.empty { padding: 26px; text-align: center; color: var(--muted); background: var(--panel); border-radius: 12px; }
.panel { background: var(--panel); border-radius: 12px; padding: 20px; margin-bottom: 18px; box-shadow: 0 1px 4px #1018280f; }
.sample { background: #fff4de; border: 1px solid #f0c36d; border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
[hidden] { display: none !important; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
#who { margin-top: 24px; padding: 0 4px; border-top: 1px solid var(--line); }
body.auth { display: block; }
body.auth #side { display: none; }
.auth-box { max-width: 420px; margin: 8vh auto; }
.auth-box .form { grid-template-columns: 1fr; margin-top: 16px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
button.stat { display: block; text-align: left; border: 2px solid transparent; font: inherit; }
button.stat:hover { border-color: var(--brand); }
button.stat.on { border-color: var(--brand); background: var(--brand-soft); }
.stats.money b { color: var(--brand); }
.stats.small { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 8px; margin: 8px 0 0; }
.stats.small .stat { padding: 8px 10px; }
.stats.small b { font-size: 17px; }
.Closed { --c: #8a8f9c; }
.who { display: flex; align-items: center; gap: 8px; }
.who img { width: 44px; height: 32px; object-fit: cover; border-radius: 6px; }
.nowrap { white-space: nowrap; }
tr.total td { font-weight: 700; background: var(--brand-soft); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 18px; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); max-width: 100%; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 8px; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form > * { min-width: 0; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea { width: 100%; }
.form .wide { grid-column: 1 / -1; }
dialog { border: 0; border-radius: 16px; padding: 24px; width: min(520px, 94vw); max-height: 90vh; box-shadow: 0 20px 60px #0004; }
dialog::backdrop { background: #10132277; }
dialog h2 { margin-top: 0; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.error { color: var(--danger); font-weight: 600; margin: 12px 0 0; }
.quote { background: var(--brand-soft); border-radius: 10px; padding: 12px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs figure { margin: 0; text-align: center; }
.thumbs img { width: 90px; height: 70px; object-fit: cover; border-radius: 8px; display: block; margin-bottom: 4px; }
#toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }
.receipt dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; }
.receipt dt { color: var(--muted); } .receipt dd { margin: 0; text-align: right; }
.finder { border: 2px solid var(--brand); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
#results { display: grid; gap: 6px; }
#results:empty { display: none; }
button.result { text-align: left; width: 100%; }
button.result:hover { background: var(--brand-soft); }
.finder.dash { background: var(--panel); margin-bottom: 18px; }
.finder.dash input { width: 100%; }
div.result { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.returning { background: var(--brand-soft); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; justify-items: start; }
.matches { display: grid; gap: 6px; max-height: 170px; overflow-y: auto; }
.matches:empty { display: none; }
button.numlink { border: 0; background: none; padding: 0; font: inherit; color: inherit; }
.inout button { flex: 1; font-weight: 700; padding: 9px; }
button.out { background: var(--ink); border-color: var(--ink); color: #fff; }
.stats.methods-total { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
/* Fingers need bigger targets than a mouse. */
@media (pointer: coarse) {
  button, .button, button.small, input, select { min-height: 42px; }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 20px; height: 20px; }
}
/* Small computer and tablet held sideways */
@media (max-width: 1150px) {
  body { grid-template-columns: 200px minmax(0, 1fr); }
  main { padding: 22px 18px; }
  th, td { padding: 9px 8px; }
}
/* Tablet held upright and phone: the menu moves to the top */
@media (max-width: 900px) {
  body { grid-template-columns: minmax(0, 1fr); align-content: start; }
  #side { position: static; height: auto; overflow: visible; padding: 12px; min-width: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin-bottom: 10px; }
  nav { display: flex; flex-wrap: wrap; gap: 4px; }
  nav a { padding: 9px 13px; margin: 0; white-space: nowrap; background: var(--bg); }
  #who { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
  #who p { margin: 8px 0 0; }
  main { padding: 18px 14px; }
}
/* Phone */
@media (max-width: 640px) {
  h1 { font-size: 23px; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 11px 12px; min-width: 0; }
  .stat b { font-size: 20px; overflow-wrap: anywhere; }
  .bar input[type=search] { min-width: 0; width: 100%; }
  input, select, textarea { font-size: 16px; }
  dialog { width: 94vw; max-height: 88dvh; padding: 14px; }
  .table { background: none; box-shadow: none; overflow: visible; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { background: var(--panel); border-radius: 12px; box-shadow: 0 1px 4px #10182818; margin-bottom: 10px; padding: 4px 0; }
  td, .num-cell { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; white-space: normal; border: 0; padding: 6px 12px; }
  td::before { content: attr(data-label); font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); text-align: left; }
  td:empty { display: none; }
  td .actions { justify-content: flex-end; }
  .nowrap br { display: none; }
}
/* Windows with lists need more room than forms. */
dialog:has(table) { width: min(880px, 94vw); }
/* The registration window: small, two fields per row on every screen. */
dialog:has(.compact) { padding: 16px; }
dialog:has(.compact) h2 { font-size: 16px; margin-bottom: 10px; }
.form.compact, .compact .form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.compact label { font-size: 12px; gap: 2px; }
.compact input, .compact select { padding: 6px 8px; min-height: 36px; }
.compact .finder { border-width: 1px; padding: 8px; gap: 6px; }
.compact #results { max-height: 160px; overflow-y: auto; }
.compact .quote { padding: 8px 10px; font-size: 13px; }
dialog:has(.compact) .dialog-foot { position: sticky; bottom: -16px; background: #fff; margin: 10px 0 -16px; padding: 10px 0 16px; }
@media (max-width: 340px) { .form.compact, .compact .form { grid-template-columns: minmax(0, 1fr); } }
button.namelink { border: 0; background: none; padding: 0; min-height: 0; font: inherit; font-weight: 700; color: var(--brand); text-align: left; text-decoration: underline; }
h2.first { margin-top: 0; }
/* Today's money, always on one row */
.moneyline { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; }
.moneyline .stat { padding: 10px; flex: 1 0 auto; white-space: nowrap; }
.moneyline .stat b { font-size: 19px; white-space: nowrap; }
.moneyline .stat.sum { background: var(--brand); color: #fff; flex: 0 0 auto; }
.moneyline .stat.sum span { color: #fff; }
/* Small room totals and room cards */
.stats.rooms-line { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.rooms-line .stat { padding: 8px 10px; min-width: 0; }
.rooms-line .stat b { font-size: 18px; }
.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.room { padding: 10px; gap: 4px; border-radius: 12px; }
.room .num { font-size: 20px; gap: 4px; flex-wrap: wrap; }
.room .top { font-size: 11px; }
.room .tag { padding: 1px 7px; }
.room .badge { font-size: 11px; padding: 1px 7px; }
.room img { height: 70px; }
.room .info { padding: 5px 7px; font-size: 12px; }
.room .inout button { padding: 4px; font-size: 13px; }
@media (max-width: 640px) {
  .moneyline { gap: 4px; }
  .moneyline .stat { padding: 7px 5px; }
  .moneyline .stat span { font-size: 9px; }
  .rooms-line .stat span { font-size: 9px; overflow-wrap: anywhere; }
  .moneyline .stat b { font-size: 13px; }
  .rooms-line .stat { padding: 6px 5px; }
}
/* ID photo: small until pressed */
img.id-photo { display: block; width: 90px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; align-self: flex-start; }
img.id-photo.big { width: 100%; height: auto; max-height: 70vh; object-fit: contain; cursor: zoom-out; }
/* Compact search at the top of the dashboard */
.finder.dash { border: 0; background: none; padding: 0; margin-bottom: 12px; gap: 6px; max-width: 280px; }
.finder.dash input { width: 100%; padding: 4px 9px; min-height: 30px; font-size: 13px; border-radius: 6px; }
.finder.dash input:focus-visible { outline: 0; border-color: var(--brand); }
.finder.dash input::-webkit-search-cancel-button { -webkit-appearance: none; }
.finder.dash div.result { padding: 6px 9px; }
@media (pointer: coarse) { .finder.dash input { min-height: 34px; font-size: 16px; } }
/* A smaller registration window */
dialog:has(.compact) { width: min(400px, 92vw); padding: 12px; }
dialog:has(.compact) h2 { font-size: 14px; margin-bottom: 8px; }
.form.compact, .compact .form { gap: 6px; }
.compact label { font-size: 11px; gap: 1px; }
.compact input, .compact select { padding: 3px 7px; min-height: 30px; font-size: 13px; border-radius: 6px; }
.compact input[type=file] { font-size: 11px; }
.compact .quote { padding: 6px 10px; font-size: 12px; }
.quote .line { display: flex; justify-content: space-between; gap: 10px; }
.quote .grand-total { border-top: 1px solid #c9c2f0; margin-top: 3px; padding-top: 3px; font-size: 15px; font-weight: 700; color: var(--brand); }
dialog:has(.compact) .dialog-foot { bottom: -12px; margin: 8px 0 -12px; padding: 8px 0 12px; }
dialog:has(.compact) .dialog-foot button { padding: 4px 14px; min-height: 32px; font-size: 13px; }
@media (pointer: coarse) { .compact input, .compact select { min-height: 34px; font-size: 16px; } }
/* Language and night mode, top right */
.topbar { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 10px; }
.topbar button { padding: 4px 12px; font-size: 13px; }
.debt { display: flex; justify-content: space-between; align-items: center; background: var(--brand-soft); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.debt b { font-size: 20px; color: var(--danger); }
/* With the menu on top, the two buttons share the first line with the hotel name */
@media (max-width: 900px) {
  .topbar { position: absolute; top: 14px; right: 12px; margin: 0; }
  .brand { padding-right: 250px; min-height: 38px; }
}
@media (max-width: 640px) {
  .brand { padding-right: 140px; font-size: 15px; }
}
.topbar { align-items: center; }
.topbar button.theme { font-size: 17px; line-height: 1; min-width: 40px; }
.me { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; max-width: 520px; margin-bottom: 14px; padding: 12px 18px; border-radius: 14px; border: 2px solid var(--brand); outline: 1px solid var(--brand); outline-offset: 3px; background: linear-gradient(120deg, #4b3bb5, #7d6be6); color: #fff; }
.me b { display: block; font: 700 22px/1.25 Georgia, "Times New Roman", serif; letter-spacing: .5px; }
.me small { display: block; font-size: 12px; opacity: .88; }
.me .when { text-align: right; }
.me .when b { font-family: Consolas, "Courier New", monospace; font-size: 24px; }
/* The name frame follows day and night */
.me { background: linear-gradient(120deg, #fff4d6, #ebe7ff); color: #241c63; }
html.dark .me { background: linear-gradient(120deg, #0b0d1c, #2a2366); color: #eceaff; border-color: #6c5fd0; outline-color: #3d3588; }
.sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
button.section { text-align: left; padding: 9px 12px; border: 2px solid transparent; box-shadow: 0 1px 4px #1018280f; }
button.section b { display: block; }
button.section small { color: var(--muted); }
button.section:hover, button.section.on { border-color: var(--brand); }
button.section.on { background: var(--brand-soft); }
.inside { background: var(--panel); border-radius: 12px; padding: 14px; margin-top: 10px; }
.inside h3 { margin: 0 0 8px; font-size: 15px; }
.figures { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 4px 10px; font-size: 13px; font-weight: 600; }
.pw { position: relative; display: block; }
.pw input { width: 100%; padding-right: 42px !important; }
button.eye { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 36px; height: 30px; min-height: 0; padding: 0; border: 0; background: none; color: var(--muted); }
button.eye[aria-pressed=true] { color: var(--brand); }
button.eye .slash { display: none; }
button.eye[aria-pressed=true] .slash { display: block; }
@media print { .me, html.dark .me { background: none; color: #000; } }
/* The whole registration window in one view */
#newguest { display: contents; }
.compact .half { grid-column: span 2; }
dialog:has(.compact) { max-height: 96vh; }
@media (min-width: 700px) {
  dialog:has(.compact) { width: min(680px, 94vw); }
  .form.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 340px) { .compact .half { grid-column: auto; } }
/* Night mode */
html.dark { --ink: #e9eaf3; --muted: #a2a8bd; --line: #323649; --bg: #11131a; --panel: #1b1e2a; --brand: #8b7cf0; --brand-soft: #2b2852; --danger: #ff8078; color-scheme: dark; }
html.dark input, html.dark select, html.dark textarea { background: #141722; color: var(--ink); }
html.dark dialog { background: var(--panel); color: var(--ink); }
html.dark dialog:has(.compact) .dialog-foot { background: var(--panel); }
html.dark .badge { background: #2a2e3f; }
html.dark .sample { background: #3a2f16; border-color: #80662a; }
html.dark .room.Occupied { border-color: #4a4488; }
html.dark button.out { background: #454b66; border-color: #454b66; color: #fff; }
html.dark .chip.on, html.dark #toast { background: #e9eaf3; color: #11131a; }
html.dark button.primary, html.dark nav a.on, html.dark .moneyline .stat.sum { color: #fff; }
@media print {
  html.dark { --ink: #101322; --muted: #667085; --line: #e7e8ee; --bg: #fff; --panel: #fff; --brand-soft: #efedfb; color-scheme: light; }
  .topbar { display: none !important; }
}
@media print {
  body { display: block; background: #fff; }
  #side, #toast, .bar, .actions, .dialog-foot, header button { display: none !important; }
  body.printing-receipt > main { display: none; }
  dialog[open] { position: static; box-shadow: none; max-height: none; }
  dialog::backdrop { background: none; }
}
