/* PMS Kovix — one hand-written stylesheet. No framework, no build step, no CDN.
   Colours, spacing and type come from the :root tokens; components use only tokens. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter/InterVariable.2bf3d951bf9d.woff2") format("woff2");
}

/* ---- Tokens ---------------------------------------------------------- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --color-bg: #f6f7f9;
  --color-surface: #ffffff;
  --color-text: #1b1f24;
  --color-muted: #5b6470;
  --color-border: #d9dee4;
  --color-primary: #1f5f8b;
  --color-primary-text: #ffffff;
  --color-focus: #2b7fd0;
  --color-ok: #1e7a46;
  --color-warn: #8a5a00;
  --color-bad: #b42318;
  --color-ok-bg: #e6f4ec;
  --color-warn-bg: #fdf3dc;
  --color-bad-bg: #fde8e6;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  --radius-sm: 4px;
  --radius-md: 8px;

  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;

  --sidebar-width: 240px;
  --topbar-height: 56px;
  --content-max: 1280px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #111418;
    --color-surface: #1a1f25;
    --color-text: #e7eaee;
    --color-muted: #a1a9b3;
    --color-border: #2f3740;
    --color-primary: #5aa4d8;
    --color-primary-text: #0b1117;
    --color-focus: #7cc0f0;
    --color-ok: #6fd39b;
    --color-warn: #f0c05a;
    --color-bad: #ff8a80;
    --color-ok-bg: #16301f;
    --color-warn-bg: #33280f;
    --color-bad-bg: #3a1a17;
  }
}

/* ---- Reset and base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--space-4); }
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
p { margin: 0 0 var(--space-4); }
a { color: var(--color-primary); }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

.sprite { display: none; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-2); top: -3rem; z-index: 10;
  padding: var(--space-2) var(--space-3); background: var(--color-surface);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-2); }

/* ---- Application shell ---------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  grid-template-areas: "topbar topbar" "sidebar content";
  min-height: 100vh;
}
.topbar {
  grid-area: topbar;
  display: flex; align-items: center; gap: var(--space-4);
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.topbar__toggle { display: none; }
.topbar__brand { font-weight: 700; color: var(--color-text); text-decoration: none; }
.topbar__user { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }
.topbar__user form { margin: 0; }
.topbar__email { color: var(--color-muted); font-size: var(--text-sm); }

.sidebar {
  grid-area: sidebar;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: var(--space-4) var(--space-2);
}
.sidebar__list { list-style: none; margin: 0; padding: 0; }
.sidebar__link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text); text-decoration: none;
}
.sidebar__link:hover { background: var(--color-bg); }
.sidebar__link[aria-current="page"] { background: var(--color-bg); font-weight: 600; }

.content {
  grid-area: content;
  width: 100%; max-width: var(--content-max);
  min-width: 0; /* a wide table scrolls inside .table-wrap instead of widening the page */
  padding: var(--space-6) var(--space-5);
}

@media (max-width: 767px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "sidebar" "content";
    grid-template-rows: var(--topbar-height) auto 1fr;
  }
  .topbar__toggle { display: inline-flex; }
  .topbar__email { display: none; }
  .sidebar { display: none; border-right: 0; border-bottom: 1px solid var(--color-border); }
  .sidebar.is-open { display: block; }
  .content { padding: var(--space-5) var(--space-4); }
}

