/* ─── RESET & VARIABLES ─────────────────────────────────────── */
:root {
  --sand: #F5EFE0;
  --deep: #1A1209;
  --ocean: #1B4F72;
  --gold: #C9A84C;
  --coral: #E05C3A;
  --mist: #EAF4FB;
  --green: #2E7D53;
  --green-lt: #d4edda;
  --red-lt: #fde8e4;
  --amber-lt: #FFF8E1;
  --border: #D9CEBC;
  --muted: #7A6D5A;
  --shadow: 0 2px 12px rgba(26, 18, 9, .09);
  --shadow-lg: 0 8px 32px rgba(26, 18, 9, .15);
  --r: 10px;
  --r-lg: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--sand);
  color: var(--deep);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--ocean);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ─── TOPBAR ────────────────────────────────────────────────── */
.topbar {
  background: var(--deep);
  color: var(--sand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 2px solid var(--gold);
}

.tb-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tb-logo {
  width: 34px;
  height: 34px;
  background: var(--gold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: var(--deep);
  flex-shrink: 0;
}

.tb-title {
  font-size: 17px;
  font-weight: 700;
}

.tb-sub {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tb-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tb-user {
  font-size: 13px;
  color: rgba(255, 255, 255, .7);
}

/* ─── LAYOUT ────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: calc(100vh - 60px);
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 12px 0;
  overflow-y: auto;
}

.main-content {
  padding: 28px;
  overflow-y: auto;
}

/* ─── SIDEBAR NAV ───────────────────────────────────────────── */
.sb-sec {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 18px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .12s;
}

.nav-item:hover {
  background: var(--sand);
  color: var(--deep);
  text-decoration: none;
}

.nav-item.active {
  background: var(--sand);
  color: var(--ocean);
  border-left-color: var(--ocean);
  font-weight: 600;
}

.nav-ic {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

/* ─── PAGE HEADER ───────────────────────────────────────────── */
.page-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
}

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

/* ─── STATS ROW ─────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  margin: 5px 0 2px;
}

.stat-note {
  font-size: 12px;
  color: var(--muted);
}

.stat-card.accent {
  background: var(--ocean);
  border-color: var(--ocean);
}

.stat-card.accent .stat-label,
.stat-card.accent .stat-note {
  color: rgba(255, 255, 255, .6);
}

.stat-card.accent .stat-value {
  color: #fff;
}

.stat-card.gold {
  background: var(--gold);
  border-color: var(--gold);
}

/* ─── CARDS ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── FORMS ─────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full {
  grid-column: 1 / -1;
}

label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

input[type=text],
input[type=number],
input[type=date],
input[type=datetime-local],
input[type=email],
input[type=password],
input[type=search],
select,
textarea {
  background: var(--sand);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--deep);
  transition: border-color .12s, box-shadow .12s;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ocean);
  box-shadow: 0 0 0 3px rgba(27, 79, 114, .08);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: 11px;
  color: var(--muted);
}

/* ─── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all .13s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--ocean);
  color: #fff;
}

.btn-primary:hover {
  background: #163F5A;
  color: #fff;
}

.btn-gold {
  background: var(--gold);
  color: var(--deep);
}

.btn-gold:hover {
  background: #b8942e;
}

.btn-outline {
  background: transparent;
  color: var(--ocean);
  border: 1.5px solid var(--ocean);
}

.btn-outline:hover {
  background: var(--mist);
}

.btn-outline-white {
  background: transparent;
  color: rgba(255, 255, 255, .85);
  border: 1.5px solid rgba(255, 255, 255, .4);
}

.btn-outline-white:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.btn-danger {
  background: var(--coral);
  color: #fff;
}

.btn-danger:hover {
  background: #c24928;
}

.btn-success {
  background: var(--green);
  color: #fff;
}

.btn-sm {
  padding: 5px 13px;
  font-size: 12px;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  align-items: center;
  flex-wrap: wrap;
}

/* ─── TABLE ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 9px 13px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--sand);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 13px;
  vertical-align: middle;
}

tr {
  border-bottom: 1px solid var(--border);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: #FAFAF7;
}

td code {
  font-size: 11px;
  background: var(--sand);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
}

/* ─── BADGES ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-green {
  background: var(--green-lt);
  color: var(--green);
}

.badge-gold {
  background: #FFF3CD;
  color: #9A6900;
}

.badge-blue {
  background: var(--mist);
  color: var(--ocean);
}

.badge-red {
  background: var(--red-lt);
  color: var(--coral);
}

.badge-gray {
  background: #f0f0f0;
  color: #666;
}

/* ─── ALERTS ────────────────────────────────────────────────── */
.alert {
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

.alert-success {
  background: var(--green-lt);
  border: 1px solid #a3d9b4;
  color: var(--green);
}

.alert-error {
  background: var(--red-lt);
  border: 1px solid #f5b8ae;
  color: var(--coral);
}

.alert-info {
  background: var(--mist);
  border: 1px solid #b8daea;
  color: var(--ocean);
}

.alert-warning {
  background: var(--amber-lt);
  border: 1px solid #FFD54F;
  color: #7A5C00;
}

/* ─── MODAL ─────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 18, 9, .5);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 30px;
  max-width: 640px;
  width: 94%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 3px;
}

.modal-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
}

.modal-close {
  float: right;
  cursor: pointer;
  font-size: 20px;
  color: var(--muted);
  background: none;
  border: none;
}

/* ─── RECEIPT ───────────────────────────────────────────────── */
.receipt {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 22px;
  background: #FAFAF7;
  font-family: 'Courier New', monospace;
  font-size: 12.5px;
}

.receipt-hd {
  text-align: center;
  margin-bottom: 16px;
}

.receipt-hotel {
  font-size: 18px;
  font-weight: 700;
}

.r-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dotted #ccc;
}

.r-line:last-child {
  border: none;
}

.r-line.total {
  font-weight: 700;
  border-top: 2px solid var(--deep) !important;
  margin-top: 6px;
  padding-top: 9px !important;
  font-size: 14px;
}

/* ─── MISC ──────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 14px;
}

.extra-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
  background: var(--sand);
}

.extra-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  display: inline-block;
}

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

code {
  font-family: 'Courier New', monospace;
}

/* ─── LOGIN PAGE ────────────────────────────────────────────── */
body.login-body {
  background: var(--deep);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 42px;
  width: 380px;
  max-width: 96vw;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-badge {
  width: 54px;
  height: 54px;
  background: var(--gold);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--deep);
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 12px;
}

.login-logo p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* ─── ERROR PAGES (404.html, 403.html) ──────────────────────── */
.err-box {
  text-align: center;
}

.err-code {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  color: var(--gold);
  margin-top: 18px;
}

.err-title {
  font-size: 20px;
  font-weight: 700;
  margin-top: 8px;
}

.err-text {
  font-size: 14px;
  color: var(--muted);
  margin: 10px 0 26px;
}

/* ─── ONBOARDING WIZARD ─────────────────────────────────────── */
.onb-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.onb-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}

.onb-step {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

a.onb-step:hover {
  text-decoration: none;
  border-color: var(--ocean);
}

.onb-step.locked {
  opacity: .55;
}

.onb-step.current {
  border-color: var(--gold);
  color: var(--deep);
  box-shadow: var(--shadow);
}

.onb-num {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--sand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.onb-step.done .onb-num {
  background: var(--green);
  color: #fff;
}

.onb-step.current .onb-num {
  background: var(--gold);
  color: var(--deep);
}

.onb-lead {
  color: var(--muted);
  margin: -8px 0 16px;
}

.onb-actions {
  justify-content: flex-end;
}

.onb-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--deep);
  cursor: pointer;
}

.onb-toggle input {
  width: 18px;
  height: 18px;
}

.onb-room-form {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1.2fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.onb-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.onb-summary section {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
}

.onb-summary-hd {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.onb-summary dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  font-size: 13px;
}

.onb-summary dt {
  color: var(--muted);
}

.onb-summary dd {
  word-break: break-all;
}

.onb-missing {
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.form-group.has-error input,
.form-group.has-error select {
  border-color: var(--coral);
  background: var(--red-lt);
}

.form-error {
  font-size: 12px;
  color: var(--coral);
}

@media (max-width: 900px) {
  .onb-steps {
    grid-template-columns: 1fr 1fr;
  }

  .onb-room-form,
  .onb-summary {
    grid-template-columns: 1fr;
  }
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid.cols-3 {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 18px;
  }
}

@media (max-width: 500px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .page-hd {
    flex-direction: column;
  }
}

/* ─── PRINT ──────────────────────────────────────────────────── */
@media print {

  .topbar,
  .sidebar,
  .btn-row,
  .no-print {
    display: none !important;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ─── RECEIPT ────────────────────────────────────────────────── */
.receipt {
  max-width: 380px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  font-size: 13px;
}

.receipt-hd {
  text-align: center;
  margin-bottom: 18px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 14px;
}

.receipt-hotel {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .02em;
}

.r-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid #f0ebe0;
  font-size: 12.5px;
}

.r-line span:first-child {
  color: var(--muted);
}

.r-line span:last-child {
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

.r-line.total {
  font-size: 15px;
  font-weight: 700;
  border-top: 2px solid var(--deep);
  border-bottom: none;
  margin-top: 8px;
  padding-top: 10px;
}

@media print {
  .receipt {
    border: none;
    box-shadow: none;
    max-width: 100%;
  }

  #receipt-qr img {
    display: block !important;
  }
}

/* ─── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 18, 9, .55);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 32px;
  max-width: 520px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
}

.modal-close:hover {
  color: var(--deep);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ─── HAMBURGER ──────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  transition: background .15s;
}

.hamburger:hover {
  background: rgba(255, 255, 255, .1);
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--sand);
  border-radius: 2px;
  transition: all .2s;
}

/* ─── MOBILE DRAWER ──────────────────────────────────────────── */
.mob-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 18, 9, .5);
  z-index: 400;
}

.mob-overlay.open {
  display: block;
}

.mob-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: #fff;
  z-index: 500;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 4px 0 24px rgba(26, 18, 9, .18);
}

.mob-drawer.open {
  transform: translateX(0);
}

.mob-drawer-head {
  background: var(--deep);
  color: var(--sand);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--gold);
  flex-shrink: 0;
  min-height: 62px;
}

.mob-drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.mob-drawer-foot {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.mob-sec {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 18px 4px;
}

.mob-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .12s;
  text-decoration: none;
}

.mob-nav-item:hover {
  background: var(--sand);
  color: var(--deep);
  text-decoration: none;
}

.mob-nav-item.active {
  background: var(--sand);
  color: var(--ocean);
  border-left-color: var(--ocean);
  font-weight: 600;
}

/* ─── RESPONSIVE OVERRIDES ───────────────────────────────────── */
@media (max-width: 900px) {
  .hamburger {
    display: flex;
  }

  .tb-user-desktop {
    display: none;
  }

  .tb-logout-desktop {
    display: none;
  }

  .topbar {
    padding: 0 16px;
  }

  .main-content {
    padding: 16px;
  }
}

@media (min-width: 901px) {
  .hamburger {
    display: none;
  }

  .mob-drawer {
    display: none;
  }

  .mob-overlay {
    display: none !important;
  }
}