/* Staff app styles. LR-03 shell and shared parts, ported from the 2026-11-24 lean prototype (cream ground,
   golds, ink); colours come from tokens.css, which base.html loads first. Hand-written, no framework, no
   external fonts or images: the CSP only allows this origin. Each rebuilt screen ships its own CSS file. */

/* v1 colour names, kept for the v1 screens and their CSS files (messages.css) until they are rebuilt. */
:root {
  --teal: var(--brand);
  --on-teal: var(--onbrand);
  --danger: var(--alert);
  --focus: var(--brand);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--ground);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.4;
  background: var(--ground);
  color: var(--text);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body.sheet-open { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 1.35rem; margin: 0 0 0.75rem; }
h2 { font-size: 1rem; }
a { color: var(--brand); }

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

.muted { color: var(--muted); }

/* --- shell: title bar and bottom tabs below 900 px, side menu from 900 px (the media block at the end) --- */
.shell { display: block; }
.side { display: block; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.6875rem max(16px, env(safe-area-inset-right));
  background: var(--brand);
  color: var(--onbrand);
}
.brand { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.07em; font-size: 1.0625rem; }
.who { font-size: 0.8125rem; margin-left: auto; }
a.who { display: inline-flex; align-items: center; min-height: 44px; } /* the name opens the Account page (LR-13) */
/* sheets.css (loaded after this file on some pages) sets a bare .who to --muted, which is near-invisible on the
   brand bar; this rule is more specific so the name is --onbrand on --brand in both themes (the side menu's own
   .who rule below still wins from 900 px: same specificity, later). */
.topbar .who { color: var(--onbrand); }
.topbar form { margin: 0; }
.topbar button {
  font-size: 0.8125rem; font-weight: 600; color: inherit; background: transparent;
  border: 1.5px solid currentColor; border-radius: 999px; padding: 0.125rem 0.75rem; min-height: 44px;
}
.topbar :focus-visible { outline-color: var(--onbrand); } /* the brand ring would vanish on the brand bar */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--soft); border-top: 1.5px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; align-items: center; justify-content: center; gap: 0.25rem; min-height: 3rem;
  padding: 0.6875rem 0.125rem 0.625rem; color: var(--muted); text-decoration: none;
  font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.tabbar a[aria-current="page"] { color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.cnt {
  display: inline-block; min-width: 1.25rem; padding: 0.0625rem 0.4375rem; border-radius: 999px;
  background: var(--alert); color: var(--ground); font-family: var(--body); font-size: 0.6875rem;
  font-weight: 700; line-height: 1.25; text-align: center; letter-spacing: 0;
}

.main {
  display: flex; flex-direction: column; gap: 14px; min-width: 0; max-width: 1040px;
  padding: 16px max(16px, env(safe-area-inset-right)) 96px max(16px, env(safe-area-inset-left));
}

/* --- sheet and toast: one of each, after <main>, outside every polled element ---
   #sheet is shown by app.js (the hidden attribute) only while it holds an element, never by :empty: a
   whitespace-only answer must not leave a shade with no way out. The empty toast stays in the
   accessibility tree (it is the live region) and only loses its look. */
#sheet {
  position: fixed; inset: 0; z-index: 40; background: var(--shade);
  display: flex; align-items: flex-end; justify-content: center;
}
.panel {
  background: var(--ground); border: 2px solid var(--brand); border-radius: 16px 16px 0 0;
  width: min(100%, 520px); max-height: 92vh; overflow-y: auto;
  padding: 16px max(16px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 12px;
}
@media (min-width: 700px) {
  #sheet { align-items: center; }
  .panel { border-radius: 16px; }
}
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 50;
  background: var(--text); color: var(--ground); border-radius: 999px; padding: 9px 18px;
  font-weight: 600; font-size: 13.5px; max-width: calc(100% - 32px); text-align: center;
}
#toast:empty { padding: 0; background: none; }

