/* Gwen's Palace — shared styles */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Figtree:wght@400;500;600;700&display=swap');

:root {
  --ink: #17302a;
  --ink-2: #2e4a42;
  --paper: #f2f4f2;
  --card: #ffffff;
  --line: #d6ddd9;
  --line-2: #e7ece9;
  --muted: #5f6e69;
  --brass: #b08d2e;
  --brass-2: #8f7020;
  --danger: #a3262f;
  --danger-bg: #f9e0e2;
  --ok: #1f6e4e;
  --ok-bg: #ddf1e6;
  --warn: #9a6b12;
  --warn-bg: #fbf1dc;
  --info: #1e5a8e;
  --info-bg: #dcebf8;
  --rust: #8a4b1f;
  --rust-bg: #f8e6da;
  --radius: 10px;
  --display: 'Fraunces', Georgia, serif;
  --ui: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 1px 2px rgba(23, 48, 42, 0.06), 0 8px 24px -12px rgba(23, 48, 42, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0 0 0.4em; letter-spacing: -0.01em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0 0 0.8em; }
a { color: var(--ink-2); }
small, .muted { color: var(--muted); }
.muted { font-size: 14px; }
.display { font-family: var(--display); }
.num { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }

/* Top bar */
.topbar {
  background: var(--ink);
  color: #fff;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { font-family: var(--display); font-size: 20px; font-weight: 600; color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.topbar .brand i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--brass); }
.topbar .role { color: rgba(255,255,255,0.7); font-size: 14px; }
.topbar .spacer { flex: 1; }
.topbar button, .topbar .btn { background: rgba(255,255,255,0.12); color: #fff; border: 0; }
.topbar button:hover { background: rgba(255,255,255,0.2); }
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar .brand { font-size: 17px; white-space: nowrap; }
  .topbar .role { display: none; }
  .topbar .btn.sm { padding: 6px 10px; font-size: 13px; min-height: 32px; }
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 96px; }
.wrap.narrow { max-width: 600px; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; font-size: 15px;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  border-radius: 8px; padding: 10px 16px; cursor: pointer; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; min-height: 44px; white-space: nowrap;
}
.btn:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--paper); }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn.ghost:hover { background: rgba(23,48,42,0.06); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #8a1f27; }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.big { min-height: 52px; font-size: 17px; }

/* Forms */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
label .opt { font-weight: 400; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
input, select, textarea {
  font: inherit; width: 100%; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 12px; min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(176,141,46,0.45); outline-offset: 1px; border-color: var(--brass);
}
input[type='checkbox'] { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--ink); }
input[type='file'] { padding: 8px; }
.field { margin-bottom: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; font-size: 15px; }
.err { color: var(--danger); background: var(--danger-bg); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 12px 0; }
.note { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brass); border-radius: 8px; padding: 12px 14px; font-size: 14px; }
@media (max-width: 520px) { .row2, .row3 { grid-template-columns: 1fr; } }

