/* The applicant's page. Standalone on purpose: it loads none of the app's shell, because the person filling it in
   is not signed in and should never see a tool they cannot open. Built for a phone held in one hand at a truck
   stop, so everything is one column, the targets are thumb sized, and nothing needs a pinch to read. */
:root {
  --ink: #16181d;
  --muted: #5c6370;
  --line: #d8dbe0;
  --bg: #f6f7f9;
  --card: #ffffff;
  --blue: #1f5fa9;
  --blue-dark: #174a86;
  --good: #1d7a4c;
  --bad: #b3261e;
  --warn: #8a5a00;
  --paper: #ffffff;
  --paper-ink: #16181d;
  --deck: #e9ebef;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.bar img { width: 46px; height: auto; }
.bar strong { display: block; font-size: 16px; }
.bar span { display: block; font-size: 13px; color: var(--muted); }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 48px; }
.loading { color: var(--muted); }

h1 { font-size: 22px; margin: 4px 0 6px; }
h2 { font-size: 17px; margin: 28px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); }
h2:first-of-type { border-top: 0; padding-top: 0; }
p { margin: 0 0 12px; }
.small { font-size: 14px; color: var(--muted); }
.lead { color: var(--muted); margin-bottom: 20px; }

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

label { display: block; margin: 0 0 14px; font-weight: 600; font-size: 15px; }
label .req { color: var(--bad); font-weight: 400; }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  /* 17px keeps iOS from zooming the page when a field takes focus. */
  font-size: 17px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
input[type="checkbox"] { width: 22px; height: 22px; display: inline-block; margin: 0 10px 0 0; vertical-align: -4px; }