/* ---- Entrance (logged-out pages) ------------------------------------ */
.entrance {
  display: grid; place-items: center;
  min-height: 100vh; padding: var(--space-4);
}
.entrance__card {
  width: 100%; max-width: 26rem;
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.entrance__brand { font-weight: 700; color: var(--color-primary); margin-bottom: var(--space-5); }

/* ---- Components ------------------------------------------------------ */
.card {
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.btn, .entrance__card button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 2.5rem; padding: var(--space-2) var(--space-4);
  font: inherit; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--color-primary); color: var(--color-primary-text);
}
a.btn { text-decoration: none; }
.btn--secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn--danger { background: var(--color-bad); color: #ffffff; }
.btn--icon { min-height: 2.5rem; padding: var(--space-2); background: transparent; color: var(--color-text); }

.table { width: 100%; border-collapse: collapse; background: var(--color-surface); }
.table th, .table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); text-align: left; }
.table th { font-size: var(--text-sm); color: var(--color-muted); font-weight: 600; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table caption { padding: var(--space-3); text-align: left; font-weight: 600; }
.table tbody th { color: var(--color-text); font-size: var(--text-md); }
/* Narrow screens: the table scrolls sideways inside its frame; the page itself never does. */
.table-wrap {
  /* position: the screen-reader labels inside buttons (.visually-hidden, position: absolute)
     stay inside this frame; without it they escape it and widen the whole page. */
  position: relative;
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.table-wrap .table th, .table-wrap .table td { white-space: nowrap; }
.table-wrap:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.summary { color: var(--color-muted); margin: 0 0 var(--space-4); }

.chip {
  display: inline-block; padding: 0 var(--space-2);
  font-size: var(--text-sm); border-radius: 999px;
  background: var(--color-bg); border: 1px solid var(--color-border);
}
.chip--ok { background: var(--color-ok-bg); color: var(--color-ok); border-color: transparent; }
.chip--warn { background: var(--color-warn-bg); color: var(--color-warn); border-color: transparent; }
.chip--bad { background: var(--color-bad-bg); color: var(--color-bad); border-color: transparent; }

/* Form fields: our own markup and allauth's default elements (label + input inside <p>). */
label { display: block; font-weight: 600; margin-bottom: var(--space-1); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="tel"], input[type="search"], select, textarea {
  width: 100%; min-height: 2.5rem;
  padding: var(--space-2) var(--space-3);
  font: inherit; color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
}
input[type="checkbox"] + label { display: inline; font-weight: 400; margin-left: var(--space-2); }
.errorlist { color: var(--color-bad); padding-left: var(--space-4); margin: 0 0 var(--space-2); }

.messages { list-style: none; padding: 0; margin: 0 0 var(--space-4); }
.messages__item {
  padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2);
  border-radius: var(--radius-sm); background: var(--color-bg);
}
.messages__item--success { background: var(--color-ok-bg); color: var(--color-ok); }
.messages__item--warning { background: var(--color-warn-bg); color: var(--color-warn); }
.messages__item--error { background: var(--color-bad-bg); color: var(--color-bad); }

/* ---- Page layouts ---------------------------------------------------- */
/* A page title with its main action (e.g. "New guest") on the same line. */
.page-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-3); margin-bottom: var(--space-4);
}
.page-header h1 { margin: 0; }
.page-header__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* "Upcoming | All" above a list: plain links, the current one marked. */
.view-switch { display: flex; gap: var(--space-4); margin-bottom: var(--space-3); }
.view-switch [aria-current="page"] { font-weight: 600; text-decoration: none; color: var(--color-text); }

/* Two dates and a button on one line; stacked below 768 px. */
.date-search { margin-bottom: var(--space-4); }
.date-search__row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.date-search__row .form__field { flex: 1 1 12rem; margin-bottom: 0; }
.date-search__row .date-search__submit { flex: 0 0 auto; }

.search { max-width: 32rem; margin-bottom: var(--space-4); }
.search__row { display: flex; gap: var(--space-2); }

/* One column of fields at every width; the card keeps lines readable on wide screens. */
.form { max-width: 40rem; }
.form__field { margin-bottom: var(--space-4); }
.form__required { font-weight: 400; color: var(--color-muted); }
.form__hint { margin: 0 0 var(--space-1); font-size: var(--text-sm); color: var(--color-muted); }
.form__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
textarea { min-height: 6rem; resize: vertical; }
[aria-invalid="true"] { border-color: var(--color-bad); }

.error-summary {
  margin-bottom: var(--space-5); padding: var(--space-3) var(--space-4);
  background: var(--color-bad-bg); color: var(--color-bad);
  border: 1px solid var(--color-bad); border-radius: var(--radius-sm);
}
.error-summary h2 { font-size: var(--text-md); margin-bottom: var(--space-2); }
.error-summary ul { margin: 0; padding-left: var(--space-5); }
.error-summary a { color: inherit; }

.pager { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-4); }

/* Front desk: one section per kind of work; small forms for the buttons in a table row. */
.desk-section { margin-bottom: var(--space-5); }
.desk-section h2 { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.row-actions form, .page-header__actions form { margin: 0; }
/* The front-desk table fits its frame at 1280 px (Slice 8): the "still checked in" note may
   wrap; dates, chips and buttons stay on one line. Below 768 px it scrolls in .table-wrap. */
.table-wrap .desk-table .desk-table__note { white-space: normal; display: inline-block; max-width: 16rem; }
.desk-table .chip { white-space: nowrap; margin-left: var(--space-1); }

/* Housekeeping board (Slice 8), phone first: one card per room, one column below 768 px, a
   grid of cards above. No table, so nothing scrolls sideways. A card is positioned so the
   screen-reader text in its button stays inside it (the Slice 7 lesson). */
.hk-board {
  display: grid; grid-template-columns: 1fr; gap: var(--space-3);
  list-style: none; margin: 0; padding: 0;
}
@media (min-width: 768px) {
  .hk-board { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
}
.hk-room {
  position: relative; display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-4); min-width: 0;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.hk-room--dirty { border-left: 6px solid var(--color-warn); }
.hk-room__title { font-size: var(--text-lg); margin: 0; }
.hk-room__type { font-size: var(--text-sm); font-weight: 400; color: var(--color-muted); }
.hk-room__state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; }
.hk-room__occupancy { font-weight: 600; }
.hk-room__facts {
  display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-3);
  margin: 0; font-size: var(--text-sm);
}
.hk-room__facts dt { color: var(--color-muted); }
.hk-room__facts dd { margin: 0; overflow-wrap: anywhere; }
.hk-room form { margin: auto 0 0; }
.hk-room__button { width: 100%; min-height: 2.75rem; }