/* Status badges */
.badge { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; line-height: 1.3; white-space: nowrap; }
.badge.pending_payment { background: var(--warn-bg); color: var(--warn); }
.badge.confirmed { background: var(--ok-bg); color: var(--ok); }
.badge.checked_in { background: var(--info-bg); color: var(--info); }
.badge.checked_out { background: var(--rust-bg); color: var(--rust); }
.badge.cancelled { background: #e9ebea; color: #5a5a5a; }
.badge.available { background: var(--ok-bg); color: var(--ok); }
.badge.occupied, .badge.staying { background: var(--info-bg); color: var(--info); }
.badge.dirty { background: var(--rust-bg); color: var(--rust); }
.badge.arriving { background: var(--warn-bg); color: var(--warn); }
.badge.overdue, .badge.out_of_order, .badge.late { background: var(--danger-bg); color: var(--danger); }
.badge.neutral { background: #e9ebea; color: #444; }

/* Key-tag rows: the signature element. Big room number left, details right. */
.rows { display: flex; flex-direction: column; gap: 8px; }
.tag-row {
  display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 12px 14px;
}
.tag-row.clickable { cursor: pointer; }
.tag-row.clickable:hover { border-color: var(--line); background: #fbfcfb; }
.tag {
  font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1;
  color: var(--ink); text-align: center; padding: 10px 0; border-radius: 8px; background: var(--paper);
  letter-spacing: -0.02em;
}
.tag.small { font-size: 22px; padding: 8px 0; }
.tag.none { color: var(--muted); font-size: 14px; font-family: var(--ui); font-weight: 500; }
.tag-row .who { font-weight: 600; font-size: 16px; }
.tag-row .meta { font-size: 14px; color: var(--muted); margin-top: 2px; }
.tag-row .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) {
  .tag-row { grid-template-columns: 64px 1fr; }
  .tag-row .actions { grid-column: 1 / -1; justify-content: stretch; }
  .tag-row .actions .btn { flex: 1; }
  .tag { font-size: 26px; }
}

/* Section headings with counts */
.section { margin: 28px 0 14px; display: flex; align-items: baseline; gap: 10px; }
.section h2 { margin: 0; }
.section .count { font-family: var(--display); color: var(--brass-2); font-size: 20px; font-weight: 600; }
.section .right { margin-left: auto; }
.empty { color: var(--muted); padding: 18px 14px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); font-size: 15px; }

/* Panels & tables */
.panel { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table th { font-weight: 600; color: var(--muted); font-size: 13px; background: #fafbfa; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fbfcfb; }
.table-wrap { overflow-x: auto; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; gap: 0 } .kv dt { margin-top: 8px; font-size: 13px; } }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi { background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 12px 14px; }
.kpi b { display: block; font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1.1; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi.alert b { color: var(--danger); }
.kpi.warn b { color: var(--warn); }

/* Room grid */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.room {
  border-radius: 8px; padding: 8px 6px; text-align: center; cursor: pointer; border: 1px solid var(--line-2); background: #fff;
}
.room .n { font-family: var(--display); font-size: 24px; font-weight: 700; line-height: 1; }
.room .s { font-size: 11px; margin-top: 4px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room.available { border-color: #bfe3cf; }
.room.occupied { background: var(--info-bg); border-color: #b5d3ee; }
.room.overdue { background: var(--danger-bg); border-color: #efb9bd; }
.room.dirty { background: var(--rust-bg); border-color: #efcdb6; }
.room.arriving { background: var(--warn-bg); border-color: #efdca9; }
.room.out_of_order { background: #ececec; color: #777; text-decoration: line-through; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 13px; color: var(--muted); margin: 10px 0; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; border: 1px solid var(--line); }

/* Tabs / nav */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 12px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--brass); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(23,48,42,0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0; }
.modal { background: #fff; width: 100%; max-width: 560px; border-radius: 16px 16px 0 0; padding: 20px 18px 24px; max-height: 92vh; overflow: auto; box-shadow: var(--shadow); }
.modal h2 { margin-bottom: 12px; }
.modal .mactions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
@media (min-width: 640px) { .modal-bg { align-items: center; padding: 20px; } .modal { border-radius: 16px; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 15px; z-index: 100; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.err { background: var(--danger); }

/* Sticky bottom bar for the guest form */
.sticky-total {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--ink); color: #fff; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 14px; z-index: 30;
}
.sticky-total .amt { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1; }
.sticky-total .sub { font-size: 13px; color: rgba(255,255,255,0.75); }
.sticky-total .btn { margin-left: auto; background: var(--brass); border-color: var(--brass); color: #1a1507; }
.sticky-total .btn:hover { background: #c49d36; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink-2); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.price-box { background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; }
.price-box .big { font-family: var(--display); font-size: 34px; font-weight: 600; line-height: 1.1; color: var(--ink); }
.price-box .big em { font-style: normal; color: var(--brass-2); }

.timeline { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--brass); }
.timeline .t { color: var(--muted); font-size: 12px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.toolbar .grow { flex: 1; min-width: 200px; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .chip, .room { transition: background-color 0.12s ease, border-color 0.12s ease; }
}
@media print {
  .topbar, .no-print, .sticky-total { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
}