/* --- shared parts (the prototype's class names) --- */
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.sp { justify-content: space-between; }
.link {
  background: none; border: 0; padding: 0; text-align: left; color: inherit;
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  border: 1.5px solid var(--brand); border-radius: 999px; padding: 8px 15px; background: var(--card); color: var(--brand);
  font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; text-decoration: none;
}
.btn.go { background: var(--action); border-color: var(--ink); color: var(--ink); }
.btn.sm { padding: 5px 12px; font-size: 11.5px; min-height: 44px; }
.btn.txt { border-color: transparent; background: none; text-transform: none; letter-spacing: 0; font-weight: 600; padding: 5px 4px; text-decoration: underline; }
.btn.warn { border-color: var(--alert); color: var(--alert); }
.sub { display: flex; flex-wrap: wrap; gap: 4px 18px; border-bottom: 1.5px solid var(--line); }
.sub a, .sub button {
  border: 0; background: none; padding: 6px 0 8px; font-family: var(--display); text-transform: uppercase;
  font-size: 13.5px; letter-spacing: 0.05em; color: var(--muted); text-decoration: none;
}
.sub [aria-current="page"], .sub [aria-pressed="true"] { color: var(--text); box-shadow: inset 0 -3px 0 var(--action); }
.sub em {
  font-style: normal; font-family: var(--body); font-size: 11px; background: var(--soft); border-radius: 999px;
  padding: 0 7px; margin-left: 4px; color: var(--text); font-weight: 700;
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr)); gap: 12px; align-items: start; }
.card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px;
  display: flex; flex-direction: column; gap: 9px; min-width: 0;
}
.hl { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.04em; font-size: 15px; }
.nm { font-size: 16.5px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { background: var(--soft); border-radius: 6px; padding: 1px 8px; font-size: 12px; }
.chip.warn { background: transparent; border: 1.5px solid var(--alert); color: var(--alert); font-weight: 600; }
.chip.ok { background: transparent; border: 1.5px solid var(--good); color: var(--good); font-weight: 600; }
.src {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap;
}
.src.ai { background: var(--brand); color: var(--onbrand); }
.src.staff { border: 1.5px solid var(--brand); color: var(--brand); }
.src svg { width: 11px; height: 11px; fill: currentColor; }
.flds { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fld {
  display: block; width: 100%; min-width: 0; text-align: left; border: 1.5px solid var(--muted); border-radius: 8px;
  padding: 5px 8px; background: var(--card);
}
.fld small { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.fld b { display: block; font-weight: 500; font-size: 13px; overflow-wrap: anywhere; }
.foot { border-top: 1px solid var(--line); padding-top: 8px; font-size: 12px; color: var(--muted); }
.empty { border: 1.5px dashed var(--line); border-radius: 12px; padding: 22px 16px; color: var(--muted); text-align: center; }
.find { border: 1.5px solid var(--muted); border-radius: 9px; padding: 9px 12px; background: var(--card); width: 100%; }
.st { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; border: 1.5px solid var(--line); white-space: nowrap; }
.st.ok { border-color: var(--good); color: var(--good); }
.st.bad { border-color: var(--alert); color: var(--alert); }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f input, .f select, .f textarea { border: 1.5px solid var(--muted); border-radius: 8px; padding: 9px 10px; background: var(--card); width: 100%; min-width: 0; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.err { color: var(--alert); font-weight: 600; font-size: 13.5px; }
.err:empty { display: none; }

/* htmx's own indicator style is switched off in base.html (it would be an inline <style>); this replaces it. */
.htmx-indicator { opacity: 0; transition: opacity 150ms ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .htmx-indicator { transition: none; }
}

/* ===== v1 screens (requests list, detail, sheets, messages, week), restyled with the tokens ===== */
.banner {
  margin: 0 0 1rem; padding: 0.75rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: 0.5rem; background: var(--card);
}
.main > .banner { margin-bottom: 0; } /* .main already puts its gap between children */
.segments { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.segments a {
  flex: 1; text-align: center; padding: 0.5rem; border: 1px solid var(--line); border-radius: 0.5rem;
  background: var(--card); color: var(--text); text-decoration: none;
}
.segments a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--onbrand); font-weight: 600; }
.counts { margin: 0 0 0.75rem; }
.slot { padding: 0.375rem 0.625rem; border: 1px solid var(--line); border-radius: 0.5rem; background: var(--card); }

/* --- request detail and the iPad two-pane layout (SA-10) --- */
.back { display: inline-block; padding: 0.5rem 0; min-height: 2.75rem; }
.flag { padding: 0.125rem 0.5rem; border: 1px solid var(--brand); border-radius: 999px; font-size: 0.75rem; font-weight: 700; color: var(--brand); }
.banner-warn { border-left-color: var(--alert); }
.fields { display: grid; gap: 0.5rem 1rem; margin: 0 0 1rem; }
.fields > div { display: grid; grid-template-columns: 9rem 1fr; gap: 0.5rem; }
.fields dt { color: var(--muted); }
.fields dd { margin: 0; overflow-wrap: anywhere; }
.contact { margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }

/* --- the action sheets' buttons and notice (SA-11b, #300) --- */
/* Scoped to the sheets: Messages' <a class="button"> and "Call guest" keep their own look. */
.sheet .button {
  display: inline-block; min-height: 2.75rem; padding: 0.625rem 1.25rem; border: 2px solid var(--teal); border-radius: 0.75rem;
  background: var(--card); color: var(--teal); font: inherit; font-weight: 700; line-height: 1.25; cursor: pointer;
}
.sheet { margin-top: 0.75rem; }
.sheet > summary { /* list-item keeps the disclosure triangle that shows the sheet opens */
  display: list-item; min-height: 2.75rem; padding: 0.625rem 0.75rem; border: 1px solid var(--line);
  border-radius: 0.75rem; background: var(--card); font-weight: 700; cursor: pointer;
}
.sheet[open] > summary { border-color: var(--brand); }
.sheet form { padding: 0.5rem 0.25rem 0; }
.notice { border-left-color: var(--brand); font-weight: 600; }

/* Below 900 px the detail is a page of its own: no pane, and the row's link does the work. */
.detail-pane { display: none; }

/* ===== 900 px and wider: the side menu, and v1's two panes ===== */
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); align-items: start; }
  .side {
    position: sticky; top: 0; display: flex; flex-direction: column; gap: 8px; min-height: 100vh; max-height: 100vh;
    overflow-y: auto; padding: 14px 12px; background: var(--soft); border-right: 1.5px solid var(--line);
  }
  .side .topbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 0; background: none; color: var(--text); }
  .side .brand {
    background: var(--brand); color: var(--onbrand); text-align: center; padding: 14px 4px; border-radius: 10px;
    letter-spacing: 0.09em; margin-bottom: 6px;
  }
  .side .who { margin: 0; color: var(--muted); }
  .side .topbar button { width: 100%; color: var(--brand); border-color: var(--brand); }
  .side .topbar :focus-visible { outline-color: var(--focus); } /* the side menu is not brand-coloured */
  .tabbar {
    position: static; display: flex; flex-direction: column; gap: 8px; padding: 0; background: none; border: 0;
  }
  .tabbar a {
    justify-content: space-between; min-height: 2.5rem; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 9px;
    background: var(--card); color: var(--text); font-size: 12px;
  }
  .tabbar a[aria-current="page"] { background: var(--brand); color: var(--onbrand); border-color: var(--brand); box-shadow: none; }
  .main { padding: 20px 24px 48px; }
  #toast { bottom: calc(24px + env(safe-area-inset-bottom)); }

}

@media (max-width: 599px) {
  .fld.name { display: none; }
}