/* Planning calendar (Slice 6): rooms × 14 nights. Fixed column widths, so a one-night stay
   and a free night are the same width; the room column stays visible while the table scrolls
   sideways inside .table-wrap. Status differs by words and by border style, not colour alone. */
.cal-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--space-3); margin-bottom: var(--space-4);
}
.cal-nav { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.cal-jump { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2); }
.cal-jump label { margin: 0; align-self: center; }
.cal-jump input[type="date"] { width: auto; }

.calendar { table-layout: fixed; width: 78rem; }
.calendar__room-col { width: 8rem; }
.calendar__night-col { width: 5rem; }
.table-wrap .calendar th, .table-wrap .calendar td {
  padding: var(--space-1); border-left: 1px solid var(--color-border); vertical-align: top;
}
.calendar .calendar__room {
  position: sticky; left: 0; z-index: 1;
  background: var(--color-surface); border-right: 2px solid var(--color-border);
  white-space: normal;
}
.calendar__room-name { display: block; font-weight: 600; color: var(--color-text); }
.calendar__note { display: block; font-size: var(--text-sm); font-weight: 400; color: var(--color-muted); }
.calendar__note--warn { color: var(--color-warn); font-weight: 600; }
.calendar__night { text-align: center; font-weight: 600; }
.calendar__month { display: block; color: var(--color-text); }
.calendar__day { display: block; }
.calendar__today {
  display: block; margin-top: var(--space-1);
  color: var(--color-primary); font-weight: 700;
}
.calendar__night--today { border-bottom: 3px solid var(--color-primary); }
.calendar__night--weekend, .calendar__free--weekend { background: var(--color-bg); }
.calendar__free--today { box-shadow: inset 0 0 0 2px var(--color-primary); }
.calendar__book { display: block; text-align: center; font-size: var(--text-sm); }

.calendar__stay-link {
  display: block; padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm); text-decoration: none; color: var(--color-text);
}
.calendar__name, .calendar__status, .calendar__clip {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calendar__name { font-weight: 600; }
.calendar__status, .calendar__clip { font-size: var(--text-sm); }
.calendar__stay--confirmed .calendar__stay-link {
  background: var(--color-surface); border: 2px solid var(--color-primary);
}
.calendar__stay--in-house .calendar__stay-link {
  background: var(--color-ok-bg); color: var(--color-ok);
  border: 2px solid var(--color-ok); border-left-width: 6px;
}
.calendar__stay--checked-out .calendar__stay-link {
  background: var(--color-bg); color: var(--color-muted);
  border: 2px dashed var(--color-muted);
}
.calendar tfoot th, .calendar tfoot td { border-top: 2px solid var(--color-border); }
.calendar__total { text-align: center; font-variant-numeric: tabular-nums; }

/* Label/value pairs; one column below 768 px. */
.details {
  display: grid; grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-5); margin: 0;
}
.details dt { font-weight: 600; color: var(--color-muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .details { grid-template-columns: 1fr; gap: 0; }
  .details dd { margin-bottom: var(--space-3); }
}

/* Demo folio (Slice 7). The banner is plain text in a bordered box: it must be read, not
   decorated. Money columns use tabular figures (.num) so the decimals line up. */
.demo-banner {
  padding: var(--space-2) var(--space-3); margin-bottom: var(--space-4);
  background: var(--color-warn-bg); color: var(--color-warn);
  border: 1px solid var(--color-warn); border-radius: var(--radius-sm); font-weight: 600;
}
/* The folio fits the page at desktop width: text columns may wrap; dates and amounts
   (.folio__keep, .num) never break. Below 768 px the table scrolls inside .table-wrap. */
.table-wrap .folio th, .table-wrap .folio td { white-space: normal; }
.table-wrap .folio .num, .table-wrap .folio .folio__keep { white-space: nowrap; }
.folio .btn { white-space: nowrap; }
.folio__expected td, .folio__expected th { font-style: italic; color: var(--color-muted); }
.folio__totals { margin: var(--space-4) 0 var(--space-5); }
.folio__totals .num { font-variant-numeric: tabular-nums; }
.quick-picks { margin-bottom: var(--space-4); }
.quick-picks h2 { font-size: var(--text-md); margin-bottom: var(--space-2); }
.quick-picks__list { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin: 0 0 var(--space-2); padding: 0; }
.form__fieldset { border: 0; margin: 0 0 var(--space-4); padding: 0; }
.form__fieldset legend { font-weight: 600; margin-bottom: var(--space-1); padding: 0; }
.form__radio { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-1); }
.form__radio label { display: inline; font-weight: 400; margin: 0; }

/* Print folio: only the page content, in black on white; links print as plain text. */
@media print {
  .topbar, .sidebar, .skip-link, .messages, .no-print { display: none; }
  .shell { display: block; min-height: 0; }
  body { background: #ffffff; color: #000000; }
  .content { padding: 0; max-width: none; }
  .table-wrap { overflow: visible; border: 0; }
  .table, .table th, .table td { color: #000000; background: #ffffff; }
  .demo-banner { background: #ffffff; color: #000000; border-color: #000000; }
  a { color: inherit; text-decoration: none; }
}
