/* One stylesheet for every console: business, till, operator, venue, partner.
   Tokens are lifted verbatim from the Giftay column of the Neirfeno shared
   theme (~/projects/neirfeno.com/shared/css/site.css §1 and the ACCENT_* keys
   in sites/giftay.co.uk/site.conf). Do not re-derive a colour by eye.

   The shell every console shares:

     <header class="masthead">  wordmark + console name
     <div class="accent-rule">  the 3px accent line the product sites carry
     <div class="shell">        row: optional .sidenav, then .page
*/

:root {
  /* neutral frame */
  --paper: #f6f8f8;
  --surface: #ffffff;
  --sunken: #eff3f3;
  --line: #e4eaea;
  --line-strong: #e0e7e7;
  --control: #d6dfdf;
  --ink: #0b1f33;
  --muted: #40566b;
  --muted-2: #5b7183;
  --band: #0b1f33;
  --band-ink: #eaf2f1;
  --band-muted: #a9bfc9;
  /* giftay accent: dot / tint / on-tint text / filled button / body link */
  --a-dot: #9895fc;
  --a-tint: #efeffe;
  --a-text: #3f3aa8;
  --a-btn: #9895fc;
  --a-btn-ink: #0b1f33;
  --a-link: #4b44c4;
  /* status */
  --ok: #12784a;
  --ok-tint: #f4fbf7;
  --ok-line: #d6efe2;
  --warn: #9a4b12;
  --warn-tint: #fdf8f3;
  --warn-line: #f0e2d5;
  --down: #b3261e;
  /* type, spacing, shape */
  --font-sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: 20px;
  --r-sm: 8px;
  --r-btn: 10px;
  --r-block: 12px;
  --r-card: 14px;
  --r-pill: 999px;
  --shadow-card: 0 10px 24px -18px rgba(11, 31, 51, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #071628;
    --surface: #0e2438;
    --sunken: #0a1e31;
    --line: #16324a;
    --line-strong: #1d3b52;
    --control: #2a4c68;
    --ink: #eaf2f1;
    --muted: #a9bfc9;
    --muted-2: #78919f;
    --a-tint: #1e1c46;
    --a-text: #bebcfb;
    --a-btn: #9895fc;
    --a-btn-ink: #0b1f33;
    --a-link: #bebcfb;
    --ok: #7fdcab;
    --ok-tint: #0c2c1c;
    --ok-line: #16324a;
    --warn: #ffc79b;
    --warn-tint: #33200e;
    --warn-line: #1d3b52;
    --down: #ff8f86;
    --shadow-card: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
/* the sign-in page's reset form is a hidden .stack, and display:flex outranks
   the hidden attribute's UA rule. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--a-link); text-decoration: none; }
a:hover { color: var(--ink); }
strong { font-weight: 600; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--sunken); border-radius: var(--r-sm); padding: 2px 6px; }
:focus-visible { outline: 2px solid var(--a-link); outline-offset: 3px; border-radius: 2px; }

/* --- masthead ----------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.by-neirfeno {
  font-weight: 600;
  color: #2faf5c;
  background-image: linear-gradient(90deg, #2faf5c, #24e3eb);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.console-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--a-link);
}
.console-name::before { content: ""; width: 1px; height: 18px; background: var(--control); }
.masthead form { margin-left: auto; }
.masthead .nav-toggle { margin-left: auto; }
.masthead:has(.nav-toggle) form { margin-left: 0; }
.accent-rule { height: 3px; background: var(--a-dot); }

/* visually hidden: the checkbox is the :checked hook for the narrow menu */
.nav-open {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.nav-toggle {
  display: none;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--control);
  border-radius: var(--r-btn);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--ink); }

/* --- shell -------------------------------------------------------------- */

.shell { display: flex; align-items: flex-start; }
.page { flex: 1; min-width: 0; max-width: 82rem; padding: var(--gutter); }
.page--narrow { max-width: 62rem; margin-inline: auto; }

.sidenav {
  width: 15rem;
  flex: none;
  padding: var(--gutter) 12px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  min-height: calc(100vh - 60px);
}
.sidenav h3 {
  margin: 18px 0 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.sidenav h3:first-child { margin-top: 0; }
.sidenav a {
  display: block;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.sidenav a:hover { background: var(--a-tint); color: var(--a-text); }
.sidenav form { margin-top: 18px; }

/* the till's tab strip — the same job as .sidenav, on a screen one hand wide.
   It sits inside .page, under the title, so it is a card and not a full band. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0 0 var(--gutter);
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-block);
}
.tabs a {
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-weight: 600;
  color: var(--ink);
}
.tabs a:hover { background: var(--a-tint); color: var(--a-text); }
.tabs form { margin-left: auto; }

/* --- type --------------------------------------------------------------- */

h1 { margin: 0 0 var(--gutter); font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }
h2 { margin: 28px 0 10px; font-size: 19px; line-height: 1.2; letter-spacing: -0.01em; font-weight: 700; }
h3 { margin: 20px 0 8px; font-size: 16px; font-weight: 700; }
p { margin: 0 0 12px; }
.muted, .empty { color: var(--muted); font-size: 14px; }
.empty { font-style: italic; }
.error { color: var(--down); font-weight: 600; }

/* --- table -------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--gutter);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  background: var(--sunken);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th { width: 1%; white-space: nowrap; font-weight: 600; color: var(--muted); }
td.muted { font-family: var(--font-mono); font-size: 12px; }

/* --- cards -------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--gutter);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--gutter);
}
.card > h2:first-child { margin-top: 0; }
.card-row {
  display: flex;
  gap: var(--gutter);
  flex-wrap: wrap;
  margin-bottom: var(--gutter);
}
.card-row > .card { flex: 1; min-width: 16rem; margin-bottom: 0; }

/* --- forms -------------------------------------------------------------- */

.stack { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.stack > div { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 24rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 12px; }
.fields > .span-2 { grid-column: 1 / -1; max-width: 36rem; }
.fields label { display: flex; flex-direction: column; gap: 4px; }
.fields textarea { width: 100%; min-height: 4.5rem; font: inherit; }
.claim-form:has(input[name="target_business_id"][value="new"]):not(:has(input[name="target_business_id"][value="new"]:checked)) .claim-legal { display: none; }
.fields .hint { font-size: 12px; color: var(--muted-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.record-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin: -8px 0 16px;
}
.pre-line { white-space: pre-line; }

label { font-size: 14px; color: var(--muted); }
input, select, textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--control);
  border-radius: var(--r-btn);
  background: var(--paper);
  color: var(--ink);
  max-width: 100%;
}
textarea { min-height: 4.5rem; resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
input[type="checkbox"] { accent-color: var(--a-dot); }
label > input[type="checkbox"] { margin-right: 4px; }

button {
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border: 1px solid var(--a-btn);
  border-radius: var(--r-btn);
  background: var(--a-btn);
  color: var(--a-btn-ink);
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
/* the quiet action: sign out, and anything else that is not the point of the screen */
button.muted {
  background: transparent;
  border-color: var(--control);
  color: var(--ink);
  font-size: 14px;
}
button.muted:hover { filter: none; border-color: var(--ink); }

/* --- notices ------------------------------------------------------------ */

.notice, .good {
  padding: 14px 16px;
  border-radius: var(--r-block);
  border: 1px solid var(--warn-line);
  background: var(--warn-tint);
  color: var(--ink);
}
.good { border-color: var(--ok-line); background: var(--ok-tint); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 12px; padding: 0; }
.tags li {
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--a-tint);
  color: var(--a-text);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.qr {
  display: inline-block;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}
.qr svg { display: block; width: 100%; max-width: 280px; height: auto; }

/* --- till: one hand, arm's length, so everything grows ------------------- */

[data-console="till"] { font-size: 18px; }
[data-console="till"] .page { max-width: 44rem; margin-inline: auto; }
[data-console="till"] input,
[data-console="till"] select,
[data-console="till"] button { font-size: 19px; padding: 14px 20px; }
[data-console="till"] button.muted { font-size: 16px; padding: 10px 16px; }

/* --- sign-in: one centred card, on every console ------------------------ */

.page--signin { max-width: 26rem; margin-inline: auto; padding-block: 24px; }
/* keep the title on the card's left edge, not the wide page's */
.page:has(> .page--signin) { max-width: 26rem; margin-inline: auto; padding-top: 48px; }
.page--signin form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--gutter);
  box-shadow: var(--shadow-card);
  width: 100%;
}
.page--signin .stack > div, .page--signin button { max-width: none; width: 100%; }

/* Records tables keep Open on screen. The other columns scroll inside the card. */
.records-scroll {
  max-width: 100%;
  overflow-x: auto;
}
.records-scroll table {
  overflow: visible;
}
.records-scroll td:last-child,
.records-scroll th:last-child {
  position: sticky;
  right: 0;
  background: var(--surface);
  box-shadow: -8px 0 8px -8px rgba(11, 31, 51, 0.35);
}
.records-scroll thead th:last-child { background: var(--sunken); }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .nav-toggle { display: inline-flex; align-items: center; }
  .sidenav {
    display: none;
    width: 100%;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav-open:checked ~ .shell > .sidenav { display: block; }
}
