/* Base reset */
:root {
  color-scheme: light;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body {
  margin: 0;
  font:
    14px system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
img {
  max-width: 100%;
}
[hidden] {
  display: none !important;
}

/* App styles: tokens (colors, type), layout, components */
/* Layout: sticky toolbar (search + scan) over tabbed panels; list rows open a full item sheet. Phone-first. */
:root {
  --bg: #eceff2;
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --ink: #1a2028;
  --muted: #5a6571;
  --line: #d3d9df;
  --accent: #f2b705;
  --accent-ink: #1a2028;
  --focus: #1f6feb;
  --ok: #23804a;
  --worn: #a86b0c;
  --repair: #cc520a;
  --bad: #c22727;
  --idle: #66717d;
  --retire: #74499c;
  --tint-ok: #e3f2e8;
  --tint-worn: #f8edd8;
  --tint-repair: #fbe6d8;
  --tint-bad: #f9e0e0;
  --tint-idle: #e8ebee;
  --tint-retire: #eee6f5;
  --f-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 6px;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --pos: #23804a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151a;
    --surface: #192028;
    --surface-2: #1f2731;
    --ink: #e6eaee;
    --muted: #95a1ad;
    --line: #2c3541;
    --accent: #f5c22b;
    --accent-ink: #151a20;
    --focus: #58a6ff;
    --ok: #4cc174;
    --worn: #e0a63a;
    --repair: #f08a3e;
    --bad: #f2665e;
    --idle: #8f9aa6;
    --retire: #b08ad6;
    --tint-ok: #1b3326;
    --tint-worn: #382c14;
    --tint-repair: #3b2414;
    --tint-bad: #3d1c1c;
    --tint-idle: #252d36;
    --tint-retire: #2e2338;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --pos: #4cc174;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151a;
  --surface: #192028;
  --surface-2: #1f2731;
  --ink: #e6eaee;
  --muted: #95a1ad;
  --line: #2c3541;
  --accent: #f5c22b;
  --accent-ink: #151a20;
  --focus: #58a6ff;
  --ok: #4cc174;
  --worn: #e0a63a;
  --repair: #f08a3e;
  --bad: #f2665e;
  --idle: #8f9aa6;
  --retire: #b08ad6;
  --tint-ok: #1b3326;
  --tint-worn: #382c14;
  --tint-repair: #3b2414;
  --tint-bad: #3d1c1c;
  --tint-idle: #252d36;
  --tint-retire: #2e2338;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --pos: #4cc174;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 48px;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--bg);
}
.wrap {
  max-width: 1080px;
  margin: 0 auto;
}
h1,
h2,
h3 {
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-wrap: balance;
  margin: 0;
}
h2 {
  font-size: 1.5rem;
}
h3 {
  font-size: 1.15rem;
}
.mono {
  font-family: var(--f-mono);
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--muted);
}
.label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* header */
header.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  background: var(--bg);
  padding-block: 12px 8px;
  display: grid;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  flex-wrap: wrap;
}
.brand h1 {
  font-size: 1.7rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tagmark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 4px;
  font-size: 1rem;
}
.sync {
  font-size: 0.8rem;
  color: var(--muted);
}
.searchrow {
  display: flex;
  gap: 8px;
}
.searchrow input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--muted);
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}
.btn.danger {
  color: var(--bad);
  border-color: var(--bad);
}
.btn.small {
  padding: 6px 10px;
  font-size: 0.85rem;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
nav.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
nav.tabs button {
  background: none;
  border: 0;
  padding: 8px 12px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
nav.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.banner {
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--tint-worn);
  border: 1px solid var(--worn);
  font-size: 0.9rem;
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}

section.panel {
  padding-block: 16px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr);
}
section.panel > * {
  min-width: 0;
}
main,
.wrap {
  min-width: 0;
  max-width: 100%;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
}

/* stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  display: grid;
  gap: 2px;
  cursor: pointer;
  text-align: left;
}
.stat b {
  font-family: var(--f-display);
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat.alert b {
  color: var(--bad);
}
.stat.warn b {
  color: var(--repair);
}

/* table */
.tablewrap {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
td.num,
th.num {
  text-align: right;
}

/* pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.c-ready {
  color: var(--ok);
  background: var(--tint-ok);
}
.c-worn {
  color: var(--worn);
  background: var(--tint-worn);
}
.c-repair {
  color: var(--repair);
  background: var(--tint-repair);
}
.c-dnu {
  color: var(--bad);
  background: var(--tint-bad);
}
.c-untested {
  color: var(--idle);
  background: var(--tint-idle);
}
.c-retire {
  color: var(--retire);
  background: var(--tint-retire);
}
.c-low {
  color: var(--repair);
  background: var(--tint-repair);
}
.c-out {
  color: var(--bad);
  background: var(--tint-bad);
}
.c-stockok {
  color: var(--ok);
  background: var(--tint-ok);
}
.chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}

/* filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
}
.seg button {
  border: 0;
  background: none;
  padding: 7px 11px;
  cursor: pointer;
  font-size: 0.88rem;
}
.seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}
select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  max-width: 100%;
}

/* rows */
.list {
  display: grid;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  text-align: left;
  width: 100%;
}
.row:last-child {
  border-bottom: 0;
}
.row:hover {
  background: var(--surface-2);
}
.row .id {
  font-family: var(--f-mono);
  font-size: 0.82rem;
  color: var(--muted);
  grid-row: span 2;
  align-self: start;
  padding-top: 2px;
  min-width: 7.5ch;
}
.row .nm {
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}
.row .meta {
  grid-column: 2;
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 0;
  overflow-wrap: anywhere;
}
.row .st {
  grid-row: span 2;
  display: grid;
  justify-items: end;
  gap: 4px;
}
.count {
  font-size: 0.85rem;
  color: var(--muted);
}
.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  display: grid;
  gap: 8px;
  justify-items: center;
}

