/* Sitatunga Rentals — the design system. Tokens from docs/BRAND.md; use only these.
   The family is the lodge's brand guide (v2, "company profile style"): Caladea headings, Carlito
   text, gold rules, linen panels. Two colours are the rentals' own so the two businesses do not
   look the same: Rivonia navy where the lodge has forest green, and Jacaranda where the lodge has
   logo orange (logo and pattern line only).
   Mobile first: the base rules are the phone layout (375px); wider screens add to them. */

:root {
  --navy: #22344A;          /* bands, buttons, headings: the lodge's forest, for the rentals */
  --navy-deep: #1A2838;     /* hover and pressed */
  --navy-soft: #E4E8EE;     /* a navy wash: selected rows, lease swatches */
  --gold: #B8955A;          /* rules under headings, eyebrow labels, short stays on the calendar */
  --gold-soft: #F1E7D4;
  --sand: #D9C39A;          /* small text on navy */
  --linen: #F7F3EA;         /* the page, panels, stat tiles, table headers */
  --paper: #FFFFFF;         /* cards and documents */
  --ink: #2B2B26;           /* body text */
  --muted: #6F6A5E;
  --hair: #E5DCC9;          /* borders, dividers */
  --zebra: #FBF8F2;
  --jacaranda: #8E6CC4;     /* the logo's antelopes and the pattern line, nothing else */
  --alert: #8A3B2E;         /* attention only: arrears, an inspection window open, not assigned */
  --alert-soft: #F6ECE8;
  --ok: #3F6A4C;            /* "done" and "paid", sparingly */
  --ok-soft: #E6EFE7;

  --font-display: 'Caladea', Cambria, Georgia, serif;
  --font-body: 'Carlito', Calibri, 'Segoe UI', Arial, sans-serif;
  --font-data: 'Carlito', Calibri, 'Segoe UI', Arial, sans-serif;
  --font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shadow: 0 1px 2px rgba(34, 52, 74, 0.06), 0 6px 18px -12px rgba(34, 52, 74, 0.25);
  --radius: 8px;
  --gutter: 16px;
  --side: 0px;              /* the sidebar's width; set in shell.css */

  --cal-unit: 96px;
  --cal-day: 38px;
  --cal-row: 52px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--linen);
  color: var(--ink);
  font: 400 17px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--navy);
  margin: 0 0 12px;
  text-wrap: balance;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; margin-top: 28px; }
h3 { font-size: 1.08rem; margin: 18px 0 8px; }
.card > h2:first-child, .panel > h2:first-of-type { margin-top: 0; }

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold);
}

