: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; }
[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 { 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); }

/* ------------------------------------------------------------------ layout */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; 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; display: inline-flex; align-items: center; gap: 10px; }
.brand .logo { width: 36px; height: 36px; border-radius: 50%; flex: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.brand-sub { font-weight: 400; color: var(--header-muted); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-line { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; font-weight: 400; font-size: 12.5px; letter-spacing: 0; color: var(--header-muted); }
.brand .logo { width: 40px; height: 40px; }
.login-hotel { font-family: var(--serif); font-size: 19px; font-weight: 700; color: var(--brand); margin: 0 0 2px; }
.login-hotel:empty { display: none; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.btn.on-dark { background: transparent; color: var(--header-ink); border-color: rgba(203, 191, 168, .45); text-decoration: none; }
.btn.on-dark:hover { border-color: var(--gold); }
.who { display: flex; flex-direction: column; line-height: 1.15; text-align: right; font-size: 13px; }
.who span { color: var(--header-muted); text-transform: capitalize; font-size: 12px; }

.shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: calc(100vh - 62px); }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.side button { font: inherit; text-align: left; padding: 10px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; font-weight: 600; border-left: 3px solid transparent; }
.side button:hover { background: var(--brand-soft); }
.side button.current { background: var(--brand-soft); color: var(--brand-dark); border-left-color: var(--gold); }
.content { padding: 24px 28px 40px; max-width: 1200px; width: 100%; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
h1 { font-family: var(--serif); font-size: 28px; margin: 0; color: var(--ink); }
h2 { font-family: var(--serif); font-size: 19px; margin: 0 0 12px; color: var(--brand-dark); }
h2.sub { margin: 26px 0 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 18px; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 14px; padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 13px; display: block; }
.stat strong { font-family: var(--serif); font-size: 30px; line-height: 1.2; color: var(--brand-dark); }
.stat small { display: block; color: var(--muted); font-size: 12.5px; }
.stat.link { cursor: pointer; }
.stat.link:hover { border-color: var(--gold); box-shadow: 0 1px 4px rgba(42, 36, 29, .12); }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 16px; align-items: end; }
.form-grid h2 { grid-column: 1 / -1; }
.form-grid label, .report-form label, .dialog label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form-grid .wide { grid-column: 1 / -1; }
input, select, textarea { font: inherit; color: var(--ink); padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--ink); }
label.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.inline { display: flex; gap: 8px; min-width: 0; }
.inline input { flex: 1; min-width: 0; width: 100%; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-grid .form-actions { grid-column: 1 / -1; }
.form-grid label { min-width: 0; }
.form-note { color: var(--muted); font-size: 13.5px; }
.form-note.ok { color: var(--brand-dark); font-weight: 600; }
.form-note.bad { color: var(--error); }
.hint { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.invalid { border-color: var(--error) !important; }

/* lists */
.list { display: grid; gap: 8px; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; flex-wrap: wrap; }
.item .main { display: flex; flex-direction: column; min-width: 0; }
.item strong { font-size: 15px; }
.item .sub { color: var(--muted); font-size: 13px; }
.item .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; }
.pill.vacant { background: #eef3ea; color: #3f6a35; }
.pill.off { background: #f1eadf; color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

/* QR codes */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.qr-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 8px; }
.qr-card.off { opacity: .65; }
.qr-card img { width: 100%; max-width: 220px; aspect-ratio: 1; justify-self: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.qr-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.qr-card .meta { color: var(--muted); font-size: 13px; }

/* reports */
.report-form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; }
.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-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.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; }
.role-help { margin: 0 0 14px; font-size: 13.5px; }

/* approvals */
.side .count, .tab .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--error); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.tab .count:empty { display: none; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { font: inherit; font-weight: 600; font-size: 14px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.tab.current { background: var(--brand-soft); border-color: var(--gold); color: var(--brand-dark); }
.tab[data-approval-tab="rejected"] .count { background: var(--muted); }
.page-lead { margin: -6px 0 12px; font-size: 14px; }
.approval-list { display: grid; gap: 16px; }
.approval { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 14px; padding: 16px 18px; display: grid; gap: 12px; }
.approval.draft { border-left-color: var(--muted); }
.approval.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: var(--new); } to { background: var(--card); } }
.approval-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.approval-head h2 { margin: 0; font-size: 21px; color: var(--ink); }
.approval-head .sub { color: var(--muted); font-size: 14px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 16px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.notice { margin: 0; padding: 9px 12px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.notice.bad { background: var(--error-soft); color: var(--error); }
.approval .table-wrap { border-radius: 10px; }
.photo-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.photo-strip figure { margin: 0; flex: none; width: 220px; }
.photo-strip img { display: block; width: 100%; aspect-ratio: 1.58; object-fit: contain; background: #222; border-radius: 8px; cursor: zoom-in; }
.photo-strip figcaption { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.decide { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.decide h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.decide-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.decide-row input { width: 130px; }
.reject-box { display: grid; gap: 8px; }
.reject-box textarea { width: 100%; resize: vertical; }
.link-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* dialog */
.dialog { border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; width: min(420px, 92vw); color: var(--ink); }
.dialog::backdrop { background: rgba(26, 20, 14, .45); }
.dialog form { display: grid; gap: 12px; }

/* sign in */
.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 { font-size: 30px; 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); }
.login-card label { display: block; font-weight: 600; margin: 16px 0 6px; }
.login-card input { width: 100%; padding: 11px 12px; }

/* printable poster / table tent: only shown while printing a QR code */
.poster { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  body.printing > *:not(.poster) { display: none !important; }
  body.printing .poster { display: block; color: #221d18; font-family: -apple-system, "Segoe UI", Arial, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .poster-panel { display: flex; flex-direction: column; box-sizing: border-box; }
  .poster-brand { background: #221d18; color: #f3ead9; text-align: center; border-bottom: 1.2mm solid #b39a66; }
  .poster-logo { border-radius: 50%; display: block; margin: 0 auto; }
  .poster-brand h1 { font-family: "Iowan Old Style", Palatino, Georgia, serif; color: #f3ead9; margin: 0; line-height: 1.25; }
  .poster-tagline { color: #cbbfa8; margin: 1.5mm 0 0; }
  .poster-lead { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 700; margin: 0; color: #4e3d22; }
  .poster-lead-hi { font-weight: 700; margin: 0; color: #6f5732; }
  .poster-qr { display: block; border: 0.6mm solid #b39a66; border-radius: 3mm; padding: 2mm; background: #fff; }
  .poster-steps { margin: 0; padding-left: 6mm; line-height: 1.45; }
  .poster-steps span { display: block; color: #75695b; }
  .poster-contact { margin: 0; font-weight: 700; color: #4e3d22; }

  /* A4 poster */
  .poster.layout-poster .poster-panel { width: 210mm; height: 297mm; }
  .poster.layout-poster .poster-brand { padding: 12mm 14mm 9mm; }
  .poster.layout-poster .poster-logo { width: 30mm; height: 30mm; margin-bottom: 5mm; }
  .poster.layout-poster .poster-brand h1 { font-size: 21pt; }
  .poster.layout-poster .poster-tagline { font-size: 15pt; }
  .poster.layout-poster .poster-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6mm; padding: 8mm 16mm 12mm; text-align: center; }
  .poster.layout-poster .poster-lead { font-size: 30pt; }
  .poster.layout-poster .poster-lead-hi { font-size: 20pt; }
  .poster.layout-poster .poster-qr { width: 100mm; height: 100mm; order: -1; }
  .poster.layout-poster .poster-text { display: flex; flex-direction: column; align-items: center; gap: 4mm; }
  .poster.layout-poster .poster-steps { text-align: left; font-size: 12pt; max-width: 160mm; margin-top: 2mm; }
  .poster.layout-poster .poster-contact { font-size: 13pt; margin-top: 2mm; }

  /* Table tent: A4 portrait folded in half, two landscape A5 panels */
  .poster.layout-tent { width: 210mm; height: 297mm; }
  .tent-half { width: 210mm; height: 148mm; overflow: hidden; }
  .tent-half.flipped { transform: rotate(180deg); }
  .tent-fold { height: 1mm; border-top: 0.3mm dashed #b39a66; }
  .poster.layout-tent .poster-panel { width: 210mm; height: 148mm; }
  .poster.layout-tent .poster-brand { display: grid; grid-template-columns: 16mm 1fr; align-items: center; column-gap: 5mm; text-align: left; padding: 5mm 10mm; }
  .poster.layout-tent .poster-logo { width: 16mm; height: 16mm; grid-row: span 2; margin: 0; }
  .poster.layout-tent .poster-brand h1 { font-size: 12.5pt; }
  .poster.layout-tent .poster-tagline { font-size: 10pt; }
  .poster.layout-tent .poster-body { flex: 1; display: flex; align-items: center; gap: 8mm; padding: 5mm 10mm; }
  .poster.layout-tent .poster-qr { width: 70mm; height: 70mm; flex: none; }
  .poster.layout-tent .poster-text { display: flex; flex-direction: column; gap: 2mm; }
  .poster.layout-tent .poster-lead { font-size: 20pt; }
  .poster.layout-tent .poster-lead-hi { font-size: 14pt; }
  .poster.layout-tent .poster-steps { font-size: 8.5pt; margin-top: 1mm; }
  .poster.layout-tent .poster-contact { font-size: 9.5pt; margin-top: 1mm; }
}

@media (max-width: 820px) {
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .who { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  /* The sections wrap onto a second row instead of hiding off the side of a phone screen. */
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; position: sticky; top: 0; }
  .side button { flex: 0 0 auto; padding: 8px 12px; }
  .side button { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .side button.current { border-bottom-color: var(--gold); }
  .content { padding: 16px; }
  h1 { font-size: 24px; }
}

@media (max-width: 640px) {
  /* A staff table is wider than a phone, and its buttons ended up off the side of the screen.
     Each person becomes a card instead, with the buttons under them where they can be reached. */
  .staff-table, .staff-table tbody, .staff-table tr, .staff-table td { display: block; width: 100%; }
  .staff-table thead { display: none; }
  .staff-table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .staff-table tr:last-child { border-bottom: 0; }
  .staff-table td { border: 0; padding: 2px 0; font-size: 14px; }
  .staff-table td:first-child { font-weight: 700; font-size: 16px; }
  .staff-table td select { width: 100%; margin: 6px 0; }
  .staff-table td:last-child { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .staff-table td:last-child .btn { flex: 1 1 auto; }
  .staff-table + .table-wrap, .table-wrap:has(.staff-table) { overflow-x: visible; }
}

@media (max-width: 430px) {
  /* All six sections fit in two rows on the narrowest iPhones. */
  .side { gap: 2px; padding: 6px; }
  .side button { padding: 7px 10px; font-size: 14px; }
  .content { padding: 14px 12px 28px; }
}

/* 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; }
