/*
 * Motel Agent styles. Phone-first: everything is sized for a thumb on an
 * iPhone, and simply gets more breathing room on larger screens.
 * Used by both the owner dashboard and the public website.
 */

:root {
  color-scheme: light dark;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --text: #16202b;
  --muted: #55626f;
  --border: #dde2e8;
  --brand: #12344d;
  --on-brand: #ffffff;
  --link: #0b5cab;
  --ok: #17643c;
  --ok-bg: #e2f4e9;
  --warn: #7a4f00;
  --warn-bg: #fcefcf;
  --fail: #a3231c;
  --fail-bg: #fbe5e3;
  --pending: #55626f;
  --pending-bg: #e9edf1;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1318;
    --surface: #18212a;
    --text: #e8edf2;
    --muted: #a0adba;
    --border: #2b3743;
    --brand: #12344d;
    --on-brand: #ffffff;
    --link: #86bdf3;
    --ok: #7bdca6;
    --ok-bg: #143524;
    --warn: #f2c873;
    --warn-bg: #3a2c0c;
    --fail: #ffa39b;
    --fail-bg: #431b1b;
    --pending: #a0adba;
    --pending-bg: #232e39;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a {
  color: var(--link);
}

h1,
h2 {
  margin: 0 0 12px;
  line-height: 1.2;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 12px;
}

/* ---- Top bar (extends under the iPhone status bar when installed) ---- */

.topbar {
  background: var(--brand);
  color: var(--on-brand);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px calc(16px + env(safe-area-inset-right)) 14px calc(16px + env(safe-area-inset-left));
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

/* The motel name links home. The padding makes it a full-height tap target
   without making the bar any taller. */
.topbar a {
  display: block;
  margin: -14px 0;
  padding: 14px 0;
  color: inherit;
  text-decoration: none;
}

/* ---- Page body ---- */

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px calc(16px + env(safe-area-inset-right)) 32px calc(16px + env(safe-area-inset-left));
}

.has-tabbar .container {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 16px;
}

.card > :last-child {
  margin-bottom: 0;
}

.meta {
  color: var(--muted);
  font-size: 0.875rem;
}

.lead {
  color: var(--muted);
  font-size: 1.125rem;
}

.footnote {
  color: var(--muted);
  font-size: 0.9375rem;
  text-align: center;
}

.center {
  text-align: center;
}

/* ---- Status rows ---- */

