/* public/backoffice/bo-components.css — the DemandInn components and the
   back-office shell. BACK OFFICE ONLY (index.html + modifiers.html), loaded
   after bo-tokens.css and after the page's own <style>.

   Two kinds of selector live here:
   1. The component classes (.btn-amber, .chip, .card, .kpi, .seg, .tbl, .field,
      .banner, .logrow, .app/.side/.main) for new markup.
   2. ALIASES: the back office's existing class names restyled to the same
      component, so the markup and the JS that builds it stay as they are.
      .panel = .card, .btn.brand = .btn-forest, .btn.ghost = .btn-ghost,
      .btn.mini = .btn-sm, .badge = .chip, .kpi/.stat = .kpi, .layout = .app,
      .nav = .side, .content = .main, the common input classes = inputs.
   The page's own rules stay in the page untouched (78 tests pin their text);
   everything here wins by coming later in the cascade, never by !important. */

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 14px; line-height: 1.2;
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform .12s ease, background-color .12s ease, border-color .12s ease;
}
.btn:hover { transform: translateY(-1px); }
a.btn { text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn-amber, .btn.amber { background: var(--amber); color: var(--forest); }
.btn-amber:hover, .btn.amber:hover { background: var(--amber); }
.btn-forest, .btn.brand { background: var(--forest); color: var(--cream); }
.btn-forest:hover, .btn.brand:hover { background: var(--forest-2); }
.btn-ghost, .btn.ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover, .btn.ghost:hover { border-color: var(--forest); }
.btn.danger { background: transparent; border-color: var(--red-t); color: var(--red); }
.btn.danger:hover { background: var(--red-t); }
.btn-sm, .btn.mini { padding: 7px 13px; font-size: 13px; }
/* the sign-in button is its own class */
.btn-primary { background: var(--forest); color: var(--cream); border-radius: 999px; font-weight: 600; }
.btn-primary:disabled { opacity: .45; }

/* ---------- chips ---------- */
.chip, .badge, .chip2 {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.5;
  background: var(--sand); color: var(--ink-2);
}
.chip.sage { background: var(--sage); color: var(--forest); }
.chip.amber, .badge.amber { background: var(--amber-t); color: var(--amber-d); }
.chip.red, .badge.off { background: var(--red-t); color: var(--red); }
.chip.green, .badge.ok { background: var(--green-t); color: var(--green); }
.chip.forest, .chip2 { background: var(--forest); color: var(--cream); }
.chip.line { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); }
/* filter chips (toggle pills) */
.fchip { border: 1.5px solid var(--line-2); border-radius: 999px; font-weight: 600; color: var(--ink); background: transparent; }
.fchip:hover { border-color: var(--forest); }
.fchip.on { background: var(--forest); color: var(--cream); border-color: var(--forest); }
/* the dashboard's status pills: tints follow the palette */
.feed.live { border-color: var(--sage); }
.feed.soon2, .feed.warn { border-color: var(--amber-t); }
.feed.soon2 .dot, .feed.warn .dot { background: var(--amber); }

