/* Reset, typography, form controls, buttons, badges and small utilities shared by the staff app and the public page. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--mist);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.45;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.012em; line-height: 1.15; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-base); font-weight: 600; }
a { color: var(--horizon); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s4) 0; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--horizon); outline-offset: 2px; border-radius: 4px; }
::selection { background: #BFE0D0; }

.num, .tnum { font-variant-numeric: tabular-nums lining-nums; font-feature-settings: 'tnum', 'zero' 0, 'cv11'; }
.display { font-family: var(--font-display); }
.muted { color: var(--ink-3); }
.faint { color: var(--ink-4); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.right { text-align: right; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.stack { display: flex; flex-direction: column; gap: var(--s3); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--s6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s3); }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
@media (max-width: 540px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--paper); color: var(--ink);
  font-weight: 600; font-size: var(--fs-base); line-height: 1; white-space: nowrap;
  transition: background-color .12s, border-color .12s, transform .06s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover:not(:disabled) { background: var(--mist-2); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--canopy); border-color: var(--canopy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--canopy-hover); border-color: var(--canopy-hover); }
.btn-blue { background: var(--horizon); border-color: var(--horizon); color: #fff; }
.btn-blue:hover:not(:disabled) { background: #0753A8; border-color: #0753A8; }
.btn-danger { background: var(--paper); border-color: #E2A89E; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: #9C3322; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover:not(:disabled) { background: var(--mist-2); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: var(--fs-md); border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn[aria-busy='true'] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy='true']::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; border-color: rgba(255,255,255,.9) rgba(255,255,255,.9) rgba(255,255,255,.9) transparent;
  animation: spin .7s linear infinite;
}
.btn:not(.btn-primary):not(.btn-blue):not(.btn-danger-solid)[aria-busy='true']::after { border-color: var(--ink-3) var(--ink-3) var(--ink-3) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Forms ── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: var(--fs-xs); color: var(--ink-3); }
.field .err { font-size: var(--fs-xs); color: var(--danger); font-weight: 500; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); background: #FFFAF9; }

.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  font-size: 16px; /* 16px stops iOS zooming into the field */
  line-height: 1.3;
  transition: border-color .12s, box-shadow .12s;
  -webkit-appearance: none; appearance: none;
}
@media (min-width: 900px) { .input, .select, .textarea { font-size: var(--fs-base); min-height: 40px; } }
.textarea { min-height: 84px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:hover, .select:hover, .textarea:hover { border-color: #9DB2A7; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--horizon); box-shadow: var(--focus); outline: none; }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--mist-2); color: var(--ink-3); }
.input[type='date'], .input[type='time'] { min-width: 0; }
.select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2366796F' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-group { position: relative; display: flex; align-items: stretch; }
.input-group .affix { display: flex; align-items: center; padding: 0 12px; background: var(--mist-2); border: 1px solid var(--line-strong); color: var(--ink-3); font-weight: 600; }
.input-group .affix:first-child { border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); }
.input-group .affix:last-child { border-left: 0; border-radius: 0 var(--r-md) var(--r-md) 0; }
.input-group .input:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group .input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--canopy); flex: none; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 24px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background-color .15s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s var(--ease); }
.switch input:checked + .track { background: var(--canopy); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }
.switch input:disabled + .track { opacity: .5; }

/* Segmented control: a short list of exclusive choices, big enough for a thumb */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--mist-2); border-radius: 12px; max-width: 100%; }
.seg button {
  min-height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-2); font-weight: 600; font-size: var(--fs-sm);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.seg button[aria-pressed='true'] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(21,48,42,.18), 0 0 0 1px var(--line); }
.seg button:disabled { opacity: .45; }
.seg.block { display: flex; width: 100%; }
.seg.block button { flex: 1 1 0; justify-content: center; }

/* Number stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--paper); overflow: hidden; }
.stepper button { width: 38px; height: 40px; border: 0; background: transparent; font-size: 20px; font-weight: 500; color: var(--ink-2); }
.stepper button:hover:not(:disabled) { background: var(--mist-2); }
.stepper button:disabled { opacity: .35; }
.stepper output { min-width: 34px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  background: var(--mist-2); color: var(--ink-2);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.enquiry { background: var(--st-enquiry-bg); color: var(--st-enquiry-ink); }
.badge.tentative { background: var(--st-tentative-bg); color: var(--st-tentative-ink); }
.badge.on_hold { background: var(--st-hold-bg); color: var(--st-hold-ink); }
.badge.confirmed { background: var(--st-confirmed-bg); color: var(--st-confirmed-ink); }
.badge.checked_in { background: var(--st-in-bg); color: var(--st-in-ink); }
.badge.checked_out { background: var(--st-out-bg); color: var(--st-out-ink); }
.badge.cancelled { background: var(--st-cancelled-bg); color: var(--st-cancelled-ink); }
.badge.no_show { background: var(--st-noshow-bg); color: var(--st-noshow-ink); }
.badge.blocked { background: var(--st-blocked-bg); color: var(--st-blocked-ink); }
.badge.paid { background: var(--st-confirmed-bg); color: var(--st-confirmed-ink); }
.badge.partial { background: var(--st-tentative-bg); color: var(--st-tentative-ink); }
.badge.pending { background: var(--st-cancelled-bg); color: var(--st-cancelled-ink); }
.badge.refunded { background: var(--st-enquiry-bg); color: var(--st-enquiry-ink); }
.badge.good { background: var(--st-confirmed-bg); color: var(--st-confirmed-ink); }
.badge.warn { background: var(--st-tentative-bg); color: var(--st-tentative-ink); }
.badge.bad { background: var(--st-cancelled-bg); color: var(--st-cancelled-ink); }
.badge.info { background: var(--st-in-bg); color: var(--st-in-ink); }

/* Property chip: a coloured dot + short name */
.pdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ── Alerts ── */
.notice { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--mist-2); color: var(--ink-2); font-size: var(--fs-sm); }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice.warn { background: var(--warn-bg); color: #5E3E00; }
.notice.bad { background: var(--danger-bg); color: #7C2415; }
.notice.good { background: var(--st-confirmed-bg); color: var(--st-confirmed-ink); }
.notice.info { background: var(--horizon-tint); color: #0A3F7A; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
