:root {
  /* Brand: the bronze "NM" badge. Bronze accents on warm ivory, espresso header. */
  --brand: #6f5732;
  --brand-dark: #4e3d22;
  --brand-soft: #f3ebdd;
  --gold: #b39a66;
  --header: #221d18;
  --header-ink: #f3ead9;
  --header-muted: #cbbfa8;
  --ink: #2a241d;
  --muted: #75695b;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --line: #e6dccb;
  --bg: #f8f5ef;
  --card: #fff;
  --error: #b3261e;
  --error-soft: #fdecea;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --new: #fbf1dc;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg);
}
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .5px; }
.small { font-size: 12.5px; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; background: #f1eadf; padding: 1px 4px; border-radius: 4px; }

.btn {
  appearance: none; border: 1px solid transparent; border-radius: 10px; padding: 9px 14px;
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn.primary { background: linear-gradient(180deg, #82673b 0%, var(--brand) 100%); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(42, 36, 29, .2); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--gold); }
.btn.danger { background: var(--card); border-color: #e7b3ae; color: var(--error); }
.btn.danger:hover { background: var(--error-soft); }
.btn.small { padding: 6px 10px; font-size: 13.5px; }
.btn.block { display: block; width: 100%; margin-top: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.error { color: var(--error); background: var(--error-soft); padding: 9px 12px; border-radius: 8px; margin: 10px 0 0; }
.error.banner { margin: 0 0 12px; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.login-card h1 { margin: 0; font-family: var(--serif); color: var(--brand-dark); }
.login-logo { display: block; width: 72px; height: 72px; border-radius: 50%; margin-bottom: 12px; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.topbar .brand { display: inline-flex; align-items: center; gap: 10px; }
.topbar .brand .logo { width: 40px; height: 40px; border-radius: 50%; flex: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.login-card label { display: block; font-weight: 600; margin: 18px 0 6px; }
.login-card input { width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; }
.login-card input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }

/* layout */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 22px; background: var(--header); color: var(--header-ink); border-bottom: 2px solid var(--gold); position: sticky; top: 0; z-index: 5; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 19px; letter-spacing: .4px; }
.brand span { font-weight: 400; color: var(--header-muted); }
.brand b { font-weight: 700; color: inherit; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; color: inherit; }
.brand .brand-text > span:first-child { color: inherit; font-weight: 700; }
.brand .brand-text > span:first-child span { font-weight: 400; color: var(--header-muted); }
.brand .brand-line { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; font-size: 12.5px; letter-spacing: 0; color: var(--header-muted); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.live { font-size: 13px; opacity: .9; }
.who { font-size: 13px; color: var(--header-muted); }
.btn.on-dark { background: transparent; color: var(--header-ink); border-color: rgba(203, 191, 168, .45); text-decoration: none; }
.link-button { font: inherit; background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; }
.live.paused { opacity: .55; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 22px 40px; }

/* Only the register has totals now. */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat strong { font-family: var(--serif); font-size: 30px; line-height: 1.2; color: var(--brand-dark); }

.toolbar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 8px; }

.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: auto; }
table.guests { width: 100%; border-collapse: collapse; }
.guests th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbf8f3; white-space: nowrap; }
.guests td { padding: 11px 14px; border-bottom: 1px solid #f0e9dd; vertical-align: top; }
.guests tbody tr { cursor: pointer; }
.guests tbody tr:hover, .guests tbody tr:focus { background: #faf4ea; outline: none; }
.guests tbody tr.new { background: var(--new); }
.guests tbody tr:last-child td { border-bottom: 0; }
.cell-name { font-weight: 600; }
.guests td.nowrap { white-space: nowrap; }
.guests td.strong { font-weight: 600; }
.cell-sub { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #f1eadf; color: var(--muted); white-space: nowrap; }
.badge.self { background: var(--brand-soft); color: var(--brand-dark); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; margin: 0; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(26, 20, 14, .38); z-index: 10; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--card); z-index: 11; padding: 20px 22px 28px; overflow-y: auto; box-shadow: -8px 0 24px rgba(0, 0, 0, .12); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-head h2 { margin: 0; font-family: var(--serif); font-size: 23px; }
.details { display: grid; grid-template-columns: 120px 1fr; gap: 9px 12px; margin: 18px 0 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; white-space: pre-line; }
.details dd.strong { font-weight: 700; }
.party-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; vertical-align: middle; }
.approval-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; vertical-align: middle; background: #fff3dc; color: #9a5b00; }
.approval-badge.rejected { background: #f1eadf; color: #75695b; }
.members-box { margin-top: 18px; }
.members-box h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.member-list button { width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; }
.member-list button:hover { border-color: var(--brand); }
.member-list button.current { border-color: var(--gold); background: var(--brand-soft); }
.member-list .member-name { display: block; font-weight: 700; }
.member-list .member-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.stay { margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 12px; background: var(--bg); }
.stay .details { margin-top: 10px; }
.stay-head { display: flex; justify-content: space-between; align-items: center; }
.stay-head h3 { margin: 0; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stay-form { display: grid; gap: 10px; margin-top: 12px; }
.stay-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.stay-form input, .stay-form select { font: inherit; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); min-width: 0; }
.stay-form .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stay-form .triple { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stay-form .form-actions { display: flex; gap: 10px; }
.stay-form .invalid { border-color: var(--error); }
.review { color: var(--warn); font-weight: 600; }

.photos { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.photos h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.photo-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.photo { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #221d18; cursor: zoom-in; padding: 0; aspect-ratio: 1.58; }
.photo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.photo span { position: absolute; left: 6px; bottom: 6px; font-size: 11.5px; font-weight: 600; color: #fff; background: rgba(0,0,0,.55); padding: 1px 7px; border-radius: 999px; }
.photo.loading::after { content: "Loading…"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #d9ceb9; font-size: 13px; }
.lightbox { position: fixed; inset: 0; background: rgba(20, 16, 12, .92); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox-bar { position: absolute; top: 14px; right: 14px; display: flex; gap: 8px; }
.record-actions { display: flex; gap: 8px; margin-top: 14px; }
.record-actions .btn { flex: 1; }
#print-frame { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; }

@media (max-width: 720px) {
  .hide-sm { display: none; }
  /* On a phone the header must fold instead of pushing the page sideways. */
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .brand { min-width: 0; }
  .top-actions { flex-wrap: wrap; gap: 8px; margin-left: auto; }
  .who { display: none; }
  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat { padding: 10px; }
  .stat strong { font-size: 22px; }
  main { padding: 14px 12px 32px; }
  .topbar { padding: 10px 14px; }
}

/* An e-check-in: filled in before the guest arrived, waiting for the day they walk in. */
.badge.prebooked { background: #fdf3e0; border-color: var(--gold); color: var(--brand-dark); }
.arrival { background: #fdf6ea; border: 1px solid var(--gold); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.arrival-note { margin: 0 0 10px; }
.arrival-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.arrival-form label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.arrival-form input { font: inherit; color: var(--ink); padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }

/* The guest register, moved here from the admin site: a date range and what it adds up to. */
#register { margin-bottom: 30px; }
#register .page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
#register .page-head h2 { font-family: var(--serif); color: var(--brand-dark); margin: 0; font-size: 24px; }
#register .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.report-form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; margin-bottom: 16px; }
.report-form label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.report-form input { font: inherit; color: var(--ink); padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); min-width: 0; }
.report-form .form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--gold); }
.breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.breakdown { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.breakdown h3 { margin: 0 0 8px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.breakdown div { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 2px 0; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fbf8f3; white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid #f0e9dd; vertical-align: top; font-size: 14px; }
.table td small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
#register .empty { padding: 24px 16px; border: 1px dashed var(--line); border-radius: 12px; }

@media (max-width: 720px) {
  /* On a phone the register is the first thing on screen, so it is kept tight: the range above
     the buttons, and smaller totals, to leave the guest list within reach of a thumb. */
  #register { margin-bottom: 22px; }
  #register .page-head h2 { font-size: 21px; }
  #register .card { padding: 12px; }
  #register .stats { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 6px; }
  #register .stat { padding: 8px 9px; }
  #register .stat .label { font-size: 11.5px; line-height: 1.25; }
  #register .stat strong { font-size: 21px; }
  #register .empty { padding: 14px 12px; font-size: 14px; }
  .report-form { gap: 10px 12px; }
  .report-form label { flex: 1 1 140px; }
  .report-form .form-actions { margin-left: 0; width: 100%; }
  .report-form .form-actions .btn { flex: 1 1 auto; }
}

/* Show/hide the password. The button stays where it is whichever way it is set, so a tap only
   ever changes the eye, never takes it away (the browsers' own one comes and goes). */
.password-field { position: relative; display: block; }
.password-field input { width: 100%; padding-right: 46px; }
.password-field .reveal {
  position: absolute; top: 0; bottom: 0; right: 0; width: 44px; display: flex;
  align-items: center; justify-content: center; padding: 0; margin: 0; border: 0;
  background: none; color: var(--muted); cursor: pointer; border-radius: 0 9px 9px 0;
}
.password-field .reveal:hover { color: var(--ink); }
.password-field .reveal:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.password-field .reveal svg {
  width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.password-field .reveal .eye-off { display: none; }
.password-field .reveal[aria-pressed="true"] .eye { display: none; }
.password-field .reveal[aria-pressed="true"] .eye-off { display: block; }
/* Edge draws its own eye on top of ours. */
.password-field input::-ms-reveal, .password-field input::-ms-clear { display: none; }
