@font-face { font-family: "Lato"; src: url("fonts/Lato-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lato"; src: url("fonts/Lato-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Lato"; src: url("fonts/Lato-Black.woff") format("woff"); font-weight: 900; font-display: swap; }

:root {
  --bg: #eef3f6;
  --card: #ffffff;
  --ink: #1d2733;
  --soft: #5b6878;
  --line: #d5dde5;
  --brand: #0e6e8c;
  --brand-dark: #0a4c63;
  --brand-tint: #e3f2f6;
  --sand: #a8743a;
  --ok: #17784a;
  --ok-tint: #e5f4ec;
  --warn: #9a5b00;
  --warn-tint: #fdf1de;
  --bad: #b42318;
  --bad-tint: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 36, 58, .06), 0 4px 14px rgba(16, 36, 58, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 26px; font-weight: 900; }
h2 { font-size: 19px; font-weight: 900; }
.soft { color: var(--soft); }
.small { font-size: 14px; }
.af { color: var(--soft); font-weight: 400; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--brand-dark); color: #fff;
}
.top img { width: 42px; height: 42px; }
.top .title { font-weight: 900; font-size: 19px; line-height: 1.1; }
.top .title span { display: block; font-weight: 400; font-size: 13px; opacity: .8; }
.top nav { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.top nav a, .top nav button {
  color: #fff; text-decoration: none; font: inherit; font-size: 15px; font-weight: 700;
  padding: 9px 13px; border-radius: 10px; background: transparent; border: 0; cursor: pointer;
}
.top nav a.on, .top nav a:hover, .top nav button:hover { background: rgba(255, 255, 255, .14); }
.top nav .who { font-size: 14px; opacity: .8; padding: 0 6px; }

main { max-width: 1040px; margin: 0 auto; padding: 18px 16px 120px; }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.subnav a { padding: 8px 13px; border-radius: 999px; background: var(--card); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; border: 1px solid var(--line); }
.subnav a.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Cards and sections */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 18px 20px; margin-bottom: 16px; }
.card > h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 15px; font-weight: 900; flex: none; }

/* Form fields */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grid .wide { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }
label.field { display: block; }
label.field > span { display: block; font-size: 14px; font-weight: 700; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=month], select, textarea {
  width: 100%; font: inherit; font-size: 18px; color: var(--ink);
  padding: 12px 13px; border: 1.5px solid var(--line); border-radius: 11px; background: #fff;
  -webkit-appearance: none; appearance: none;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 110, 140, .18); }
