/* Lusamara staff console — coastal, calm, built for long data-entry sessions. */

/* Palette sampled directly from the Lusamara logo (brand/lusamara-logo-master.jpg):
   door & wordmark teal #408878, arch cream #f8f0e0, terracotta #e88048,
   bougainvillea coral #ef726c. The accent is a darkened form of the brand teal
   so that text on white clears WCAG AA -- the logo teal itself is too light. */
:root {
  --bg:        #f7f3ec;
  --surface:   #ffffff;
  --surface-2: #fbf8f3;
  --border:    #e6dfd3;
  --border-2:  #d0c7b7;

  --ink:       #23201c;
  --ink-2:     #5d564d;
  --ink-3:     #8d857a;

  --brand-teal: #408878;
  --cream:      #f8f0e0;
  --terracotta: #e88048;
  --coral:      #ef726c;

  --accent:    #35766a;
  --accent-dk: #275a50;
  --accent-lt: #e4f0ec;

  --danger:    #a8332a;
  --danger-lt: #fbeceb;
  --ok:        #2f7a45;
  --ok-lt:     #e9f4ec;
  --warn:      #9a6414;
  --warn-lt:   #fdf2e2;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(35, 32, 28, .06), 0 4px 14px rgba(35, 32, 28, .05);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

/* Class rules like `.modal-backdrop { display: flex }` outrank the UA rule for
   [hidden], so state this explicitly or hidden elements stay on screen. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 620; letter-spacing: -.01em; }

/* ── Login ─────────────────────────────────────────────────────────────── */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 560px at 50% -10%, var(--cream), transparent),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px 32px 32px;
  box-shadow: var(--shadow);
}

/* Full brand lockup — artwork, wordmark and tagline in one image. */
.login-logo {
  display: block;
  width: 168px;
  height: auto;
  margin: 0 auto 6px;
}

.login-brand {
  font-size: 26px;
  font-weight: 620;
  letter-spacing: .06em;
  color: var(--accent);
  text-align: center;
}

/* Deliberately plain: the logo directly above already ends in a coral-ruled
   tagline, so repeating that treatment here reads as a duplicate. */
.login-sub {
  margin: 14px 0 24px;
  text-align: center;
  color: var(--ink-3);
  font-size: 11.5px;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.login-card label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 560;
  color: var(--ink-2);
}

.login-card input { margin-bottom: 16px; }

.login-error {
  margin: 14px 0 0;
  padding: 9px 12px;
  background: var(--danger-lt);
  color: var(--danger);
  border-radius: 8px;
  font-size: 13px;
}

/* ── Form controls ─────────────────────────────────────────────────────── */

input, select, textarea {
  width: 100%;
  padding: 8px 11px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  transition: border-color .12s, box-shadow .12s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt);
}

textarea { min-height: 68px; resize: vertical; }
input[type="checkbox"] { width: auto; }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 550;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}

.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); }