/* A link is navy on a gold underline: the click is clear and the gold ties it to the brand. */
:where(a) {
  color: var(--navy);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
:where(a:hover) { color: var(--navy-deep); text-decoration-color: var(--navy); }

/* Anything compared down a column: rands, dates, counts. */
.data, td.num, time { font-family: var(--font-data); font-variant-numeric: tabular-nums lining-nums; }
.ref, kbd, code { font-family: var(--font-code); font-size: 0.85em; }

.subtle { color: var(--muted); font-weight: 400; font-size: 0.92em; }
.sub { display: block; }
.nowrap { white-space: nowrap; }
.note { color: var(--muted); font-size: 0.95rem; }
.warn { color: var(--alert); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Screen heading: title, a line under it in gold, actions on the right ---- */

.screen > h1:first-child, .screen-head {
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1.5px solid var(--gold);
}
.screen-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px;
}
.screen-head h1 { margin: 0; }
.screen-head .eyebrow + h1 { margin-top: 0; }
h1 .subtle { font-family: var(--font-body); font-size: 0.6em; letter-spacing: 0.01em; }
.head-title { min-width: 0; }

/* ---- Cards and panels ---- */

.card {
  background: var(--paper);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card p { margin: 0 0 8px; }
.card p:last-child { margin-bottom: 0; }

.flash {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--ok-soft);
  border-left: 4px solid var(--ok);
  border-radius: 6px;
  color: var(--ink);
}
.problem {
  padding: 12px 14px;
  background: var(--alert-soft);
  border-left: 4px solid var(--alert);
  border-radius: 6px;
  color: var(--alert);
}
.problem[hidden] { display: none; }

/* ---- Buttons: navy is the click, as forest is on the lodge's documents ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--navy); border-radius: 6px;
  background: var(--navy); color: var(--paper);
  font: 700 0.98rem var(--font-body);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--navy-deep); border-color: var(--navy-deep); color: var(--paper); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn-quiet { background: var(--paper); border-color: var(--hair); color: var(--navy); }
.btn-quiet:hover { background: var(--paper); border-color: var(--navy); color: var(--navy); }
.btn-danger { background: var(--paper); border-color: var(--alert); color: var(--alert); }
.btn-danger:hover { background: var(--alert); border-color: var(--alert); color: var(--paper); }
.btn.is-on { background: var(--navy); border-color: var(--navy); color: var(--paper); }
.btn .ico { width: 18px; height: 18px; }
.link-btn {
  background: none; border: 0; padding: 8px 0; min-height: 36px; cursor: pointer;
  font: inherit; color: var(--navy);
  text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 1.5px; text-underline-offset: 3px;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- Forms ---- */

.form { display: grid; gap: 16px; max-width: 760px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label, .field .label { font-weight: 700; font-size: 0.92rem; color: var(--ink); }
.field-row { display: grid; gap: 16px; grid-template-columns: 1fr; }
.field-row--3 { grid-template-columns: 1fr; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--hair);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem var(--font-body);
}
input:hover, select:hover, textarea:hover { border-color: #D2C6AE; }
input[type="date"], input[type="number"], input[type="month"] { font-variant-numeric: tabular-nums; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 1rem; }
.check input { width: 22px; height: 22px; min-height: 0; flex: none; accent-color: var(--navy); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--navy); }

/* File choosers: a generous box to tap, or to drop a file on from the desktop. */
input[type="file"] {
  min-height: 76px; padding: 16px; cursor: pointer;
  border: 2px dashed var(--hair); background: var(--zebra);
  font-size: 0.95rem; color: var(--muted);
}
input[type="file"]:hover { border-color: var(--gold); }
input[type="file"]::file-selector-button {
  margin-right: 12px; min-height: 40px; padding: 0 16px; cursor: pointer;
  border: 1px solid var(--navy); border-radius: 6px; background: var(--navy);
  color: var(--paper); font: 700 0.95rem var(--font-body);
}

/* Facts: a label and a value, side by side. */
.facts { display: grid; gap: 8px; margin: 0 0 16px; }
.facts div { display: grid; grid-template-columns: 100px 1fr; gap: 10px; }
.facts dt { font-weight: 700; color: var(--muted); font-size: 0.92rem; padding-top: 1px; }
.facts dd { margin: 0; }

/* ---- Status pills ---- */

.status {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--navy-soft);
  color: var(--navy);
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}
.status--provisional { background: repeating-linear-gradient(135deg, var(--navy-soft) 0 5px, var(--paper) 5px 10px); box-shadow: inset 0 0 0 1px var(--navy); }
.status--enquiry, .status--cancelled, .status--out, .status--signedoff { background: var(--linen); color: var(--muted); box-shadow: inset 0 0 0 1px var(--hair); }
.status--raised { background: var(--alert-soft); color: var(--alert); }
.status--reported { background: var(--gold-soft); color: #6E5428; }
.status--in { background: var(--ok-soft); color: var(--ok); }
.badge-estimate { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--gold); color: #6E5428; }

/* ---- Tables: linen header on a gold rule, light rows, bold totals ---- */

table { width: 100%; border-collapse: collapse; background: var(--paper); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--hair); vertical-align: middle; }
thead th {
  background: var(--linen);
  border-bottom: 1.5px solid var(--gold);
  color: var(--navy);
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
tbody tr:nth-child(even) { background: var(--zebra); }
tbody tr:hover { background: #F4EEE2; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; border-top: 1.5px solid var(--gold); border-bottom: 0; background: var(--linen); }
th.num, td.num { text-align: right; }
/* A date or an amount is read whole: never break "1 May 2026" or "R9 800" across lines. */
th.num, td.num, td .data, td time { white-space: nowrap; }
tr.is-late td, tr.is-late td a { color: var(--alert); }
tr.is-void td { color: var(--muted); text-decoration: line-through; }
tr.is-void td .status, tr.is-void td .subtle { text-decoration: none; }
tr.is-inactive td { color: var(--muted); }
td.row-acts { text-align: right; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; }

/* A table wider than its box: the first column stays put, the right edge fades while there is more. */
.table-wrap.has-more { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.table-wrap.is-scrolling th:first-child, .table-wrap.is-scrolling td:first-child { position: sticky; left: 0; z-index: 1; background: var(--paper); white-space: nowrap; }
.table-wrap.is-scrolling thead th:first-child { background: var(--linen); }
.table-wrap.is-scrolling tbody tr:nth-child(even) td:first-child { background: var(--zebra); }
.table-wrap.is-scrolled th:first-child, .table-wrap.is-scrolled td:first-child { box-shadow: 6px 0 8px -6px rgba(34, 52, 74, 0.3); }

/* Columns that repeat something step aside on a phone; a second copy shows inline there instead. */
.hide-sm { display: none; }
.show-sm { display: table; margin-top: 4px; }

@media (max-width: 599px) {
  table { font-size: 0.94rem; }
  th, td { padding: 9px 7px; }
  th:first-child, td:first-child { padding-left: 12px; }
  th:last-child, td:last-child { padding-right: 12px; }
  .card { padding: 16px; }
  .card .table-wrap { margin-left: -16px; margin-right: -16px; border-left: 0; border-right: 0; border-radius: 0; }
  .screen-head .actions { gap: 8px; }
  .screen-head .actions .btn { min-height: 40px; padding: 0 12px; font-size: 0.92rem; }
}
@media (min-width: 600px) { tr:not(.is-void) td.row-acts { white-space: nowrap; } }
@media (min-width: 768px) {
  :root { --gutter: 28px; --cal-unit: 128px; --cal-day: 34px; }
  h1 { font-size: 2.1rem; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row--3 { grid-template-columns: 1fr 1fr 1fr; }
  .hide-sm { display: table-cell; }
  .show-sm { display: none; }
}
@media (min-width: 1280px) { :root { --gutter: 36px; } }

/* Keyboard focus is always visible: gold on the light page, sand on the navy bands. */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
main:focus { outline: none; }

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

@media print {
  body { background: var(--paper); display: block; padding: 0 !important; }
  .site-header, .site-nav, .no-print { display: none !important; }
  main { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .card, .table-wrap { border: 0; padding: 0; box-shadow: none; }
}
