@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(../fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(../fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(../fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(../fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(../fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }

:root {
  --paper: #F3F5F4;   /* app background: cool workshop white */
  --white: #FFFFFF;
  --plate: #D9E0DE;   /* brushed nameplate */
  --ink: #18232A;     /* deep blue-steel text */
  --steel: #5B6B73;   /* secondary text */
  --line: #C2CBC9;
  --safety: #F2B20F;  /* safety yellow: primary actions, photo tags */
  --signal: #B3381E;  /* destructive */
  --ok: #3E8E5A;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --max: 720px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--safety); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(243, 245, 244, 0.94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: calc(var(--safe-top) + 10px) 16px 10px;
}
.bar-inner {
  max-width: var(--max); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px;
}
.bar h1 {
  margin: 0; font-family: var(--display); font-weight: 700;
  font-size: 26px; letter-spacing: .04em; text-transform: uppercase; line-height: 1;
}
.bar h1.small { font-size: 22px; }
.back {
  display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding-right: 8px;
  text-decoration: none; font-weight: 500; font-size: 17px;
}
.back svg { margin-left: -6px; }
.saved {
  font-family: var(--mono); font-size: 12px; color: var(--steel);
  display: inline-flex; align-items: center; gap: 6px; min-width: 70px; justify-content: flex-end;
}
.saved::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.saved.pending::before { background: var(--safety); }
.iconbtn {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--white); text-decoration: none;
}
.spacer { width: 70px; }

main {
  max-width: var(--max); margin: 0 auto;
  padding: 18px 16px calc(var(--safe-bottom) + 32px);
}
main.with-dock { padding-bottom: calc(var(--safe-bottom) + 110px); }

/* ---------- type ---------- */
.sec {
  font-family: var(--display); font-weight: 700; font-size: 15px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--steel);
  margin: 26px 0 10px; display: flex; justify-content: space-between; align-items: baseline;
}
.sec:first-child { margin-top: 4px; }
.sec em { font-style: normal; font-family: var(--mono); font-weight: 500; letter-spacing: 0; font-size: 13px; }
.help { font-size: 14px; color: var(--steel); margin: 4px 0 16px; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: 12px;
  font-family: var(--display); font-weight: 700; font-size: 19px;
  letter-spacing: .05em; text-transform: uppercase; text-decoration: none;
  border: 2px solid var(--ink); background: transparent; color: var(--ink);
  touch-action: manipulation;
}
.btn.primary { background: var(--safety); border-color: var(--safety); }
.btn.dark { background: var(--ink); color: var(--white); }
.btn.small { min-height: 46px; font-size: 17px; border-width: 1.5px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.busy { pointer-events: none; opacity: .8; }
.textbtn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  background: none; border: 0; padding: 0; font-weight: 600; font-size: 16px;
}
.textbtn .plus {
  width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: var(--white);
  display: grid; place-items: center; font-size: 18px; line-height: 1;
}
.textbtn.danger { color: var(--signal); }

/* ---------- fields ---------- */
.field { margin-bottom: 12px; }
.field label, .label {
  display: block; font-size: 14px; font-weight: 600; color: var(--steel); margin-bottom: 4px;
}
.input {
  display: block; width: 100%;
  background: var(--white); border: 1.5px solid var(--line); border-radius: 10px;
  min-height: 48px; padding: 11px 12px;
  font-size: 16px; /* 16px stops iOS zooming into the field */
  line-height: 1.35; appearance: none; -webkit-appearance: none;
}
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(242, 178, 15, .45); }
.input::placeholder { color: #97A4A8; }
textarea.input { resize: vertical; min-height: 76px; }
.input.mono { font-family: var(--mono); font-size: 16px; }
input[type="date"].input { min-height: 48px; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- signature: the pump nameplate ---------- */
.plate {
  position: relative; margin: 20px 0 8px; padding: 24px 18px 8px; border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 1px, rgba(0,0,0,.025) 1px 3px),
    linear-gradient(180deg, #E3E9E7, #CDD5D3);
  border: 1px solid #AEB9B7;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), inset 0 -1px 0 rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.08);
}
.rivet {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FDFEFE, #9AA6A5 60%, #6E7B7A);
  box-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.rivet.r1 { top: 8px; left: 8px; } .rivet.r2 { top: 8px; right: 8px; }
.rivet.r3 { bottom: 8px; left: 8px; } .rivet.r4 { bottom: 8px; right: 8px; }
.stamp {
  font-family: var(--display); font-weight: 700; letter-spacing: .3em; font-size: 13px;
  color: #4E5C62; text-align: center; margin: -6px 0 12px; text-shadow: 0 1px 0 rgba(255,255,255,.7);
}
.plate .field label {
  font-family: var(--display); font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; font-size: 13px; color: #4E5C62;
}
.plate .input { background: #F8FAF9; border-color: #A9B4B2; }
.plate .input:focus { border-color: var(--ink); }
.plate .serial { font-family: var(--mono); font-size: 18px; letter-spacing: .05em; }

/* ---------- extra fields ---------- */
.extra { display: grid; grid-template-columns: 1fr 1.2fr 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.extra .input { min-height: 46px; }
.x {
  width: 44px; height: 46px; border-radius: 10px; display: grid; place-items: center;
  color: var(--steel); border: 1.5px solid var(--line); background: var(--white); font-size: 20px; line-height: 1;
}

/* ---------- home ---------- */
.card {
  display: block; text-decoration: none; background: var(--white);
  border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 14px 12px; margin-bottom: 10px;
}
.card:active { border-color: var(--ink); }
.card h3 {
  margin: 0; font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .02em; line-height: 1.15;
}
.card h3.untitled { color: var(--steel); }
.card .id { font-family: var(--mono); font-size: 13px; margin: 5px 0 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.card .id span { background: var(--plate); padding: 2px 6px; border-radius: 4px; }
.card .meta { font-size: 14px; color: var(--steel); display: flex; justify-content: space-between; gap: 8px; }
.empty {
  text-align: center; color: var(--steel); padding: 36px 16px; border: 1.5px dashed var(--line); border-radius: 14px;
}
.empty b { display: block; color: var(--ink); font-family: var(--display); font-size: 20px; letter-spacing: .03em; text-transform: uppercase; margin-bottom: 4px; }
.privacy {
  display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--steel);
  margin-top: 22px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px;
}
.privacy svg { flex: none; margin-top: 1px; }

/* ---------- photos ---------- */
.addrow {
  display: grid; grid-template-columns: 3fr 2fr; gap: 10px; margin-top: 12px;
  scroll-margin-bottom: calc(var(--safe-bottom) + 96px); /* clear the export dock when scrolled to */
}
.addrow .btn { padding: 0 10px; }
.addrow.single { grid-template-columns: 1fr; }
.progress { font-family: var(--mono); font-size: 13px; color: var(--steel); margin: 12px 0 0; }
.photos { display: grid; gap: 12px; }
.photo { background: var(--white); border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; }
.pic { position: relative; background: #2F3A40; }
.pic img { display: block; width: 100%; height: 220px; object-fit: contain; }
.tag {
  position: absolute; top: 10px; left: 0; background: var(--safety);
  font-family: var(--mono); font-weight: 500; font-size: 14px;
  padding: 4px 10px 4px 12px; border-radius: 0 6px 6px 0; box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.pctl { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; }
.pctl button {
  width: 40px; height: 40px; border-radius: 10px; border: 0;
  background: rgba(24, 35, 42, .78); color: #fff; display: grid; place-items: center;
}
.pctl button:disabled { opacity: .35; }
.pctl button.del { background: rgba(179, 56, 30, .9); }
.note { padding: 10px 12px 12px; }
.note .label { font-size: 13px; }
.note textarea.input { min-height: 64px; }

.danger-zone { margin-top: 36px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- dock ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: rgba(243, 245, 244, .96);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(var(--safe-bottom) + 12px);
}
.dock-inner { max-width: var(--max); margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- settings ---------- */
.logo-drop {
  width: 100%; min-height: 128px; padding: 16px; display: grid; place-items: center;
  background: var(--white); border: 1.5px dashed var(--steel); border-radius: 14px;
  color: var(--steel); font-weight: 600;
}
.logo-drop img { max-width: 100%; max-height: 96px; object-fit: contain; }
.logo-actions { display: flex; justify-content: space-between; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; background: var(--white);
  border: 1.5px solid var(--line); border-radius: 999px; padding: 2px 2px 2px 14px; font-size: 15px;
}
.chip button { width: 36px; height: 36px; border: 0; background: none; color: var(--steel); font-size: 18px; border-radius: 50%; }
.addchip { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.addchip .btn { width: auto; }
.about { margin-top: 36px; font-size: 13px; color: var(--steel); }

/* segmented choice */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.segmented span {
  display: block; height: 100%; padding: 12px; border-radius: 12px; background: var(--white);
  border: 1.5px solid var(--line); font-size: 14px; color: var(--steel);
}
.segmented b { display: block; font-family: var(--display); font-size: 18px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink); }
.segmented input:checked + span { border: 2px solid var(--ink); box-shadow: inset 0 -4px 0 var(--safety); }
.segmented input:focus-visible + span { outline: 3px solid var(--safety); outline-offset: 2px; }

/* ---------- export dialog (bottom sheet) ---------- */
dialog {
  border: 0; padding: 10px 18px calc(var(--safe-bottom) + 24px); margin: auto auto 0;
  width: 100%; max-width: var(--max); border-radius: 22px 22px 0 0;
  background: var(--paper); color: var(--ink);
}
dialog::backdrop { background: rgba(14, 20, 23, .45); }
dialog[open] { animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
dialog .btn + .btn { margin-top: 10px; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
dialog .sec { margin: 0; }
.file {
  display: flex; gap: 12px; align-items: center; background: var(--white);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; margin: 12px 0 16px;
}
.file-icon {
  flex: none; width: 40px; height: 50px; border-radius: 4px; background: var(--signal); color: #fff;
  font-family: var(--display); font-weight: 700; font-size: 13px;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
}
.file-icon.word { background: #2B5797; }
.file b { font-family: var(--mono); font-weight: 500; font-size: 13px; display: block; word-break: break-all; }
.file small { color: var(--steel); font-size: 14px; }
.export-error { color: var(--signal); font-size: 14px; margin: -6px 0 12px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 96px); z-index: 20;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--white); padding: 10px 16px; border-radius: 10px;
  font-size: 15px; max-width: calc(100% - 32px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- iPad / wide ---------- */
@media (min-width: 700px) {
  .photos { grid-template-columns: 1fr 1fr; }
  .pic img { height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
