:root {
  --navy-deep: #061A40;
  --navy: #0B2F6E;
  --royal: #14418F;
  --gold: #D4AF37;
  --gold-soft: #E8CE73;
  --ecru: #F4EFE6;
  --ecru-card: #FBF8F2;
  --red: #B53A3A;
  --ink: #1A2238;
  --muted: #7A8699;
  --open: #2E7D5B;
  --open-bg: #E7F3EC;
  --amber: #9A6B12;
  --amber-bg: #FBF1DC;
  --line: #E3DCCF;
  --shadow: 0 6px 22px rgba(11, 47, 110, 0.12);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Montserrat', -apple-system, system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
body {
  font-family: var(--sans);
  background: var(--ecru);
  color: var(--ink);
  font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
#app { max-width: 940px; margin: 0 auto; min-height: 100vh; padding-bottom: 40px; }
#app.fade { animation: fadein .25s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* ---------- Header ---------- */
header.topbar {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--ecru); padding: 16px 22px 14px; position: relative;
  box-shadow: 0 2px 14px rgba(14, 35, 66, 0.25);
}
.topbar .crest { font-family: var(--serif); font-size: 12px; letter-spacing: 3px; color: var(--gold-soft); text-transform: uppercase; }
.topbar h1 { font-family: var(--serif); font-weight: 600; font-size: 26px; letter-spacing: .5px; line-height: 1.05; }
.topbar .sub { font-size: 12px; color: #E0CFA6; margin-top: 2px; letter-spacing: .3px; }
.topbar .who { position: absolute; top: 16px; right: 20px; display: flex; gap: 8px; align-items: center; }
.gold-rule { height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

/* trip selector in header */
.tripsel { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tripsel select {
  width: auto; min-width: 180px; background: rgba(255,255,255,.95); border: 1px solid var(--gold-soft);
  color: var(--navy); font-weight: 600; padding: 7px 10px; border-radius: 9px;
}
.chip-btn {
  background: rgba(255,255,255,.10); border: 1px solid rgba(226,200,133,.45); color: var(--gold-soft);
  font-family: var(--sans); font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 9px; cursor: pointer; letter-spacing: .2px;
}
.chip-btn:active { transform: scale(.97); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; padding: 14px 16px 0; }
.tab {
  flex: 1; max-width: 220px; text-align: center; padding: 11px 8px; border-radius: 12px; cursor: pointer;
  background: var(--ecru-card); border: 1px solid var(--line); font-weight: 600; font-size: 14px; color: var(--muted);
}
.tab .ic { font-size: 17px; margin-right: 6px; }
.tab.active { background: linear-gradient(160deg, var(--royal), var(--navy)); color: #fff; border-color: var(--navy); }

main { padding: 14px 16px; }

/* ---------- Buttons ---------- */
.btn { font-family: var(--sans); font-weight: 600; font-size: 13px; border: none; border-radius: 10px; padding: 9px 14px; cursor: pointer; letter-spacing: .2px; }
.btn-gold { background: var(--gold); color: var(--navy-deep); }
.btn-navy { background: var(--navy); color: var(--ecru); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn-red { background: var(--red); color: #fff; }
.btn-block { width: 100%; padding: 12px; font-size: 14px; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }

/* ---------- Cards / forms ---------- */
.section-title { font-family: var(--serif); font-size: 24px; font-weight: 600; margin: 4px 0 12px; }
.card { background: var(--ecru-card); border: 1px solid var(--line); border-radius: 14px; padding: 15px; box-shadow: var(--shadow); margin-bottom: 13px; }
.card h3 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
label.fld { display: block; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; font-family: var(--sans); font-size: 14px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
textarea { resize: vertical; line-height: 1.5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.fldwrap { min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--gold); }
.empty { text-align: center; color: var(--muted); padding: 38px 20px; font-size: 14px; }
.empty .big { font-size: 34px; margin-bottom: 8px; }

/* ---------- People list ---------- */
.plist { display: flex; flex-direction: column; gap: 8px; }
.prow { display: flex; align-items: center; gap: 10px; background: var(--ecru-card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.prow .pdot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.prow .pmain { min-width: 0; flex: 1; }
.prow .pname { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.prow .pmeta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.prow .pacts { display: flex; gap: 6px; flex: 0 0 auto; }
.iconbtn { background: transparent; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); cursor: pointer; padding: 6px 8px; font-size: 14px; }
.iconbtn:active { transform: scale(.95); }
.iconbtn.danger { color: var(--red); border-color: #ecc9c9; }

.tagpill { font-size: 10.5px; font-weight: 600; letter-spacing: .3px; padding: 2px 8px; border-radius: 20px; display: inline-flex; align-items: center; gap: 4px; }
.tagpill.couple { background: #F0E6CF; color: var(--navy); }
.tagpill.stairs { background: var(--amber-bg); color: var(--amber); }
.tagpill.infant { background: var(--open-bg); color: var(--open); }
.tagpill.note { background: #eee9df; color: var(--ink); }

/* ---------- Stats ---------- */
.stats { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 12px; }
.stat { background: var(--ecru-card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px; min-width: 92px; }
.stat b { font-family: var(--serif); font-size: 23px; font-weight: 600; display: block; line-height: 1; }
.stat span { font-size: 11px; color: var(--muted); letter-spacing: .3px; }

/* ---------- Checks panel ---------- */
.checks { background: var(--ecru-card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; margin-bottom: 13px; }
.checkline { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 3px 0; }
.checkline.warn { color: var(--amber); }
.checkline.danger { color: var(--red); }
.checkline.ok { color: var(--open); }
.checkline .ic { flex: 0 0 auto; margin-top: 1px; }

/* ---------- Deck board ---------- */
.deckhead { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--navy); margin: 16px 0 9px; display: flex; align-items: center; gap: 8px; }
.deckhead .gl { flex: 1; height: 1px; background: var(--line); }
.deckgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 11px; }
.cabin {
  background: var(--ecru-card); border: 1px solid var(--line); border-radius: 13px; padding: 11px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 7px; min-height: 104px;
}
.cabin.over { border-color: var(--red); background: #FBEFEF; }
.cabin.drop-hot { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft), var(--shadow); }
.cabin .chd { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.cabin .ccode { font-weight: 600; font-size: 13.5px; }
.cabin .cname { color: var(--muted); font-weight: 400; }
.cabin .ccap { font-size: 11px; color: var(--muted); }
.cabin .ccap.over { color: var(--red); font-weight: 600; }
.cabin .cmeta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.minitag { font-size: 10px; padding: 2px 7px; border-radius: 7px; background: var(--ecru); border: 1px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.minitag.cfg { cursor: pointer; background: #fff; color: var(--navy); border-color: #d9d0bd; font-weight: 600; }
.minitag.crib { background: var(--open-bg); color: var(--open); border-color: #cfe6d6; }
.minitag.con { background: #ece6f6; color: #4a3f86; border-color: #d8cef0; }
.cocc { display: flex; flex-wrap: wrap; gap: 5px; min-height: 26px; }
.cdrop { font-size: 11px; color: var(--muted); padding: 4px 2px; }

/* ---------- Guest chips ---------- */
.gchip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 8px;
  background: #fff; border: 1px solid var(--line); font-size: 12.5px; cursor: grab; user-select: none; max-width: 100%;
}
.gchip .gdot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.gchip .gage { color: var(--muted); font-size: 11px; }
.gchip i { font-size: 12px; color: var(--muted); }
.gchip.dragging { opacity: .4; }

.pool { border: 1px dashed var(--muted); border-radius: 12px; padding: 9px; min-height: 46px; display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; background: #fff; }
.pool.drop-hot { border-color: var(--gold); background: var(--open-bg); }
.poollabel { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 4px 0 5px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin: 4px 0 12px; align-items: center; }
.legend .li { display: inline-flex; align-items: center; gap: 5px; }
.legend .ldot { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- Gate ---------- */
.gate { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px;
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 100%); color: var(--ecru); text-align: center; }
.gate .crest { font-family: var(--serif); letter-spacing: 5px; font-size: 13px; color: var(--gold-soft); text-transform: uppercase; }
.gate h1 { font-family: var(--serif); font-size: 40px; font-weight: 600; margin: 6px 0; }
.gate .tag { font-size: 12px; color: #E0CFA6; letter-spacing: 2px; margin-bottom: 26px; text-transform: uppercase; }
.codebox { width: 100%; max-width: 320px; }
.codebox input { text-align: center; letter-spacing: 5px; font-weight: 600; font-size: 18px; text-transform: uppercase; margin-bottom: 12px; background: rgba(255,255,255,.96); border: none; }
.codeerr { color: #F0C9A0; font-size: 12.5px; min-height: 18px; margin-bottom: 6px; }
.gate-foot { margin-top: 30px; font-size: 11px; letter-spacing: 1.5px; color: #C2AE84; text-transform: uppercase; }
.gate-foot b { color: var(--gold-soft); font-weight: 600; }

/* ---------- Modal sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(14,35,66,.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 18px; }
.sheet { background: var(--ecru); width: 100%; max-width: 440px; border-radius: 18px; padding: 20px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.35); max-height: 88vh; overflow-y: auto; animation: rise .2s ease; }
@keyframes rise { from { transform: translateY(20px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.sheet h2 { font-family: var(--serif); font-size: 23px; font-weight: 600; margin-bottom: 4px; }
.sheet .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--navy-deep); color: var(--ecru); padding: 11px 18px; border-radius: 30px; font-size: 13px; z-index: 80; box-shadow: var(--shadow); animation: rise .2s; }

/* ---------- Print: Guest Room Allocation sheet ---------- */
#printarea { display: none; }
@media print {
  body { background: #fff; }
  #app { display: none; }
  #printarea { display: block; }
  @page { size: A4 portrait; margin: 14mm; }
}
.psheet { color: #000; font-family: var(--sans); }
.psheet .phead { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid var(--navy); padding-bottom: 6px; margin-bottom: 12px; }
.psheet .ptitle { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--navy); }
.psheet .pcrest { font-family: var(--serif); letter-spacing: 3px; font-size: 11px; color: var(--gold); text-transform: uppercase; }
.psheet .pdeck { font-weight: 700; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--navy); margin: 12px 0 4px; border-bottom: 1px solid #ccc; }
.psheet table { width: 100%; border-collapse: collapse; }
.psheet td { padding: 4px 6px; font-size: 12px; vertical-align: top; border-bottom: 1px solid #eee; }
.psheet td.pc { width: 132px; font-weight: 700; color: var(--navy); }
.psheet td.pg { color: #222; }