/* forms */
form.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.field {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.field.wide {
  grid-column: 1/-1;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.field textarea {
  min-height: 70px;
  resize: vertical;
}
.hint {
  font-size: 0.8rem;
  color: var(--muted);
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  grid-column: 1/-1;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  margin: 0;
  display: grid;
  gap: 10px;
  grid-column: 1/-1;
  min-width: 0;
}
legend {
  padding: 0 6px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.05rem;
}
.condpick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.condpick button {
  cursor: pointer;
}
.condpick button[aria-pressed="true"] {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}
.condpick button[aria-pressed="false"] {
  opacity: 0.55;
}

/* sheet */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgb(0 0 0 / 0.45);
  display: flex;
  justify-content: flex-end;
}
.sheet .inner {
  background: var(--bg);
  width: min(620px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    calc(24px + env(safe-area-inset-bottom, 0px)) 16px;
  display: grid;
  gap: 14px;
  align-content: start;
}
.sheethead {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}
.sheethead .idbig {
  font-family: var(--f-mono);
  font-size: 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 6px;
}
.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 16px;
}
.kv div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.qty {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.qty b {
  font-family: var(--f-display);
  font-size: 2.2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.qty input {
  width: 90px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.log {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
}
.log div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}
.confirm {
  padding: 10px;
  border: 1px solid var(--bad);
  border-radius: var(--r);
  background: var(--tint-bad);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* guide */
.guide {
  display: grid;
  gap: 16px;
}
.guide p,
.guide li {
  max-width: 68ch;
}
.ref {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}
.ref .card {
  display: grid;
  gap: 4px;
  padding: 12px;
}
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--r);
  z-index: 30;
  font-weight: 500;
  max-width: calc(100% - 32px);
}
.dupbox {
  background: var(--tint-worn);
  border: 1px solid var(--worn);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 0.9rem;
}
.dupbox .list {
  background: var(--surface);
}
.sheet .inner {
  grid-template-columns: minmax(0, 1fr);
}
.sheet .inner > * {
  min-width: 0;
}
.dupbox select {
  width: 100%;
}
.duprow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.duprow:last-child {
  border-bottom: 0;
}
.duprow span:nth-child(2) {
  flex: 1;
  min-width: 160px;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.addloc {
  font-size: 0.82rem;
  justify-self: start;
  margin-top: 2px;
}
.newloc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
}
.newloc .actions {
  grid-column: 1/-1;
}
.locgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.lochead {
  font-size: 1.05rem;
  margin: 14px 0 6px;
}
.lvlhead {
  padding: 5px 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.labelpick {
  max-height: 420px;
  overflow-y: auto;
}
.labelpick label {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  cursor: pointer;
}
/* fleet */
.modesw {
  display: flex;
  width: 100%;
}
.modesw button {
  flex: 1;
  padding: 9px 10px;
  font-weight: 600;
}
.stat .sub {
  font-size: 0.78rem;
  color: var(--muted);
}
.twocol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 18px;
}
.twocol > * {
  min-width: 0;
}
.hh {
  margin-bottom: 8px;
}
.cardhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip.big {
  padding: 5px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink);
}
.chip.big b {
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}
.fsec {
  grid-column: 1/-1;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  margin-top: 6px;
}
.checkrow {
  display: flex !important;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}
.checkrow input {
  width: auto !important;
  margin-top: 3px;
}
fieldset .checkrow {
  padding: 4px 0;
}
.files {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.file {
  display: grid;
  gap: 4px;
  width: 110px;
  font-size: 0.78rem;
}
.file img {
  width: 110px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  display: block;
  background: var(--surface-2);
}
.file .pdf {
  display: grid;
  place-items: center;
  width: 110px;
  height: 80px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.file .fname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.card.alerts {
  display: grid;
  gap: 8px;
}
.card.alerts > div {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.card.ok {
  color: var(--ok);
  background: var(--tint-ok);
  border-color: var(--ok);
}
.shopcard {
  display: grid;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.shopcard:hover {
  border-color: var(--muted);
}
.kv3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.kv3 > span {
  display: grid;
  min-width: 0;
}
.pos {
  color: var(--pos);
}
.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  cursor: pointer;
  text-align: left;
}
.subtabs {
  margin-top: -4px;
}
.chart {
  display: grid;
  gap: 8px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.82rem;
  color: var(--muted);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i,
.tip i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.cw {
  position: relative;
}
.svgslot {
  width: 100%;
  min-height: 200px;
}
.svgslot svg {
  display: block;
  max-width: 100%;
}
.svgslot .grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
.svgslot .base {
  stroke: var(--muted);
  stroke-width: 1;
}
.svgslot .ax {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--f-body);
  font-variant-numeric: tabular-nums;
}
.svgslot .hit {
  cursor: pointer;
}
.svgslot .hit.on {
  fill: var(--ink);
  fill-opacity: 0.06;
}
.tip {
  position: absolute;
  z-index: 3;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 10px;
  font-size: 0.82rem;
  min-width: 170px;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.18);
  pointer-events: none;
  display: grid;
  gap: 3px;
}
.tip[hidden] {
  display: none;
}
.tip div {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tip div span {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.tip .tt {
  border-top: 1px solid var(--line);
  padding-top: 3px;
  font-weight: 600;
}
.mgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 10px;
}
.mrow {
  display: grid;
  gap: 6px;
  align-content: start;
}
.mrow .mhead {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.mrow .mhead .pill {
  margin-left: auto;
}
.mrow .meta {
  font-size: 0.84rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.mrow .qty input {
  flex: 1;
  min-width: 110px;
  width: auto;
}
.mwarn {
  font-size: 0.84rem;
  color: var(--repair);
  background: var(--tint-repair);
  border-radius: 4px;
  padding: 6px 8px;
}
.off {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}
.off.flag {
  color: var(--bad);
  font-weight: 700;
}
.hint .off {
  display: inline;
}
table.wk td {
  vertical-align: top;
}
.tview summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
}
@media (max-width: 520px) {
  .row .st .pill {
    font-size: 0.72rem;
  }
  .brand h1 {
    font-size: 1.45rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Sign-in screen and account button */
#gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
  overflow: auto;
}
.gatebox {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
}
.gatebrand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.6rem;
}
.gateform {
  display: grid;
  gap: 12px;
}
.gateform input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.gatebox code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}
#acctbtn {
  margin-left: auto;
}
.sync {
  order: 3;
}

/* personal items, overdue, live scanner */
.chip.personal {
  color: var(--ink);
  background: var(--tint-info, var(--surface-2));
  border-color: currentColor;
  font-weight: 600;
}
.danger-text {
  color: var(--bad);
}
.stat .hint {
  display: block;
  font-size: 0.75rem;
}
.scanner {
  max-width: 560px;
}
.scanview {
  position: relative;
  background: #000;
  border-radius: var(--r);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  max-height: 62vh;
  width: 100%;
}
.scanview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scanframe {
  position: absolute;
  inset: 18% 14%;
  border: 3px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.actions .field input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.fmore {
  grid-column: 1/-1;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 12px;
}
.fmore > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
}
.fmore[open] > summary {
  margin-bottom: 10px;
}
.fgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.fgrid .fsec {
  margin-top: 4px;
}
[hidden] {
  display: none !important;
}
