/* Remote Control console: 42ITS house style (black, grey, one red, navy
   panels), tightened for a data-dense staff tool. */
:root {
  --black: #000;
  --red: #b01818;
  --red-hover: #d92a2a;
  --text: #9a9aa2;      /* a step lighter than the site's #7a7a7a: dense UI text */
  --heading: #fff;
  --slate: #5e6782;
  --navy: #0e172d;
  --navy-2: #131e3a;
  --line: rgba(255, 255, 255, .12);
  --ok: #22c55e;
  --warn: #f59e0b;
  --font-display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; background: var(--black); color: var(--text);
  font: 400 15px/1.55 var(--font-ui);
}
a { color: var(--heading); }
a:hover { color: var(--red-hover); }
:focus-visible { outline: 3px solid var(--red-hover); outline-offset: 2px; }
h1, h2, h3 { color: var(--heading); font-weight: 300; margin: 0; }
h1 { font: 200 clamp(1.6rem, 4vw, 2.2rem)/1.2 var(--font-display); }
h2 { font: 400 1.15rem/1.3 var(--font-ui); margin-bottom: .75rem; }
h3 { font: 500 .95rem/1.3 var(--font-ui); }
p { margin: 0 0 .75rem; }
.muted { color: var(--slate); }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* ---------- header */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 32px; width: auto; }
.brand span { color: var(--heading); font: 200 1.25rem/1 var(--font-display); }
.top nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.top nav a {
  padding: 6px 12px; border-radius: 30px; text-decoration: none; color: var(--text);
  font-weight: 600; font-size: .9rem;
}
.top nav a[aria-current="page"] { color: #fff; background: var(--red); }
.badge {
  display: inline-block; min-width: 1.4em; padding: 0 .4em; margin-left: .35em; border-radius: 1em;
  background: var(--warn); color: #000; font-size: .75rem; line-height: 1.4; text-align: center;
}
.who { display: flex; align-items: center; gap: 12px; font-size: .9rem; }

main { padding: 24px 16px 64px; max-width: 1500px; margin: 0 auto; }

/* ---------- panels, forms, buttons */
.panel {
  background: var(--navy); border: 1px solid var(--line); border-radius: 6px;
  padding: 16px; margin-bottom: 16px;
}
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1; }
.spread { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
label.field { display: grid; gap: 4px; color: var(--heading); font-size: .85rem; font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--heading); background: var(--black);
  border: 1px solid var(--line); border-radius: 4px; padding: 7px 10px; min-width: 0; max-width: 100%;
}
textarea { width: 100%; min-height: 4.5em; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--red); outline: none; }
.btn {
  display: inline-block; padding: 8px 18px; border-radius: 30px; border: 1px solid transparent;
  background: var(--red); color: #fff; font: 600 .9rem/1.2 var(--font-ui); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--red-hover); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.3); color: var(--text); }
.btn.ghost:hover { border-color: var(--red); color: var(--red-hover); }
.btn.small { padding: 4px 12px; font-size: .8rem; }
.link { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; cursor: pointer; font: inherit; }
.link:hover { color: var(--red-hover); }
.danger:hover { color: var(--red-hover); border-color: var(--red); }

/* billable toggle: a checkbox that reads as a switch, with a "£" marker */
.bill { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--heading); white-space: nowrap; }
.bill input { appearance: none; width: 38px; height: 22px; border-radius: 11px; background: #2a2f3d; position: relative; padding: 0; border: 0; cursor: pointer; flex: none; }
.bill input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #c6c6cc; transition: left .15s; }
.bill input:checked { background: var(--red); }
.bill input:checked::after { left: 19px; background: #fff; }
.bill .tag { font-size: .7rem; color: var(--warn); border: 1px solid var(--warn); border-radius: 3px; padding: 0 4px; }

/* ---------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 500; color: var(--slate); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--navy-2); }
td .name { color: var(--heading); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .75rem; border: 1px solid var(--line); }
.pill.its { border-color: var(--red); color: #f2b8b8; }
.pill.live { border-color: #2957cb; color: #b7c7f2; }
.pill.on { border-color: var(--ok); color: var(--ok); }
.pill.off { color: var(--slate); }
.state-on { color: var(--ok); }
.state-off { color: var(--warn); }

/* ---------- customer page */
.cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); }
.cat-head { margin: 16px 0 4px; color: var(--slate); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 2px 10px; border: 1px solid var(--line); border-radius: 12px; font-size: .85rem; }
details.assign summary { cursor: pointer; color: var(--text); font-size: .85rem; }
details.assign[open] { background: var(--black); border: 1px solid var(--line); border-radius: 4px; padding: 8px; }
details.assign label { display: flex; gap: 6px; align-items: center; font-size: .85rem; }

/* ---------- sign in */
.auth { max-width: 420px; margin: 8vh auto 0; padding: 0 16px; }
.auth .panel { padding: 24px; display: grid; gap: 14px; }
.auth h1 { margin-bottom: 4px; }
.qr { background: #fff; padding: 12px; border-radius: 6px; width: max-content; }
.secret { font: 500 1rem/1.4 ui-monospace, Consolas, monospace; color: var(--heading); word-break: break-all; }

/* ---------- messages */
.error { color: #ff8a8a; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  background: var(--navy-2); border: 1px solid var(--line); color: var(--heading);
  padding: 10px 18px; border-radius: 30px; box-shadow: 0 6px 24px rgb(0 0 0 / .5); max-width: calc(100% - 32px);
}
.toast.bad { border-color: var(--red); }
.empty { padding: 24px; text-align: center; color: var(--slate); }

@media (max-width: 767px) {
  .who .name { display: none; }
  main { padding-top: 16px; }
}
/* Machine tables repeat per category: fixed columns keep them aligned. */
table.machines { table-layout: fixed; min-width: 760px; }
table.machines th:nth-child(1) { width: 23%; }
table.machines th:nth-child(2) { width: 15%; }
table.machines th:nth-child(3) { width: 10%; }
table.machines th:nth-child(4) { width: 19%; }
table.machines th:nth-child(5) { width: 15%; }
table.machines td:last-child .row { flex-wrap: nowrap; justify-content: flex-end; }
table.machines select { width: 100%; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #3a3f4d; margin-right: 8px; vertical-align: middle; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgb(34 197 94 / .2); }
pre.secret { margin: 0 0 8px; white-space: pre-wrap; }
