:root {
  --ink: #0d1726;
  --steel: #8ea3bd;
  --line: #d7dee8;
  --bg: #f3f5f8;
  --text: #172233;
  --muted: #5d6b80;
  /* --accent: the colour of links, buttons, tabs and focus rings. It's the same for every tenant.
     Change it here. To mark a sandbox or a special project later, override it on <body>,
     e.g. body.env-sandbox { --accent: #7c3aed; } */
  --accent: #2f6fdb;
  /* --brand: the tenant's own colour (Tenants.BrandColor), set per page on <body>.
     Used only for the line under the top bar and the tenant badge on the sign-in page. */
  --brand: #2f6fdb;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
.muted { color: var(--muted); }

/* ---------- Wordmark ---------- */
.wordmark { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 600; letter-spacing: 0.02em; color: #fff; text-decoration: none; }
.wordmark .mark { width: 34px; height: 34px; }
.wordmark.small { font-size: 18px; gap: 10px; }
.wordmark.small .mark { width: 26px; height: 26px; }

/* ---------- Login page ---------- */
body.login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  min-height: 100vh;
}
.brand {
  position: relative; overflow: hidden;
  background: var(--ink); color: #fff;
  padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.brand svg.wall { position: absolute; inset: 0; width: 100%; height: 100%; }
.brand > *:not(svg) { position: relative; }
.brand h1 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.15; font-weight: 600; margin: 0 0 14px; max-width: 14em; }
.brand p { color: var(--steel); font-size: 16px; line-height: 1.5; margin: 0; max-width: 30em; }
.brand .foot { color: var(--steel); font-size: 13px; }

.panel {
  background: #fff;
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px 44px;
  border-left: 1px solid var(--line);
}
.tenant { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.tenant .badge {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 18px;
}
.tenant .name { font-size: 17px; font-weight: 600; }
.tenant .host { font-size: 13px; color: var(--muted); }
.panel h2 { font-size: 24px; font-weight: 600; margin: 0 0 6px; }
.panel .sub { color: var(--muted); margin: 0 0 26px; font-size: 15px; }
.panel label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.panel input[type=text], .panel input[type=password] {
  width: 100%; font: inherit; font-size: 16px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fbfcfd; color: var(--text);
}
.panel input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); background: #fff; }
.field { margin-bottom: 18px; }
.row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 24px; font-size: 14px; }
.row label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; color: var(--muted); }
.panel button[type=submit] {
  width: 100%; font: inherit; font-size: 16px; font-weight: 600;
  padding: 13px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; cursor: pointer;
}
.panel button[type=submit]:hover { filter: brightness(0.92); }
.notice {
  margin-top: 18px; padding: 12px 14px; border-radius: 8px;
  background: #fdf1ef; border: 1px solid #f2c8c0; color: #7a2617; font-size: 14px; line-height: 1.45;
}
.help { margin-top: 28px; font-size: 13px; color: var(--muted); line-height: 1.5; }

@media (max-width: 820px) {
  body.login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .brand { padding: 22px 24px; }
  .brand .pitch, .brand .foot { display: none; }
  .panel { border-left: 0; padding: 32px 24px 40px; justify-content: flex-start; }
}