button {
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  padding: 13px 18px;
  cursor: pointer;
  min-height: 48px;
}
button:disabled { opacity: .55; cursor: default; }
button.wide { width: 100%; }
button.ghost { background: #fff; color: var(--blue); }
button.link { background: none; border: 0; color: var(--blue); text-decoration: underline; padding: 6px 0; min-height: 0; }

.up {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.up:last-child { border-bottom: 0; }
.up .what { font-weight: 600; font-size: 15px; }
.up .state { font-size: 14px; color: var(--muted); }
.up .state.done { color: var(--good); font-weight: 600; }
.up .state.sensitive { color: var(--warn); }
.up input[type="file"] { display: none; }
.up .pick { white-space: nowrap; }

.note { border-radius: 8px; padding: 12px; margin: 0 0 14px; font-size: 15px; }
.note.bad { background: #fdecea; color: var(--bad); border: 1px solid #f3c2bd; }
.note.good { background: #e8f5ee; color: var(--good); border: 1px solid #b9ddc8; }
.note.warn { background: #fdf4e3; color: var(--warn); border: 1px solid #f0dcb0; }
.note ul { margin: 6px 0 0; padding-left: 20px; }

.read { background: #eef4fb; border: 1px solid #c9ddf2; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-top: 8px; }
.saving { font-size: 14px; color: var(--muted); min-height: 20px; margin: 0 0 8px; }

.foot { max-width: 640px; margin: 0 auto; padding: 0 16px 40px; color: var(--muted); font-size: 14px; }
.foot a { color: var(--blue); }

.done-big { text-align: center; padding: 40px 0; }
.done-big .tick { font-size: 44px; color: var(--good); line-height: 1; }

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eaed; --muted: #a0a6b0; --line: #343841; --bg: #15171b; --card: #1d2026;
    --blue: #6aa9ef; --good: #5fcf96; --bad: #f28b82; --warn: #e3b341;
    /* A shade off white so it reads as a sheet against the dark deck, with dark ink on it. */
    --paper: #f4f2ec; --paper-ink: #1b1d22; --deck: #0f1114;
  }
  .bar { background: var(--card); }
  input, select, textarea { background: #15171b; color: var(--ink); }
  button { color: #10131a; }
  button.ghost { background: var(--card); color: var(--blue); }
  .note.bad { background: #2d1a18; border-color: #5c2a25; }
  .note.good { background: #15291f; border-color: #2c5340; }
  .note.warn { background: #2c2416; border-color: #574a1b; }
  .read { background: #19222e; border-color: #2c3f57; }
}

/* The repeating parts of the 391.21 application: one card per job, accident, conviction or address. */
.row-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--bg);
}
.row-card label:last-of-type { margin-bottom: 0; }
.decl { padding-bottom: 6px; }
.decl label span.small { display: block; font-weight: 400; margin-top: 4px; }
label.consent { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: var(--bg); }
label.consent span.small { display: block; font-weight: 400; margin-top: 6px; }
label span.small { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; font-size: 14px; }
.up .small a { color: var(--blue); }

/* One step at a time (Joe 2026-10-16). The count and the bar say how much is left, so nobody is typing into a
   form with no end in sight, and the two buttons are always in the same place at the bottom. */
.steps { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.steps > span:first-child { white-space: nowrap; font-weight: 600; }
.steps .track { flex: 1 1 auto; height: 6px; border-radius: 3px; background: #e3e6ea; overflow: hidden; }
.steps .track > span { display: block; height: 100%; background: var(--blue); }
.nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 24px; }
.nav button { min-width: 7.5em; }
.card h3 { font-size: 16px; margin: 20px 0 4px; }
.card h3:first-child { margin-top: 0; }

/* What they are signing. The whole agreement, in a box that scrolls, because a link to a contract is not the
   same as being shown one. */
/* A line the document asks to be initialled. Big enough for a thumb, and it keeps the initials once tapped. */
.ini {
  display: inline-block; min-width: 68px; min-height: 34px; margin: 0 4px 3px 0; padding: 4px 10px;
  border: 2px dashed var(--blue); border-radius: 6px; background: #eef4fb; color: var(--blue);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; vertical-align: middle;
}
.ini:hover { background: #dfeaf7; }
.ini.done {
  border-style: solid; border-color: var(--good); background: #e8f5ee; color: var(--good);
  font-family: 'Times New Roman', Times, serif; font-style: italic; font-size: 17px; cursor: default;
}
.ups-head { margin: 22px 0 2px; font-weight: 600; font-size: 15px; }
.agree { margin: 0 0 22px; }
.agree h3 { margin: 0 0 2px; font-size: 17px; }
.agree-text {
  max-height: 55vh; overflow-y: auto; margin: 10px 0 6px; padding: 12px 14px;
  border: 1px solid #d7dbe0; border-radius: 8px; background: #fbfcfd;
  font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; -webkit-overflow-scrolling: touch;
}
.agree-text:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

/* The safety training (lib/safety.js). */
.sfvideo { width: 100%; max-height: 60vh; background: #000; border-radius: 8px; margin: 8px 0 12px; }
fieldset.quiz { border: 1px solid #d9dde5; border-radius: 8px; margin: 0 0 12px; padding: 10px 12px; }
fieldset.quiz legend { font-weight: 600; padding: 0 4px; }
label.choice { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 8px 0; }
label.choice input { width: auto; min-height: 0; margin-top: 3px; }
/* THE DOCUMENT IS PAPER (Joe 2026-10-18: "it needs to look and feel and opertate just like docusign. Not a
   scroll through text blob"). Sheets at letter proportions on a grey deck, numbered, with the fields anchored
   on the lines they belong to and a bar above that counts them down. Nothing here is a box with a scrollbar. */
.agree.one { margin: 0 -16px; }

/* The bar that stays with you: where you are, what is left, and the button that takes you to it. */
.doc-bar {
  position: sticky; top: var(--bar-h, 56px); z-index: 4; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
.doc-of { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.doc-count { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--ink); }
.jump {
  min-width: 0; padding: 8px 14px; border: 0; border-radius: 999px; background: var(--blue); color: #fff;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.jump[disabled] { background: var(--good); opacity: 1; cursor: default; }
.doc-cite { margin: 10px 16px 0; color: var(--muted); }

/* The deck the sheets sit on. */
.doc { padding: 14px 16px 4px; background: var(--deck); }
.sheet {
  position: relative; margin: 0 auto 14px; padding: 0; max-width: 820px; background: var(--paper);
  border: 1px solid #cfd3d9; box-shadow: 0 2px 10px rgba(22, 24, 29, .13);
}
.paper {
  color: var(--paper-ink);
  padding: 8.5% 8.5% 0;
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  font-size: 15px; line-height: 1.62;
}
.sheet-num {
  position: absolute; left: 0; right: 0; bottom: 10px; text-align: center;
  font-family: system-ui, sans-serif; font-size: 11px; letter-spacing: .04em; color: #98a0ab;
}
.ln { margin: 0 0 2px; }
.ln.sp { height: .72em; }
.ln.anchored { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 6px; }
.ln.anchored > span { flex: 1; }
/* The value half of one of the lease's two column rows: it belongs to the line above it. */
.ln.val { margin: 0 0 6px; padding-left: 1.4em; color: var(--paper-ink); opacity: .86; }
/* The end of the words, which is what "read it to the end" means. */
.doc-end { height: 1px; }

/* A field, anchored on its line, with the little pointer a signing tab has. */
.tab {
  position: relative; flex: none; min-height: 32px; padding: 5px 11px 5px 13px;
  border: 0; border-radius: 3px; background: #f3c417; color: #40320a;
  font-family: system-ui, sans-serif; font-size: 12px; font-weight: 800; letter-spacing: .03em;
  text-transform: uppercase; cursor: pointer; white-space: nowrap;
}
.tab .tab-arrow {
  position: absolute; left: -7px; top: 50%; width: 0; height: 0; transform: translateY(-50%);
  border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-right: 7px solid #f3c417;
}
.tab:hover { background: #ffd22e; }
.tab.done {
  background: #e8f5ee; color: var(--good); box-shadow: inset 0 0 0 1px #b6ddc7;
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  font-size: 16px; font-style: italic; font-weight: 700; text-transform: none; letter-spacing: 0; cursor: default;
}
.tab.done .tab-arrow { border-right-color: #e8f5ee; }
/* The one it just took you to. */
.tab.seek { animation: seek 1.3s ease-out 1; }
@keyframes seek {
  0%, 100% { box-shadow: 0 0 0 0 rgba(243, 196, 23, 0); }
  30% { box-shadow: 0 0 0 7px rgba(243, 196, 23, .55); }
}
.doc-foot { margin: 10px 16px 0; }
.doc-foot.good { color: var(--good); font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  /* Still, but still shown: the jump has to say which one it took them to. */
  .tab.seek { animation: none; box-shadow: 0 0 0 4px rgba(243, 196, 23, .55); }
}
/* Why Next is not lit yet, under the button that is not lit. */
.nav-why { flex-basis: 100%; order: 3; margin: 0; text-align: right; color: var(--warn); }
.nav { flex-wrap: wrap; }
.nav button[disabled] { opacity: .5; cursor: not-allowed; }

/* A PLACE TO SIGN (lib/signmark.js): the tab sits on the line where the signature goes, with the line's own words
   either side of it, and once tapped it shows the signature they adopted. */
.ln.signline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 14px 0 8px; }
.tab.sign { min-height: 40px; padding: 8px 14px 8px 16px; }
.tab.sign.done { background: transparent; box-shadow: none; padding: 0 0 2px 10px; border-left: 3px solid var(--blue); border-radius: 0; }
.tab.sign.done .tab-arrow { display: none; }
.tab.done .mark-img { display: block; }
.mark-img.mk-ini { height: 26px; width: auto; }
.mark-img.mk-sig { height: 46px; width: auto; max-width: 260px; }
.autodate { padding: 1px 6px; border-radius: 3px; background: #eef3fa; font-weight: 600; }

/* THE BOX WHERE THEY ADOPT IT. Over the page, one column, thumb sized, and it scrolls on a short phone. */
body.adopting { overflow: hidden; }
.adopt-shade {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center;
  padding: 16px; overflow-y: auto; background: rgba(15, 17, 20, .55);
}
.adopt {
  width: 100%; max-width: 560px; margin: auto 0; padding: 18px 16px 16px; border-radius: 10px;
  background: var(--card); color: var(--ink); box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.adopt h2 { margin-top: 0; }
.adopt-names { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.adopt-modes { display: flex; gap: 0; margin: 12px 0 10px; border-bottom: 1px solid var(--line); }
.adopt-modes button {
  min-width: 0; padding: 10px 14px; border: 0; border-bottom: 3px solid transparent; border-radius: 0;
  background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer;
}
.adopt-modes button.on { color: var(--blue); border-bottom-color: var(--blue); }
.style-pick {
  display: flex; align-items: center; gap: 12px; margin: 0 0 8px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: #1a2a6c; cursor: pointer; overflow: hidden;
}
.style-pick input { width: auto; min-height: 0; margin: 0; flex: none; }
.style-pick:has(input:checked) { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue); }
.sp-sig { flex: 1; min-width: 0; font-size: 30px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-ini { flex: none; padding-left: 12px; border-left: 1px solid #e3e6ea; font-size: 26px; line-height: 1.3; }
.pad-wrap { margin: 0 0 12px; }
.pad-wrap.pad-ini { max-width: 220px; }
.pad-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--muted); }
canvas.pad {
  display: block; width: 100%; border: 1px dashed #9aa3af; border-radius: 6px; background: #fff;
  touch-action: none; cursor: crosshair;
}
canvas.pad.pad-sig { height: 130px; }
canvas.pad.pad-ini { height: 90px; }
.adopt-go { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.adopt-go button { width: auto; }

/* What they adopted, on the last screen. */
.adopted { display: flex; align-items: flex-end; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.adopted-sig { height: 56px; width: auto; max-width: 70%; }
.adopted-ini { height: 36px; width: auto; padding-left: 12px; border-left: 1px solid #e3e6ea; }