.rows {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.row {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.row:first-child {
  border-top: 0;
  padding-top: 4px;
}

.row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.row-title {
  font-weight: 600;
}

.row-detail,
.row-fix {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.row-fix {
  color: var(--text);
}

.pill {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.pill-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.pill-fail {
  background: var(--fail-bg);
  color: var(--fail);
}

.pill-pending {
  background: var(--pending-bg);
  color: var(--pending);
}

.banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 600;
}

.banner-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.banner-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.banner-fail {
  background: var(--fail-bg);
  color: var(--fail);
}

/* A banner that lists what to fix, each item a link to the right box. */
.banner > p {
  margin-bottom: 4px;
}

.banner-list {
  margin: 0;
  padding-left: 20px;
  font-weight: 400;
}

.banner-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
}

.steps {
  margin: 0;
  padding-left: 22px;
}

.steps li {
  margin-bottom: 8px;
}

/* ---- Forms and buttons (16px+ text stops iPhones zooming in on focus) ---- */

.form label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.form input[type="password"],
.form input[type="text"],
.form input[type="tel"],
.form input[type="email"] {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 10px;
}

/* Settings fields: label, box, then a hint or an error underneath. */

.field {
  margin-bottom: 16px;
  /* When a link jumps to a field, leave room so its label is not cut off. */
  scroll-margin-top: 16px;
}

.field input {
  scroll-margin-top: 48px;
}

.form .field input {
  margin-bottom: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 12px;
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.field-error {
  margin: 6px 0 0;
  color: var(--fail);
  font-size: 0.9375rem;
  font-weight: 600;
}

.form .field-invalid input,
.form .field-invalid textarea {
  border: 2px solid var(--fail);
}

/* A large box for longer wording, such as the assistant's persona. */

.form textarea {
  display: block;
  width: 100%;
  min-height: 14rem;
  padding: 10px 12px;
  font: inherit;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 10px;
  resize: vertical;
  scroll-margin-top: 48px;
}

.card h3 {
  margin: 24px 0 4px;
  font-size: 1rem;
}

.fixed-list {
  margin: 8px 0 0;
  padding-left: 20px;
}

.fixed-list li {
  margin-bottom: 8px;
}

/* A fold-away section, so starting over takes two deliberate taps. */

.start-over {
  margin-top: 20px;
  border-top: 1px solid var(--border);
}

.start-over summary {
  /* Padding, not a flex box, so the small "open me" arrow stays visible. */
  padding: 12px 0;
  color: var(--muted);
  cursor: pointer;
}

.start-over p {
  margin: 0 0 12px;
}

.button {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--on-brand);
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 10px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.button-secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--muted);
}

.button-quiet {
  color: var(--muted);
  background: transparent;
  border-color: var(--border);
}

.signout {
  margin: 8px 0 16px;
}

:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

/*
 * Present for password managers and screen readers, invisible on screen.
 * "!important" keeps the form-field rules above from giving it a size again
 * (which once made the sign-in page wider than the phone screen).
 */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---- Lists of links (each one a full-width tap target) ---- */

.links {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.links li {
  border-top: 1px solid var(--border);
}

.links li:first-child {
  border-top: 0;
}

.links a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 8px 0;
}

/* ---- Public website: policy text, contact details, footer ---- */

.prose h2 {
  margin-top: 26px;
}

.prose ul {
  margin: 0 0 12px;
  padding-left: 22px;
}

.prose li {
  margin-bottom: 6px;
}

.prose a,
.contact a {
  overflow-wrap: anywhere;
}

.contact {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.prose .contact {
  padding-left: 0;
}

.contact li {
  padding: 10px 0;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.contact li:first-child {
  border-top: 0;
  padding-top: 0;
}

/* Phone and email are the main things a visitor taps, so give them room. */
.contact a {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.contact-label {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* A text message shown as an example. */
.message-sample {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  font-size: 0.9375rem;
}

/* A picture of the paper guest form. */
.form-sample {
  padding: 14px;
  margin-bottom: 12px;
  border: 2px dashed var(--muted);
  border-radius: 10px;
  font-size: 0.9375rem;
}

.form-sample > :last-child {
  margin-bottom: 0;
}

.blank {
  display: inline-block;
  width: 9rem;
  max-width: 55%;
  height: 1.1em;
  border-bottom: 1px solid var(--muted);
  vertical-align: bottom;
}

.checkbox-sample {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  margin-right: 8px;
  border: 2px solid var(--text);
  border-radius: 3px;
  vertical-align: -0.15em;
}

.site-footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 calc(16px + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
  color: var(--muted);
  font-size: 0.9375rem;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 18px;
  margin-bottom: 8px;
}

.footer-links a,
.site-footer p a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* ---- Bottom tab bar ---- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  flex: 1;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border-top: 3px solid transparent;
}

.tab-active {
  color: var(--text);
  border-top-color: var(--link);
}

/* The "Add to Home Screen" tip is pointless once the app is installed. */
@media (display-mode: standalone) {
  .install-hint {
    display: none;
  }
}

/* A tick box with its label: the whole row is the tap target. */

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  font-weight: 600;
  cursor: pointer;
}

.form .check input[type="checkbox"] {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
}

/* A text shown the way a guest would receive it, keeping its line breaks. */

.message-multiline {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.banner-reasons {
  list-style: disc;
  padding-left: 20px;
}

.banner-reasons li {
  margin-top: 6px;
}

/* The guest guide. */

.guide ul {
  margin-top: 4px;
}

.guide-notice {
  margin-top: 20px;
  font-weight: 700;
}

/* The guest form on paper: only the form itself is printed. */

.guest-form .form-sample {
  margin-top: 16px;
}

@media print {
  .topbar,
  .site-footer,
  .tabbar,
  .screen-only {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .form-sample {
    border: 1px solid #000;
    font-size: 1rem;
    line-height: 2;
  }

  .blank {
    width: 16rem;
    border-bottom-color: #000;
  }

  .checkbox-sample {
    border-color: #000;
  }

  .prose a,
  .meta {
    color: #000;
    text-decoration: none;
  }
}

/* Wording to copy into another website: a box of its own, sized to its text. */

.form textarea.paste {
  min-height: 0;
  font-size: 0.9375rem;
  background: var(--bg);
}

/* Drop-down lists and date boxes: as large and as plain as the text boxes. */

.form select,
.form input[type="date"],
.form input[type="time"] {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 10px;
}

/* ---- Grace on the phone ---- */
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.transcript {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.9375rem;
}

details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