/* ---------- Signed-in pages ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--ink); color: #fff;
  padding: 12px 20px;
  border-bottom: 4px solid var(--brand);
}
.topbar .site-name { color: var(--steel); font-size: 15px; }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--steel); text-decoration: underline; cursor: pointer; }
.content { max-width: 960px; margin: 0 auto; padding: 32px 20px; }
.content h1 { font-size: 26px; font-weight: 600; margin: 0 0 8px; }
.choice { margin-bottom: 10px; }

/* ---------- Navigation and page structure ---------- */
.nav { display: flex; gap: 16px; }
.nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: 15px; }
.nav a:hover { text-decoration: underline; }
.nav a.up { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-row:target { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.cw-row { scroll-margin-top: 16px; }
.content a { color: var(--accent); }
.content h2 { font-size: 19px; font-weight: 600; margin: 32px 0 12px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1, .page-head h2 { margin-bottom: 12px; }
.crumbs { margin: 0 0 6px; font-size: 14px; color: var(--muted); }

/* ---------- Buttons ---------- */
.button, .content button[type=submit] {
  display: inline-block; font: inherit; font-size: 15px; font-weight: 600;
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; text-decoration: none; cursor: pointer;
}
.content a.button { color: #fff; }
.button.secondary, .content a.button.secondary, .content button.button.secondary { background: #fff; color: var(--accent); }
.button:hover { filter: brightness(0.94); }

/* ---------- Tables ---------- */
table.grid { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.grid th, table.grid td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 15px; vertical-align: top; }
table.grid th { background: #f7f9fb; font-size: 13px; color: var(--muted); font-weight: 600; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid .num { text-align: right; }
table.grid tr.inactive td { color: var(--muted); }
.status { font-size: 13px; padding: 2px 8px; border-radius: 10px; background: #eef1f5; }
.status-active { background: #e4f4ea; color: #1d6b3a; }
.status-onhold { background: #fdf3dc; color: #7a5a10; }

/* ---------- Facts list ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 24px; margin: 8px 0 0; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 15px; }

/* ---------- Forms ---------- */
.form { max-width: 720px; }
.form fieldset { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 16px 18px 6px; margin: 0 0 18px; }
.form legend { font-weight: 600; padding: 0 6px; }
.form .field { margin-bottom: 14px; flex: 1; }
.form .field.narrow { flex: 0 0 110px; }
.form .field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.form label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin-bottom: 14px; }
.form input:not([type=checkbox]):not([type=radio]), .form select {
  width: 100%; font: inherit; font-size: 15px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 6px; background: #fbfcfd;
}
.form input:focus, .form select:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: #fff; }
.form .mono { font-family: Consolas, "Cascadia Mono", monospace; }
.form .error { display: block; color: #a3261a; font-size: 13px; margin-top: 4px; }
.form .hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.form .actions { display: flex; gap: 10px; margin-top: 6px; }
.form .notice:empty, .validation-summary-valid { display: none; }
.form .notice ul { margin: 0; padding-left: 18px; }

/* ---------- Units, lots, labels and imports ---------- */
.buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.button.danger, .content button.button.danger { background: #fff; color: #a3261a; border-color: #e3b1a9; margin-left: auto; }
.content button[disabled] { opacity: 0.5; cursor: default; }
.empty { padding: 18px; background: #fff; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.small { font-size: 13px; }
.done { margin: 0 0 18px; padding: 12px 14px; border-radius: 8px; background: #e4f4ea; border: 1px solid #b9dfc6; color: #1d4f2e; font-size: 14px; }
.notice.soft { background: #fdf8ec; border-color: #eedcae; color: #5e4710; }
.notice .problems { margin: 8px 0 0; padding-left: 18px; }
.form.wide { max-width: none; }
.form .actions { flex-wrap: wrap; align-items: center; margin-top: 16px; }
.form textarea { width: 100%; font-size: 14px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfd; resize: vertical; }
.form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: #fff; }
.form input[type=file] { background: #fff; padding: 7px; }
.form label.check .hint { font-weight: 400; }
.serials { line-height: 1.9; }
.serials code { display: inline-block; margin: 0 6px 0 0; padding: 1px 6px; background: #f3f5f8; border-radius: 4px; font-size: 13px; letter-spacing: 0.03em; }
.serials code.void { text-decoration: line-through; color: var(--muted); }
table.grid code { font-size: 13px; letter-spacing: 0.03em; }
h1 .status { vertical-align: middle; font-size: 13px; font-weight: 600; }

/* ---------- QR card ---------- */
.qr-open { all: unset; cursor: pointer; display: inline-block; padding: 1px 6px; border-radius: 4px; background: #f3f5f8;
           font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; letter-spacing: 0.03em;
           color: var(--accent); text-decoration: underline; text-underline-offset: 2px; margin: 0 6px 4px 0; }
.qr-open:hover, .qr-open:focus-visible { background: #fde9df; outline: none; }
.qr-open.void { color: var(--muted); text-decoration: line-through; }
.qr-card { border: none; border-radius: 12px; padding: 0; box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35); max-width: 92vw; }
.qr-card::backdrop { background: rgba(15, 23, 42, 0.55); }
.qr-body { padding: 24px 28px 20px; text-align: center; width: 320px; max-width: 100%; box-sizing: border-box; }
.qr-image { width: 260px; max-width: 100%; margin: 0 auto 12px; }
.qr-image svg { display: block; width: 100%; height: auto; }
.qr-title { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 24px; font-weight: 700; letter-spacing: 0.06em; }
.qr-detail { color: var(--muted); font-size: 14px; margin-top: 4px; min-height: 1em; }
.qr-link { display: block; margin-top: 10px; font-size: 12px; word-break: break-all; color: var(--muted); }
.qr-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

/* ---------- Scanned label page (phone first) ---------- */
.scan { max-width: 520px; margin: 0 auto; }
.scan-kind { margin: 0; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.scan-code { margin: 4px 0 2px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 34px; letter-spacing: 0.06em; }
.scan-mark { margin: 0 0 18px; font-size: 20px; font-weight: 600; }
.scan-name { margin: 4px 0 2px; font-size: 36px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.scan-subcode { margin: 0 0 18px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 22px; font-weight: 600; letter-spacing: 0.06em; }
.scan-head { margin: 0 0 18px; }
.scan-head .scan-subcode, .scan-head .scan-code { margin-bottom: 6px; }
.scan-head p:last-child { margin-bottom: 0; }
.scan .facts { grid-template-columns: 1fr 1fr; }

/* ---------- Name menu (top right) ---------- */
.topbar { flex-wrap: nowrap; }
.user-menu { margin-left: auto; position: relative; min-width: 0; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 6px 8px; border-radius: 6px; font-size: 14px; color: #fff; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { background: rgba(255, 255, 255, 0.1); }
.user-menu summary svg { width: 12px; height: 12px; flex: none; color: var(--steel); }
.user-menu .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 190px; padding: 6px;
                   background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18); }
.user-menu .menu a, .user-menu .menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 6px;
                   font: inherit; font-size: 15px; color: var(--text); text-decoration: none; background: none; border: 0; cursor: pointer; }
.user-menu .menu a:hover, .user-menu .menu button:hover { background: var(--bg); }
.user-menu .menu form { margin: 0; }
@media (max-width: 560px) {
  .topbar { gap: 12px; padding: 10px 14px; }
  .topbar .site-name { display: none; }
}
.form + .form { margin-top: 32px; }

/* ---------- Unit page: stages and buttons ---------- */
.scan-result { margin: 0 0 18px; padding: 16px 18px; border-radius: 10px; font-size: 22px; font-weight: 700; line-height: 1.25; }
.scan-result.ok { background: #e4f4ea; color: #155c2f; border: 1px solid #b9dfc6; }
.scan-result.same { background: #fdf8ec; color: #5e4710; border: 1px solid #eedcae; }
.scan-result.no { background: #fbeae7; color: #8a2216; border: 1px solid #efc2ba; }
.stages { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stages li { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.stages li.done { border-color: #9fd3b2; background: #f1faf4; }
.stages .stage-name { display: block; font-weight: 700; font-size: 15px; }
.stages li.done .stage-name::before { content: "✓ "; color: #1f7a3f; }
.stages .stage-by { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.flag { display: inline-block; margin: 4px 4px 0 0; padding: 1px 7px; border-radius: 999px; background: #fdf1d8; color: #7a4f05; font-size: 11.5px; font-weight: 600; }
form.track { margin: 0 0 12px; }
.big-button, .content button.big-button { display: block; width: 100%; padding: 18px; border: 0; border-radius: 12px; background: var(--accent); color: #fff;
              font: inherit; font-size: 22px; font-weight: 700; cursor: pointer; }
.big-button:disabled { opacity: 0.6; }
.wide-button { display: block; width: 100%; padding: 12px; font-size: 16px; }
.button.danger-solid, .content button.button.danger-solid { background: #b3261a; border-color: #b3261a; color: #fff; }
.scan-field { display: block; margin: 0 0 12px; font-weight: 600; font-size: 14px; }
.scan-field input, .scan-field select { display: block; width: 100%; margin-top: 6px; padding: 12px; font: inherit; font-size: 18px; font-weight: 400;
              border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.crate-pick { border: 0; padding: 0; margin: 0 0 6px; }
.crate-pick legend { font-weight: 700; margin-bottom: 8px; }
.crate-option { display: flex; gap: 12px; align-items: center; padding: 12px; margin-bottom: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.crate-option input { width: 22px; height: 22px; flex: none; }
.crate-option small { display: block; color: var(--muted); font-size: 13px; }
.crate-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.undo { margin: 8px 0 20px; }
.undo summary { cursor: pointer; color: #a3261a; font-weight: 600; padding: 8px 0; }
.scan-done { font-size: 18px; font-weight: 600; color: #1f7a3f; }
.center { text-align: center; }
.history-head { font-size: 18px; margin: 24px 0 8px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.history li.unmark strong { color: #a3261a; }
@media (max-width: 480px) {
  .stages li { padding: 8px 9px; }
  .stages .stage-name { font-size: 14px; }
}
.qr-open.at-built { background: #e8f1fd; }
.qr-open.at-crated { background: #fdf3df; }
.qr-open.at-installed { background: #e4f4ea; }
.stage-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: middle; }
a.wordmark { width: fit-content; border-radius: 8px; }
a.wordmark:hover { opacity: 0.85; }
a.wordmark:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

/* ---------- Camera scanner ---------- */
.scan-title { font-size: 22px; margin: 0 0 12px; }
.camera { position: relative; background: #0d1726; border-radius: 14px; overflow: hidden; aspect-ratio: 1 / 1; margin-bottom: 18px; }
.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera .aim { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, 0.85); border-radius: 14px; box-shadow: 0 0 0 999px rgba(13, 23, 38, 0.35); }
.camera.hit .aim { border-color: #3ddc84; }
.camera-note { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 10px 14px; color: #fff; font-size: 15px; text-align: center;
               background: linear-gradient(transparent, rgba(13, 23, 38, 0.85)); }
.typed .scan-field input { letter-spacing: 0.04em; }
.next-actions { margin: 0 0 14px; }
.add-crate { margin: 0; }
.add-crate > summary { list-style: none; cursor: pointer; }
.add-crate > summary::-webkit-details-marker { display: none; }
.add-crate[open] > summary { margin-bottom: 12px; }
a.big-button, .content a.big-button { text-align: center; text-decoration: none; box-sizing: border-box; color: #fff; }
.wide-button { box-sizing: border-box; text-align: center; }
a.wide-button, summary.wide-button { text-decoration: none; }
.next-actions { display: flex; flex-direction: column; gap: 12px; }
.next-actions form.track { margin: 0; }

/* ---------- Project page: lots ---------- */
.nowrap { white-space: nowrap; }
.progress { display: inline-block; vertical-align: middle; width: 90px; height: 8px; border-radius: 999px; background: #e6e9ee; overflow: hidden; }
.progress span { display: block; height: 100%; background: #2f9e5b; border-radius: 999px; }
.progress-label { display: inline-block; min-width: 3.2em; margin-left: 8px; text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.pick-menu { position: relative; }
.pick-menu > summary { list-style: none; cursor: pointer; }
.pick-menu > summary::-webkit-details-marker { display: none; }
.pick-menu .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px; padding: 8px; background: #fff;
                   border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18); }
.pick-menu .menu p { margin: 2px 8px 6px; }
.pick-menu .menu a { display: block; padding: 9px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.pick-menu .menu a:hover { background: var(--bg); }

/* ---------- Lot units and serials ---------- */
table.grid td.all { color: #1f7a3f; font-weight: 700; }
table.grid tfoot th { border-top: 2px solid var(--line); background: #f7f8fa; font-weight: 700; }
.tip { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
a.tip { cursor: pointer; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; margin: 8px 0 18px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 16px; margin-bottom: -1px; border: 1px solid transparent; border-radius: 8px 8px 0 0;
          color: var(--muted); font-weight: 600; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); background: #fff; border-color: var(--line); border-bottom-color: #fff; }
.scan-serial { margin: 0 0 4px; color: var(--muted); font-size: 15px; }

/* ---------- Lot Crates tab: a row per crate, units wrap in aligned columns ---------- */
.cw { display: flex; flex-direction: column; }
.cw-row { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cw-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.cw-cell, .content a.cw-cell { display: block; box-sizing: border-box; min-width: 0; padding: 5px 8px; border: 1px solid #c9d0da; border-radius: 6px;
           background: #fff; color: var(--text); text-decoration: none; line-height: 1.3; position: relative; }
a.cw-cell:hover { border-color: var(--accent); }
.cw-cell b { display: block; color: var(--text); font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-cell span { display: block; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; }
.cw .cw-cell.cw-crate { width: auto; background: #eef1f5; border-color: transparent; }
.cw .cw-cell.cw-loose { background: transparent; border: 1px dashed #b9c1cc; }
.cw-loose span { font-family: inherit; }
.cw .cw-cell.cw-plan { background: transparent; border-style: dashed; }
.cw-plan b { color: var(--muted); }
.cw-plan span { font-family: inherit; font-style: italic; }
.cw .cw-cell.cw-installed { background: #e4f4ea; border-color: #9fd3b2; }
.cw .cw-cell.cw-other { background: transparent; border-color: #e1e5ea; color: #9aa3ae; }
.cw-other b, .cw-other span { color: #9aa3ae; }
.cw-extra::after { content: "+"; position: absolute; top: 2px; right: 6px; font-size: 12px; font-weight: 700; color: #b26b00; }
.cw-key { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.cw-key i { display: inline-block; width: 18px; height: 12px; margin-right: 6px; vertical-align: -1px; border-radius: 3px; border: 1px solid #c9d0da; background: #fff; }
.cw-key i.k-installed { background: #e4f4ea; border-color: #9fd3b2; }
.cw-key i.k-plan { background: transparent; border-style: dashed; }
.cw-key i.k-other { background: transparent; border-color: #e1e5ea; }
.cw-key .k-extra { color: #b26b00; }
@media (max-width: 560px) {
  .cw-row { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Fill this crate ---------- */
.fill-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.fill-name { margin: 2px 0; font-size: 28px; }
.fill-done, .content a.fill-done { padding: 10px 22px; font-size: 16px; }
.fill-camera { aspect-ratio: 4 / 3; }
.camera.miss .aim { border-color: #ff6b5a; }
.camera.seen .aim { border-color: #f2c14e; }
.fill-confirm { display: flex; flex-direction: column; gap: 10px; margin: -6px 0 16px; }
.fill-confirm[hidden] { display: none; }
.fill-lines li { display: flex; gap: 8px; align-items: baseline; }
.fill-lines .tick { display: inline-block; width: 1.2em; color: #1f7a3f; font-weight: 700; }
.fill-lines li.open strong { color: var(--muted); }
#session li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
#session li.undone span { text-decoration: line-through; color: var(--muted); }
.link-button { all: unset; cursor: pointer; color: #a3261a; font-weight: 600; font-size: 14px; }
.fill-start { margin: 4px 0 18px; }

/* ---------- Project performance ---------- */
.perf-filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0; }
.perf-filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
.tabs.perf-range { margin: 0; border-bottom: 0; }
.tabs.perf-range a { border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px; margin: 0; }
.tabs.perf-range a.active { border-color: var(--accent); color: var(--accent); }
.perf-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 8px 0 20px; }
.perf-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.perf-card span { display: block; color: var(--muted); font-size: 13px; }
.perf-card strong { display: block; font-size: 28px; margin: 2px 0; }
.perf-card small { color: var(--muted); font-size: 13px; }
.perf-chart { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 6px; }
.perf-chart svg { display: block; width: 100%; height: auto; }
.perf-chart .grid-line { stroke: #e8ebef; stroke-width: 1; }
.perf-chart .axis { fill: #7a8593; font-size: 11px; }
.perf-chart .axis.weekend { fill: #b0b7c1; }
.perf-chart .bar-built { fill: #3b78c4; }
.perf-chart .bar-installed { fill: #2f9e5b; }
.perf-chart .hover-band { fill: transparent; }
.perf-chart g:hover .hover-band { fill: #f2f5f9; }
.perf-legend { display: flex; gap: 18px; align-items: center; font-size: 13px; margin-bottom: 6px; flex-wrap: wrap; }
.perf-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.perf-legend .k-built { background: #3b78c4; }
.perf-legend .k-installed { background: #2f9e5b; }
.perf-legend .muted { margin-left: auto; }
.perf-avg { margin: 12px 0 18px; font-size: 14px; }
.perf-avg strong { color: var(--text); }
.perf-table tbody tr.inactive td { color: #a3abb5; }
.cw-cell .cw-name, .content .cw-cell a.cw-name { display: block; color: inherit; text-decoration: none; }
.cw-cell a.cw-name:hover b { text-decoration: underline; }
.cw .cw-cell.cw-unit:hover { border-color: var(--accent); }
.cw-qr { all: unset; cursor: pointer; display: inline-block; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px;
         letter-spacing: 0.02em; color: var(--accent); text-decoration: underline dotted; text-underline-offset: 2px; }
.cw-qr:hover, .cw-qr:focus-visible { text-decoration: underline; }
.cw-other .cw-qr { color: #9aa3ae; }

/* ---------- Phone setup ---------- */
.setup { max-width: 620px; }
section.check { margin: 16px 0; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.check-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
section.check h2 { margin: 0; font-size: 18px; }
.check-msg { margin: 8px 0 12px; line-height: 1.45; }
.check-state { padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #eef1f5; color: var(--muted); white-space: nowrap; }
.check-state[data-state=ok] { background: #e4f4ea; color: #155c2f; }
.check-state[data-state=warn], .check-state[data-state=busy] { background: #fdf8ec; color: #5e4710; }
.check-state[data-state=blocked] { background: #fbeae7; color: #8a2216; }
.check-video { display: block; width: 100%; max-height: 260px; margin: 0 0 12px; border-radius: 8px; background: #000; object-fit: cover; }
.check-video[hidden] { display: none; }
.fix h2 { font-size: 18px; margin: 24px 0 4px; }
.fix-os { margin: 10px 0; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.fix-os summary { cursor: pointer; font-weight: 600; }
.fix-os h3 { margin: 12px 0 4px; font-size: 15px; }
.fix-os ol { margin: 0; padding-left: 20px; line-height: 1.5; }
.fix-os li { margin: 4px 0; }
.setup-device { margin-top: 24px; word-break: break-word; }
.scan-warn { margin: 0 0 18px; padding: 12px 14px; border-radius: 10px; background: #fdf8ec; color: #5e4710; border: 1px solid #eedcae; line-height: 1.4; }
.scan-help { margin: 14px 0 0; text-align: center; font-size: 14px; }

/* ---------- Print labels menu ---------- */
.print-menu .menu { width: min(360px, calc(100vw - 32px)); padding: 14px; }
.print-form label { display: block; margin: 0 0 12px; font-weight: 600; font-size: 14px; }
.print-form select, .print-form input[type=number], .print-form textarea { display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 400; }
.print-form input[type=number] { max-width: 100px; }
.print-form textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.print-form .hint { display: block; margin-top: 3px; font-weight: 400; }
.print-form .check-line { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.print-form .check-line input { margin: 0; }
.print-form .button { width: 100%; }
.print-form > p.hint { margin: 10px 0 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Data for Excel ---------- */
.data-page { max-width: 820px; }
.data-page .lede { font-size: 16px; line-height: 1.5; }
.data-step { margin: 22px 0; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.data-step h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 19px; }
.data-step h3 { margin: 16px 0 4px; font-size: 16px; }
.data-step p { line-height: 1.5; }
.step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 14px; }
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-row code { flex: 1 1 280px; min-width: 0; padding: 9px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; font-size: 13px; }
.new-key { margin: 12px 0; padding: 12px 14px; background: #e4f4ea; border: 1px solid #b9dfc6; border-radius: 10px; }
.new-key p { margin: 0 0 8px; }
.key-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.key-form input { flex: 1 1 240px; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.grid.keys tr.revoked td { color: var(--muted); }
.grid.keys form { margin: 0; }
.button.small { padding: 5px 10px; font-size: 13px; }
.feed-filters { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 6px; }
.feed-filters label { font-weight: 600; font-size: 14px; }
.feed-filters select { display: block; margin-top: 4px; font: inherit; font-weight: 400; min-width: 200px; }
.feed { padding: 4px 0 8px; border-top: 1px solid var(--line); margin-top: 12px; }
.excel-steps li, .pivot-ideas li { margin: 6px 0; line-height: 1.5; }

/* ---------- Users, roles, companies ---------- */
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.brand-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .button { margin-left: 6px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ok-badge { background: #e4f4ea; color: #155c2f; }
.info-badge { background: #e8f1fd; color: #1d4f99; }
.warn-badge { background: #fdf3df; color: #7a4b00; }
.muted-badge { background: #eef1f5; color: var(--muted); }
.grid.users tr.inactive td { color: var(--muted); }
.grid.users code { font-size: 13px; }
.secrets { margin: 0 0 22px; padding: 18px 20px; background: #e4f4ea; border: 1px solid #b9dfc6; border-radius: 10px; max-width: 640px; }
.secrets h2 { margin: 0 0 12px; font-size: 18px; }
.secret-list { display: grid; gap: 8px; margin: 0 0 10px; }
.secret-list > div { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 10px; }
.secret-list dt { color: #2c5e3d; font-size: 14px; }
.secret-list dd { margin: 0; }
.secret-list code { font-size: 15px; }
.secret-list code.big { font-size: 22px; font-weight: 700; letter-spacing: 0.06em; padding: 2px 8px; background: #fff; border-radius: 6px; }
.role-checks label.check, .kind-choices label.check { margin-bottom: 10px; }
.kind-choices { display: flex; gap: 22px; flex-wrap: wrap; }
.kind-choices input { margin-top: 3px; }
.sign-in-tools { margin-top: 8px; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.sign-in-tools h2 { margin: 0 0 8px; font-size: 17px; }
.reset-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin: 10px 0 4px; }
.reset-form label { margin: 0; }
.reset-form select { width: auto; margin-top: 4px; }
.inline-form { display: inline; }
.warn-text { color: #8a2216; font-weight: 600; }
.danger-zone { display: flex; gap: 12px; align-items: center; margin-top: 18px; }
.danger-zone .button.danger { margin-left: 0; }
.table-wrap { overflow-x: auto; }
.role-matrix th, .role-matrix td { white-space: nowrap; }
.role-matrix td.center { color: #155c2f; font-weight: 700; }
.role-matrix .group-row th { background: var(--bg); text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.priv-group { margin: 10px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.welcome { max-width: 620px; }
.welcome .lede { font-size: 16px; line-height: 1.5; }