input[readonly] { background: #f6f8fa; }
.error { color: var(--bad); font-size: 14px; font-weight: 700; margin-top: 4px; min-height: 0; }
.has-error input, .has-error select, .has-error .photo, .has-error canvas { border-color: var(--bad) !important; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; padding: 6px 0; }
.check input { width: 24px; height: 24px; accent-color: var(--brand); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 900; font-size: 17px; line-height: 1;
  padding: 14px 20px; border-radius: 12px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--brand); color: #fff; min-height: 50px;
}
.btn:hover { background: var(--brand-dark); }
.btn.light { background: var(--brand-tint); color: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--brand-dark); border: 1.5px solid var(--line); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 9px 13px; min-height: 40px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: wait; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Choice cards (tank, payment) */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .face { display: block; height: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.choice .face b { display: block; font-size: 17px; }
.choice .face small { display: block; color: var(--soft); font-size: 14px; }
.choice input:checked + .face { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
.choice input:disabled + .face { opacity: .45; cursor: not-allowed; }
.level { display: block; height: 8px; border-radius: 4px; background: #e6ebf0; overflow: hidden; margin-top: 8px; }
input.upper { text-transform: uppercase; }
.level i { display: block; height: 100%; background: var(--brand); }
.level.low i { background: var(--warn); }

/* Photos */
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .photos { grid-template-columns: 1fr; } }
.photo {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 150px; border: 2px dashed #b8c4cf; border-radius: 12px; background: #f8fafb;
  text-align: center; padding: 10px; cursor: pointer; overflow: hidden;
}
.photo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo .icon { font-size: 30px; line-height: 1; }
.photo b { margin-top: 6px; }
.photo small { color: var(--soft); font-size: 13px; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo.done { border-style: solid; border-color: var(--ok); }
.photo .badge { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 2; padding: 6px 8px; border-radius: 8px; background: rgba(0, 0, 0, .62); color: #fff; font-size: 13px; font-weight: 700; }
.photo.busy::after { content: "Uploading…"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .75); font-weight: 900; z-index: 3; }

/* Signature */
.sigwrap { position: relative; }
canvas.sig { display: block; width: 100%; height: 200px; border: 2px solid var(--line); border-radius: 12px; background: #fff; touch-action: none; }
.sigwrap .hint { position: absolute; left: 16px; bottom: 12px; color: #9aa7b4; pointer-events: none; font-size: 15px; }
.sigwrap .clear { position: absolute; right: 10px; top: 10px; }
.indemnity { background: #f6f8fa; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 15px; margin-bottom: 14px; }
.indemnity p { margin: 0 0 6px; }

/* Totals bar */
.totals {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(16, 36, 58, .08);
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.totals .in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.totals .sum { font-size: 15px; color: var(--soft); }
.totals .sum b { display: block; font-size: 26px; font-weight: 900; color: var(--ink); line-height: 1.1; }
.totals .btn { margin-left: auto; min-width: 210px; }

/* Messages */
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-weight: 700; }
.flash.ok { background: var(--ok-tint); color: var(--ok); }
.flash.error { background: var(--bad-tint); color: var(--bad); }
.flash.draftnote { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flash.draftnote .btn { margin-left: auto; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--warn-tint); color: var(--warn); font-weight: 700; }

/* Tables */
table.list { width: 100%; border-collapse: collapse; font-size: 15px; }
table.list th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--soft); padding: 8px 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px 8px; border-bottom: 1px solid #edf1f4; vertical-align: top; }
table.list tr.void td { color: #9aa5b1; text-decoration: line-through; }
td.num, th.num { text-align: right; white-space: nowrap; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #edf1f4; color: var(--soft); white-space: nowrap; }
.pill.ok { background: var(--ok-tint); color: var(--ok); }
.pill.warn { background: var(--warn-tint); color: var(--warn); }
.pill.bad { background: var(--bad-tint); color: var(--bad); }

/* Suggestions */
.suggest { position: relative; }
.suggest ul { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.suggest li { padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.suggest li:hover, .suggest li.on { background: var(--brand-tint); }
.suggest li small { display: block; color: var(--soft); }

/* Login */
.login { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.login img { width: 150px; height: 150px; }
.login h1 { margin: 14px 0 4px; }
.pin { letter-spacing: .5em; text-align: center; font-size: 28px !important; font-weight: 900; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.pad button { font: inherit; font-size: 26px; font-weight: 900; padding: 16px 0; border-radius: 14px; border: 0; background: #fff; box-shadow: var(--shadow); color: var(--ink); cursor: pointer; }
.pad button:active { background: var(--brand-tint); }

/* Done */
.done { text-align: center; padding: 30px 18px; }
.done .tick { width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 42px; font-weight: 900; }
.done .big { font-size: 40px; font-weight: 900; margin: 6px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; text-align: left; max-width: 520px; margin: 16px auto; }
.kv dt { color: var(--soft); }
.kv dd { margin: 0; font-weight: 700; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.thumbs a { display: block; }
.thumbs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.thumbs span { display: block; font-size: 13px; color: var(--soft); margin-top: 3px; }
.tankrow { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: end; padding: 10px 0; border-bottom: 1px solid #edf1f4; }
.tankrow:last-child { border-bottom: 0; }
.tankrow .big { font-size: 24px; font-weight: 900; }
details > summary { cursor: pointer; font-weight: 700; color: var(--brand-dark); padding: 6px 0; }
