/* Jeep Rail Earth App — dark, big-button, gloves-on UI */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  /* The phone shell draws edge-to-edge and the document is viewport-fit=cover,
     so the strip under the status bar and the strip over the gesture bar
     belong to this page. Everything that sits against a screen edge pads
     itself by these. A desktop browser reports 0 and nothing moves. */
  --sa-top: env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
  --sa-left: env(safe-area-inset-left, 0px);
  --sa-right: env(safe-area-inset-right, 0px);

  --bg: #0b0f0c;
  --panel: #141a15;
  --panel2: #1b231c;
  --line: #2a352c;
  --text: #eef3ee;
  --dim: #93a396;
  --green: #21c15a;
  --green-dark: #157a3a;
  --red: #e5433c;
  --amber: #e8a13a;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
.wrap { max-width: 900px; margin: 0 auto; padding: 16px; }
.phone { max-width: 480px; }

/* Header — matches the Jeep Rail logo: dark heavy caps on white,
   green band through the letters, sleeper bar, tagline */
header.app {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 4px solid var(--green);
  background: #fff;
}
header.app .role { font-size: 13px; }
header.app .role a { color: #157a3a; font-weight: 700; }
.brand { line-height: 1; }
.wordmark {
  font-family: "Arial Narrow", "Helvetica Neue", Impact, sans-serif;
  font-weight: 900; font-size: 30px; letter-spacing: 0; font-stretch: condensed;
  text-transform: uppercase;
  background: linear-gradient(180deg, #3b3b3b 0 42%, #157a34 42% 58%, #3b3b3b 58% 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  display: inline-block; line-height: 1;
}
.brand .ctx { color: #9aa39b; font-weight: 700; font-size: 14px; vertical-align: 4px; }
/* track sleeper bar under the wordmark */
.brand .sleepers {
  height: 5px; width: 150px; margin-top: 4px;
  background: repeating-linear-gradient(90deg, #3b3b3b 0 24px, #fff 24px 28px);
  border-radius: 1px;
}
.brand .tag {
  display: block; font-size: 10px; letter-spacing: 1.5px; font-weight: 800; margin-top: 4px;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
}
.brand .tag b { color: #3b3b3b; } .brand .tag span { color: #21a94d; }
header.app .role { color: var(--dim); font-size: 13px; }
a { color: var(--green); text-decoration: none; }

.acct-bar { background: #060907; border-bottom: 1px solid var(--line); }
.acct-bar select { max-width: 260px; }

/* nav tabs */
.tabs { display: flex; gap: 6px; padding: 10px 16px 0; max-width: 900px; margin: 0 auto; flex-wrap: wrap; }
.tabs button {
  border: 1px solid var(--line); background: var(--panel); color: var(--dim);
  border-radius: 10px 10px 0 0; padding: 10px 16px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.tabs button.on { background: var(--panel2); color: var(--text); border-bottom-color: var(--panel2); }

/* login */
.login-users { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.login-users button {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 12px; padding: 16px 10px; font-weight: 800; font-size: 16px; cursor: pointer;
}
.login-users button.on { border-color: var(--green); background: #0e2b18; }
.login-users button small { display: block; color: var(--dim); font-weight: 400; font-size: 12px; margin-top: 3px; }

/* isolation tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; }
.tile:hover { background: var(--panel2); }
.tile .ref { font-weight: 800; font-size: 16px; }
.tile .sub { color: var(--dim); font-size: 12px; margin: 4px 0 8px; }
.tile .stat { font-size: 13px; font-weight: 700; }
.tile.red { border-color: var(--red); }
.tile.green { border-color: var(--green); }

/* offline */
.offline-pill {
  font-size: 11px; font-weight: 800; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); color: var(--dim); background: var(--panel); white-space: nowrap;
}
.offline-pill.off { border-color: var(--amber); color: var(--amber); }
.queued-note { background: #3a2a10; border: 1px solid var(--amber); color: var(--amber);
  border-radius: 10px; padding: 10px; font-size: 13px; font-weight: 700; margin-bottom: 10px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 40; display: none;
  align-items: flex-end; justify-content: center; }
.modal-bg.show { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px 16px 0 0;
  padding: 18px; width: 100%; max-width: 480px; }
.modal h3 { margin-bottom: 10px; font-size: 17px; }

.photo-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.badge-forced { background: #3a1210; color: var(--red); border: 1px solid var(--red);
  font-size: 10px; font-weight: 800; padding: 3px 7px; border-radius: 999px; }
.badge-manual { background: #3a2a10; color: var(--amber); border: 1px solid var(--amber);
  font-size: 10px; font-weight: 800; padding: 3px 7px; border-radius: 999px; }
.badge-q { background: #3a1210; color: var(--red); border: 1px solid var(--red);
  font-size: 10px; font-weight: 800; padding: 3px 7px; border-radius: 999px; }

table.fleet { width: 100%; border-collapse: collapse; font-size: 13px; }
table.fleet th, table.fleet td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.fleet th { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }

h1 { font-size: 22px; margin: 18px 0 10px; }
h2 { font-size: 15px; margin: 18px 0 8px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }

.btn {
  display: inline-block; border: 0; border-radius: 10px; cursor: pointer;
  font-size: 17px; font-weight: 700; padding: 14px 20px; color: #fff;
  background: var(--panel2); width: 100%; text-align: center;
}
.btn.green { background: var(--green); color: #04160a; }
.btn.red { background: var(--red); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--dim); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.big { font-size: 20px; padding: 20px; }

input, select {
  width: 100%; padding: 13px; font-size: 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  margin-bottom: 10px;
}
label { font-size: 13px; color: var(--dim); display: block; margin-bottom: 4px; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* counters */
.counts { display: flex; gap: 10px; margin-bottom: 14px; }
.count {
  flex: 1; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; text-align: center;
}
.count .n { font-size: 34px; font-weight: 800; }
.count .l { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
.count.out .n { color: var(--red); }
.count.ok .n { color: var(--green); }

.banner {
  border-radius: 12px; padding: 16px; font-weight: 800; font-size: 17px;
  margin-bottom: 14px; text-align: center;
}
.banner.red { background: #3a1210; border: 2px solid var(--red); color: #ffb3af; }
.banner.green { background: #0e2b18; border: 2px solid var(--green); color: #9ff0bb; }
.banner.grey { background: var(--panel); border: 1px solid var(--line); color: var(--dim); }

/* earth cards */
.earth {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; margin-bottom: 10px; gap: 10px;
}
.earth .serial { font-weight: 800; font-size: 18px; font-family: ui-monospace, Menlo, monospace; }
.earth .meta { color: var(--dim); font-size: 13px; }
.earth .pill {
  font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
}
.pill.issued { background: #3a2a10; color: var(--amber); border: 1px solid var(--amber); }
.pill.returned { background: #0e2b18; color: var(--green); border: 1px solid var(--green); }
.pill.available { background: var(--panel2); color: var(--dim); border: 1px solid var(--line); }
/* .mini lives in lists.css now. This rule was more specific than the one
   there, so it kept forcing every control in a record row to solid green —
   Quarantine, Cancel tag and Reprint tag all shouting the same thing. */

/* log */
.log { font-size: 13px; }
.log .ev { padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--dim); }
.log .ev b { color: var(--text); }
.log .ev.warn { color: var(--red); }
.log .ev.clear b, .log .ev.clear { color: var(--green); }
.log .t { font-family: ui-monospace, Menlo, monospace; font-size: 11px; margin-right: 6px; }

/* the toast lives in lists.css now, with the rest of the design language */

/* index role picker */
.pick { display: grid; gap: 14px; margin-top: 30px; }
.pick a {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px; color: var(--text); font-size: 19px; font-weight: 800;
}
.pick a small { display: block; color: var(--dim); font-weight: 400; font-size: 13px; margin-top: 4px; }
.pick a:active { background: var(--panel2); }

/* scanner */
#reader { border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.sim { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sim button {
  border: 1px dashed var(--line); background: transparent; color: var(--text);
  border-radius: 10px; padding: 12px; font-family: ui-monospace, Menlo, monospace;
  font-weight: 700; font-size: 15px; cursor: pointer;
}
.muted { color: var(--dim); font-size: 13px; margin: 6px 0; }

/* QR sheet */
.qr-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; padding: 18px; }
.qr-cell {
  border: 2px solid #000; border-radius: 8px; padding: 14px; text-align: center;
  background: #fff; color: #000;
}
.qr-cell img { width: 150px; height: 150px; }
.qr-cell .s { font-family: ui-monospace, Menlo, monospace; font-weight: 800; font-size: 18px; margin-top: 6px; }
@media print {
  body { background: #fff; }
  header.app, .no-print { display: none !important; }
}

/* ---------- professional polish pass ---------- */
.panel { border-radius: 10px; border-color: #222b24; }
.btn { border-radius: 8px; letter-spacing: .3px; }
.btn.green { background: #1fab50; }
.count { border-radius: 10px; border-top: 2px solid var(--line); }
.count.ok { border-top-color: var(--green); }
.count.out { border-top-color: var(--red); }
.tile { border-radius: 10px; }
h1 { letter-spacing: .3px; }
h2 { font-size: 12px; letter-spacing: 1.6px; }

/* maps */
.mapbox { height: 260px; border-radius: 8px; overflow: hidden; background: #10140f; }
.mapbox.tall { height: 340px; }
.map-title { font-size: 11px; color: var(--dim); text-transform: uppercase;
  letter-spacing: 1.4px; padding: 6px 8px 8px; font-weight: 700; }
.map-key { display: flex; gap: 14px; align-items: center; padding: 8px; font-size: 12px; color: var(--dim); }
.map-key .k { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: -8px; }
.map-key .k.red { background: var(--red); }
.map-key .k.green { background: var(--green); }
.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #141a15; color: var(--text); }

/* tile progress bar */
.tile .bar { height: 6px; background: var(--panel2); border-radius: 999px; margin: 8px 0 6px; overflow: hidden; }
.tile .fill { height: 100%; background: var(--green); border-radius: 999px; }

/* dark-mode OSM tiles */
.mapbox .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(.85) saturate(.5); }

/* thin strip labels for 10mm x 30mm cylinder tags */
.strip-grid { display: grid; grid-template-columns: repeat(auto-fill, 34mm); gap: 4mm; padding: 14px; background: #fff; border-radius: 10px; }
.strip { width: 30mm; height: 10mm; background: #fff; color: #000; border: 0.3mm solid #000;
  border-radius: 1mm; padding: 0.6mm 1mm; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.strip svg.bc { width: 100%; height: 6mm; display: block; }
.strip-txt { display: flex; justify-content: space-between; align-items: baseline;
  font-family: ui-monospace, Menlo, monospace; font-size: 2.2mm; font-weight: 700; line-height: 1; }
@media print {
  .strip-grid { background: #fff; padding: 0; gap: 3mm; border-radius: 0; }
  .tabs, .acct-bar { display: none !important; }
}

/* ---------------------------------------------------------------- tag labels
   A signed payload is ~29 characters, which is a 29x29-module QR. On the old
   30mm x 10mm strip that is 0.31mm per module — printable, but under a wet
   headtorch at 3am a scanner misses it. So the scan label is 30mm x 22mm:
   an 18mm QR (0.62mm/module) with the serial beside it and the Code-128 under
   it. The thin strip stays below for stores use, barcode only. */
.tag-grid { display: grid; grid-template-columns: repeat(auto-fill, 34mm); gap: 4mm;
  padding: 14px; background: #fff; border-radius: 10px; }
.tag-label { width: 30mm; height: 22mm; background: #fff; color: #000;
  border: 0.3mm solid #000; border-radius: 1mm; padding: 1mm; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 0.6mm; }
.tag-label .top { display: flex; gap: 1.2mm; align-items: center; flex: 1; min-height: 0; }
.tag-label .qr { width: 15.5mm; height: 15.5mm; flex: 0 0 15.5mm; }
.tag-label .qr svg { width: 100%; height: 100%; display: block; }
.tag-label .side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.4mm; }
.tag-label .ser { font-family: ui-monospace, Menlo, monospace; font-weight: 800;
  font-size: 2.2mm; line-height: 1.1; white-space: nowrap; }
.tag-label .co { font-size: 1.8mm; font-weight: 700; color: #333; line-height: 1.1; }
.tag-label .warn { font-size: 1.5mm; color: #555; line-height: 1.1; }
.tag-label svg.bc { width: 100%; height: 4.4mm; display: block; flex: 0 0 4.4mm; }
.sheet-head { font-weight: 800; margin: 18px 0 6px; }
@media print {
  .tag-grid { background: #fff; padding: 0; gap: 3mm; border-radius: 0; }
  .sheet-head { color: #000; }
}

/* A long unbroken reference (a pasted EIDF, a line description with no spaces)
   used to push the board header 59px past the right edge on a phone and run
   the title over the PDF/CSV buttons. Break anywhere rather than overflow. */
#bTitle, #bSub, .tile .ref, .tile .sub, .earth .serial, .earth .meta {
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

/* Board header. On a phone the reference and the actions stack, so a long ref
   never squeezes the title into a one-character-per-line column. */
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.board-head-main { min-width: 0; flex: 1 1 220px; }
.board-head-main #bTitle { font-weight: 800; font-size: 18px; line-height: 1.25; }
.board-head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.board-head-actions .btn { width: auto; padding: 10px 12px; }
@media (max-width: 560px) {
  .board-head-main { flex: 1 1 100%; }
  .board-head-actions { flex: 1 1 100%; justify-content: flex-start; }
}