/* ---------- cards ---------- */
.card, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: none; }
.card { padding: 20px; }
#login .card { padding: 28px; }
.card-h, .panel > .ph { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-h { margin-bottom: 12px; }
.card h3, .panel > .ph h2, .card-h h2, .card-h h3 { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: -.01em; line-height: 1.12; }
.hint, .ph .hint { font-size: 13px; color: var(--muted); }
.card.dark, .panel.dark { background: var(--forest); color: var(--cream); border-color: var(--forest); }
.card.dark .hint, .panel.dark .hint, .card.dark .l, .card.dark .eyebrow { color: var(--sage); }
.cat-h td { background: var(--sand); }

/* ---------- KPI tiles ---------- */
.kpi, .stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.kpi .l, .stat .l { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.kpi .v, .stat .v { font-family: var(--serif); font-size: 38px; font-weight: 600; letter-spacing: -.01em; line-height: 1.05; margin-top: 4px; }
/* a narrow tile (five across on a laptop) steps the figure down rather than breaking "£1,850.00" over two lines */
.kpi, .stat { container-type: inline-size; }
/* inline-size containment gives a tile no width of its own, so in a flex row (Timesheets, Labour, the loans and
   financials strips lay their tiles out with display:flex) every tile collapsed to its padding, about 42px, with its
   label and figure broken a letter a line. A tile now has a base size and grows; a row that cannot fit two wraps to
   one per line. In a grid parent (.stats, .kpis) flex does nothing, so those are unchanged. */
.kpi, .stat { flex: 1 1 170px; min-width: 0; }
@container (max-width: 250px) { .kpi .v, .stat .v { font-size: 30px; } }
@container (max-width: 180px) { .kpi .v, .stat .v { font-size: 26px; } }
.kpis, .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi.good, .be-day.be-day-ahead { border-color: var(--sage); }
.kpi.warn, .be-day.be-day-behind { border-color: var(--amber-t); }

/* ---------- segmented ---------- */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--sand); border: 0; border-radius: 999px; overflow: visible; }
.seg button { padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); background: transparent; border-radius: 999px; border: 0; }
.seg button + button { border-left: 0; }
.seg button.on { background: var(--forest); color: var(--cream); }

/* ---------- tables ---------- */
.tbl, table { font-size: 14px; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 8px 8px; border-bottom: 1.5px solid var(--line-2); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
tr.click { cursor: pointer; }
tr.click:hover td, tr.rp-item:hover td { background: var(--row-hover); }
.r, th.r, td.r { text-align: right; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* ---------- inputs ---------- */
:where(input:not([type=checkbox], [type=radio], [type=range], [type=color], [type=file], [type=submit], [type=button]), select, textarea) {
  border: 1.5px solid var(--line-2); border-radius: 10px; padding: 8px 10px;
  background: var(--white); color: var(--ink); font: inherit; font-size: 14px;
}
/* the page's own input classes keep their width and padding; border, radius and fill follow */
.num, .invctl, .price-in, select.vat, .field input, .bfield input, .mfield input, .mfield select,
.tk-f input, .tk-f select, .nd-size input, .cl-item input, .rc-makes-row input, #tkCsv {
  border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--white); color: var(--ink);
}
.field input:focus, .bfield input:focus, .mfield input:focus, .num:focus, .invctl:focus { border-color: var(--forest); }
.field { display: grid; gap: 6px; }
.field label, .bfield label, .mfield label, .tk-f label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 0; }

/* ---------- banners and log rows ---------- */
.banner { border-radius: 12px; padding: 11px 14px; background: var(--amber-t); color: var(--amber-d); font-size: 14px; }
.banner.ok { background: var(--green-t); color: var(--green); }
.banner.bad { background: var(--red-t); color: var(--red); }
.rc-err { background: var(--red-t); color: var(--red); border-radius: 12px; }
.rc-overlap .amberline { background: var(--amber-t); color: var(--amber-d); border-left-color: var(--amber); }
.logrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }

/* ---------- headings ---------- */
.section-head h1, .card h1 { font-weight: 600; letter-spacing: -.01em; line-height: 1.12; }
.toast { background: var(--forest); color: var(--cream); }