.btn-outline { border-color: var(--border-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(0, 0, 0, .045); }

.btn-danger { background: var(--danger-lt); color: var(--danger); border-color: #f0cfcc; }
.btn-danger:hover { background: #f7ddda; }

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; margin-top: 6px; }

/* ── Top bar ───────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }

.brand-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-name { font-weight: 620; letter-spacing: .05em; color: var(--accent); }
.brand-dot { margin: 0 5px; color: var(--border-2); }
.brand-sub { color: var(--ink-3); font-weight: 500; letter-spacing: 0; }

.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; }

.tab {
  padding: 7px 13px;
  font: inherit;
  font-weight: 520;
  color: var(--ink-2);
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover { background: rgba(0, 0, 0, .04); }
.tab.active { background: var(--accent-lt); color: var(--accent-dk); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.whoami { color: var(--ink-3); font-size: 12.5px; }

/* ── Layout ────────────────────────────────────────────────────────────── */

.view { padding: 24px 20px 64px; max-width: 1500px; margin: 0 auto; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-body { padding: 16px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ── Stat tiles ────────────────────────────────────────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 600;
}

.stat-value { margin-top: 7px; font-size: 26px; font-weight: 640; letter-spacing: -.02em; }
.stat-note { margin-top: 3px; font-size: 12px; color: var(--ink-3); }
.stat-value.accent { color: var(--accent); }
.stat-value.warn { color: var(--warn); }

/* ── Tables ────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  font-weight: 600;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }

.ref { font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }

/* ── Badges ────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2.5px 8px;
  font-size: 11.5px;
  font-weight: 580;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-confirmed  { background: var(--accent-lt); color: var(--accent-dk); }
/* Terracotta, to match the enquiry bars on the calendar. */
.badge-enquiry    { background: #fbeade;          color: #a8551f; }
.badge-checked_in { background: var(--ok-lt);     color: var(--ok); }
.badge-checked_out{ background: #eeebe6;          color: var(--ink-2); }
.badge-cancelled  { background: var(--danger-lt); color: var(--danger); }
.badge-no_show    { background: var(--danger-lt); color: var(--danger); }
.badge-foreign    { background: #ece7f6;          color: #5a4a8a; }
.badge-due        { background: var(--warn-lt);   color: var(--warn); }
.badge-paid       { background: var(--ok-lt);     color: var(--ok); }

/* ── Calendar ──────────────────────────────────────────────────────────── */

.cal-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cal-month { font-weight: 620; font-size: 16px; min-width: 170px; text-align: center; }

.cal-scroll { overflow-x: auto; }

.cal-grid {
  display: grid;
  min-width: 900px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.cal-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 34px;
}

.cal-head {
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  text-align: center;
  padding: 6px 2px;
  line-height: 1.25;
}

.cal-head.weekend { background: #f1ede6; color: var(--ink-2); }
.cal-head.today   { background: var(--accent); color: #fff; }

.cal-prop {
  padding: 9px 12px;
  font-weight: 560;
  font-size: 13px;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
}

.cal-row-bg { background: transparent; }
.cal-row-bg.weekend { background: #faf7f2; }

.cal-bar {
  margin: 4px 2px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 560;
  color: #fff;
  background: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  z-index: 1;
  align-self: center;
}

/* Darkened terracotta rather than the logo's own #e88048 — white label text on
   the lighter tone falls below AA. */
.cal-bar.enquiry     { background: #b85f28; }
.cal-bar.checked_in  { background: var(--ok); }
.cal-bar.checked_out { background: #9a9186; }
.cal-bar:hover { filter: brightness(1.1); }

/* ── Modal ─────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(35, 32, 28, .42);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .22);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 { font-size: 16px; }
.modal-body { padding: 20px; }

/* ── Forms ─────────────────────────────────────────────────────────────── */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }

.field label { font-size: 12px; font-weight: 560; color: var(--ink-2); }

.field-check { flex-direction: row; align-items: center; gap: 8px; }
.field-check label { font-size: 13px; color: var(--ink); }

.fieldset {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  margin: 4px 0 0;
}

.fieldset legend {
  padding: 0 7px;
  font-size: 11.5px;
  font-weight: 640;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-error {
  grid-column: 1 / -1;
  padding: 9px 12px;
  background: var(--danger-lt);
  color: var(--danger);
  border-radius: 8px;
  font-size: 13px;
}

.hint { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

.availability-note {
  grid-column: 1 / -1;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 540;
}

.availability-note.free  { background: var(--ok-lt);     color: var(--ok); }
.availability-note.clash { background: var(--danger-lt); color: var(--danger); }

/* ── Filters / misc ────────────────────────────────────────────────────── */

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 140px; }

.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }

/* Faint doorway mark so blank panels still feel like part of the property,
   not a broken screen. Kept low-contrast so it never competes with the text. */
.empty-logo {
  display: block;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  object-fit: contain;
  opacity: .28;
  filter: grayscale(.25);
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  padding: 11px 20px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-weight: 540;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .26);
}

.toast.error { background: var(--danger); }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px 20px;
  margin-bottom: 18px;
}

.detail-item .k {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  font-weight: 600;
}

.detail-item .v { margin-top: 3px; font-size: 14px; }

@media (max-width: 820px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .tabs { order: 3; width: 100%; }
  .view { padding: 16px 12px 56px; }
}