/* ---------- shell ---------- */
.app, .layout {
  display: grid; grid-template-columns: 236px minmax(0, 1fr); align-items: stretch;
  min-height: 100vh; max-width: none; margin: 0;
}
.side, .nav {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--forest); color: var(--cream);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; max-height: 100vh; overflow: hidden;
  width: auto; flex: none; overscroll-behavior: contain;
}
/* the nav list scrolls on its own; the brand above and Sign out below stay put */
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
/* the old top bar now sits at the top of the side: logo, venue name, the updates bell */
.side header, .side-top {
  position: static; display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  padding: 2px 10px 18px; background: transparent; border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.side .brand { color: var(--cream); font-family: var(--serif); font-size: 15px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
.side .brand [data-brand-name] { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.side .brand .logo { background-color: var(--amber); }
.side .brand .logo.has-logo { background-color: transparent; }
.side .spacer { flex: 1; }
.nav .group { color: var(--sage); font-size: 11px; letter-spacing: .14em; font-weight: 700; padding: 14px 12px 6px; opacity: .85; }
.nav button { position: relative; color: var(--cream); opacity: .85; border-radius: 10px; padding: 9px 12px; font-size: 14px; font-weight: 500; }
.nav button .ic { opacity: .8; }
.nav button:hover { background: var(--forest-2); opacity: 1; }
.nav button.on { background: var(--forest-2); color: var(--sand); font-weight: 600; opacity: 1; }
.nav button.on::after { content: ""; position: absolute; right: 10px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--amber); }
.nav .soon { background: var(--amber); color: var(--forest); }
.grow { flex: 1 1 auto; }
.side-foot { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--forest-3); }
.side .link { display: flex; align-items: center; color: var(--sand); font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 10px; text-align: left; cursor: pointer; background: none; border: 0; min-height: 0; }
.side .link:hover { background: var(--forest-2); color: var(--cream); }
.main, .content { width: 100%; max-width: 1240px; margin: 0 auto; min-width: 0; padding: 26px clamp(16px, 2.6vw, 40px) 90px; }
/* the two modes that hide the side (rota full screen, recipes-only): one column, nothing reserved for it;
   the recipes-only shell keeps the side, with only the brand and Sign out on it */
body.rota-focus .layout { grid-template-columns: minmax(0, 1fr); }
body.bo-recipes .nav { display: flex; }
body.bo-recipes .nav button[data-section], body.bo-recipes .nav .group { display: none; }
body.sec-rota .content { padding: 12px 16px 40px; }
body.rota-focus .content { padding: 0; }

/* ---------- mobile: the side becomes a top row, the app one column ---------- */
@media (max-width: 899px) {
  .app, .layout { grid-template-columns: minmax(0, 1fr); }
  /* two rows, as the old header + strip were: the venue, bell, Open till and Sign out on the first,
     the nav as one swipeable strip on the second */
  .side, .nav {
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 6px;
    position: sticky; top: 0; height: auto; max-height: none;
    overflow: hidden; padding: 6px 12px 8px;
    background: var(--forest); border-bottom: 0; z-index: 9;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .side::-webkit-scrollbar, .side-nav::-webkit-scrollbar { display: none; }
  .side-nav { order: 2; flex: 1 1 100%; min-width: 100%; flex-direction: row; align-items: center; gap: 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  /* the brand gives way to the nav row: one line, clipped with an ellipsis, never wider than a third of the screen */
  .side header, .side-top { order: 0; padding: 0 6px 0 0; flex: 1 1 0; min-width: 0; }
  .side .brand { font-size: 15px; min-width: 0; }
  .side .brand [data-brand-name] { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav .group { display: none; }
  .nav button { width: auto; white-space: nowrap; margin: 0; padding: 10px 12px; flex: none; min-height: 44px; border: 1px solid var(--forest-3); background: var(--forest-2); }
  .nav button.on { border-color: var(--amber); background: var(--forest-3); }
  .nav button.on::after { display: none; }
  .grow { flex: none; width: 6px; }
  .side-foot { order: 1; flex-direction: row; margin: 0; padding: 0; border-top: 0; flex: none; }
  .side .link { white-space: nowrap; min-height: 44px; padding: 8px 10px; }
  .main, .content { padding: 12px 12px 90px; }
  body.sec-rota .content { padding: 12px 12px 40px; }
}

/* ---------- modifiers.html (framed inside Menu & VAT) ---------- */
.gdot { color: var(--amber-d); }
