/* BlueBird Shelf Count. Palette and type from the BlueBird Fence Brand Guide v1.1.
   Layout: blue brand band, one column (max 720px) of shelf groups, sticky action bar at the thumb,
   full-screen number pad sheet. Light theme only, on purpose. */
:root {
  --cool: #F1F8FB;      /* Cool Blue - page */
  --slate: #EFEFEF;
  --sky: #5FB4FF;
  --bright: #3982FF;
  --blue: #0E57E0;      /* BlueBird Blue - accent */
  --navy: #07074E;      /* ink */
  --yellow: #FFD100;    /* call to action */

  --bg: var(--cool);
  --surface: #FFFFFF;
  --surface-2: #F6FAFD;
  --line: #D9E6F5;
  --line-strong: #B9CDE6;
  --fg: #0B1533;
  --muted: #56627A;
  --danger: #C4314B;
  --danger-bg: #FCEBEE;
  --ok: #1E8A5A;
  --ok-bg: #E4F5EC;
  --warn-bg: #FFF6CC;
  --warn-fg: #6A5300;
  --shadow: 0 1px 2px rgba(7,7,78,.06), 0 6px 18px rgba(7,7,78,.07);

  --font-display: "Poppins", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-body: Verdana, Geneva, "DejaVu Sans", sans-serif;
  --radius: 12px;
  --tap: 56px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: var(--font-body); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, button, label, input, select, textarea, .display { font-family: var(--font-display); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
button { cursor: pointer; font: inherit; color: inherit; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--bright); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 720px; margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }

/* ---------- brand band ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--blue); }
.band { background: var(--blue); color: #fff; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.band .wrap { display: flex; align-items: center; gap: 12px; padding-block: 10px; min-height: 60px; }
.logo { width: 36px; height: 36px; border-radius: 9px; background: #fff; display: grid; place-items: center; flex: none; }
.logo svg { width: 28px; height: 28px; }
.brand-txt { display: grid; line-height: 1.15; min-width: 0; }
.brand-txt b { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-txt span { font-family: var(--font-display); font-size: 12.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.timer { font-family: var(--font-display); font-weight: 600; font-size: 15px; background: rgba(255,255,255,.14); padding: 4px 10px; border-radius: 8px; }
.band-btn { border: 1.5px solid rgba(255,255,255,.5); background: transparent; color: #fff; border-radius: 9px; padding: 7px 12px; font-weight: 600; font-size: 13.5px; min-height: 44px; min-width: 44px; }

/* status strip under band */
.status { background: var(--surface); border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.status .wrap { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; padding-block: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: var(--ok); vertical-align: 1px; }
.dot.warn { background: var(--yellow); }
.dot.bad { background: var(--danger); }
.status .who { font-family: var(--font-display); font-weight: 600; color: var(--fg); }

/* ---------- generic ---------- */
main { padding-block: 16px 140px; display: grid; gap: 18px; }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px; border-radius: 12px; border: 2px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 16px; text-align: center; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.cta { background: var(--yellow); border-color: var(--yellow); color: var(--navy); font-weight: 700; }
.btn.danger { color: var(--danger); border-color: #EBB3BE; }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { min-height: 44px; font-size: 14px; padding: 0 14px; border-radius: 10px; }
.linkbtn { border: 0; background: none; color: var(--blue); font-weight: 600; padding: 0 6px; font-size: 15px; min-height: 44px; min-width: 44px; }

/* ---------- start screen ---------- */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice { min-height: 64px; border-radius: 12px; border: 2px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 17px; padding: 8px 12px; text-align: left; display: grid; gap: 2px; align-content: center; }
.choice small { font-family: var(--font-body); font-weight: 400; font-size: 12.5px; color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--blue); background: #EAF1FE; box-shadow: inset 0 0 0 1px var(--blue); color: var(--navy); }
.choice.wide { grid-column: 1 / -1; }
.inline-input { display: flex; gap: 8px; margin-top: 10px; }
.inline-input input { flex: 1; min-width: 0; }
input[type="text"], input[type="search"], input[type="date"], select, textarea {
  font-size: 17px; color: var(--fg); background: var(--surface); border: 2px solid var(--line-strong); border-radius: 12px; padding: 0 14px; min-height: var(--tap); width: 100%; min-width: 0; }
textarea { padding: 12px 14px; min-height: 84px; font-family: var(--font-body); resize: vertical; font-size: 16px; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; }
.areas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.area-chip { min-height: 54px; border-radius: 10px; border: 2px solid var(--line-strong); background: var(--surface); text-align: left; padding: 6px 10px; display: flex; gap: 10px; align-items: center; }
.area-chip b { font-family: var(--font-display); font-size: 17px; color: var(--blue); min-width: 26px; }
.area-chip span { font-size: 12.5px; color: var(--muted); line-height: 1.25; }
.area-chip[aria-pressed="true"] { border-color: var(--blue); background: #EAF1FE; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.resume { padding: 16px; display: grid; gap: 10px; border-color: var(--yellow); box-shadow: 0 0 0 2px var(--yellow), var(--shadow); }
.resume h2 { font-size: 18px; }
.outbox { display: grid; gap: 8px; }
.ob-item { padding: 12px 14px; display: grid; gap: 8px; }
.ob-top { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.ob-top b { font-family: var(--font-display); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-display); font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--slate); color: var(--navy); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.bad { background: var(--danger-bg); color: var(--danger); }
.pill.blue { background: #EAF1FE; color: var(--blue); }
.info-count { margin-top: 6px; font-size: 15px; color: var(--muted, #5B6475); }   /* plain info, not a warning */

/* ---------- count screen ---------- */
.progress { height: 6px; background: var(--slate); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--blue); border-radius: 99px; width: 0; transition: width .2s; }
.prog-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.prog-row b { font-family: var(--font-display); font-size: 18px; color: var(--blue); }
.search { position: relative; }
.search input { padding-left: 44px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface); border: 2px solid var(--line-strong); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; min-height: 44px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.group { overflow: hidden; }
.group-head { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.group-head .code { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--blue); min-width: 30px; }
.group-head .lbl { font-family: var(--font-display); font-weight: 500; font-size: 14px; flex: 1; min-width: 0; }
.group-head .cnt { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); padding: 12px 14px; min-height: 72px; }
.item:last-child { border-bottom: 0; }
.item:active { background: var(--surface-2); }
.item .txt { flex: 1; min-width: 0; display: grid; gap: 3px; }
.item .nm { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; line-height: 1.25; }
.item .sub { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.item .res { flex: none; display: grid; justify-items: end; gap: 3px; text-align: right; }
.item .big { font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--navy); line-height: 1; }
.item .todo { width: 44px; height: 44px; border-radius: 50%; border: 2px dashed var(--line-strong); display: grid; place-items: center; color: var(--muted); font-size: 22px; }
.item.done { background: #FBFDFF; }
.item.done .nm { color: var(--navy); }
.check { width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; display: inline-grid; place-items: center; font-size: 13px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* sticky bottom action bar */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(7,7,78,.08); padding-bottom: env(safe-area-inset-bottom, 0px); }
.actionbar .wrap { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; padding-block: 10px; }
.actionbar.one .wrap { grid-template-columns: 1fr; }
.actionbar .btn { font-size: 15.5px; padding: 0 12px; }

/* ---------- number pad sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.sheet-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-head .wrap { display: flex; gap: 10px; align-items: flex-start; padding-block: 10px; }
.x { width: 48px; height: 48px; border-radius: 12px; border: 2px solid var(--line-strong); background: var(--surface); font-size: 20px; flex: none; }
.sheet-title { flex: 1; min-width: 0; display: grid; gap: 4px; }
.sheet-title h2 { font-size: 18px; line-height: 1.25; }
.sheet-title .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); }
.loc-select { min-height: 44px; width: auto; font-size: 16px; padding: 0 10px; border-radius: 10px; border-width: 1.5px; }
.sheet-body { flex: 1; overflow-y: auto; }
.sheet-body .wrap { display: grid; gap: 12px; padding-block: 12px; }
.fields { display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px; position: sticky; top: 0; z-index: 2; background: var(--bg); padding-block: 4px; margin-block: -4px; }
.field { border: 2px solid var(--line-strong); background: var(--surface); border-radius: 14px; padding: 8px 12px; text-align: left; display: grid; gap: 0; min-height: 84px; align-content: center; }
.field .flabel { font-family: var(--font-display); font-size: 12.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.field .fval { font-family: var(--font-display); font-weight: 700; font-size: 40px; line-height: 1.1; color: var(--navy); min-height: 44px; overflow-wrap: anywhere; }
.field .fval.placeholder { color: #B9C3D3; }
.field.active { border-color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); background: #F5F9FF; }
.field.dmg .fval { color: var(--danger); }
.field.dmg.active { border-color: var(--danger); box-shadow: inset 0 0 0 2px var(--danger); background: #FFF7F8; }
.field.fresh .fval { background: rgba(57,130,255,.16); border-radius: 6px; padding: 0 4px; justify-self: start; }
.nf-banner { padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-fg); font-family: var(--font-display); font-weight: 600; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key { min-height: 62px; border-radius: 14px; border: 0; background: var(--surface); box-shadow: 0 1px 0 var(--line-strong), 0 0 0 1px var(--line); font-family: var(--font-display); font-weight: 600; font-size: 28px; color: var(--navy); }
.key:active { background: #DCE8FB; }
.key.fn { font-size: 20px; background: var(--surface-2); }
.extras { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.notebox { display: grid; gap: 8px; }
.photo-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.sheet-foot { background: var(--surface); border-top: 1px solid var(--line); }
.sheet-foot .wrap { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; padding-block: 10px; }
.req { color: var(--danger); }
.newname { display: grid; gap: 6px; }
.newname label, .lbl { font-family: var(--font-display); font-weight: 600; font-size: 13.5px; }

/* ---------- review ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 10px 12px; display: grid; gap: 2px; }
.stat b { font-family: var(--font-display); font-size: 26px; line-height: 1.1; color: var(--blue); }
.stat span { font-size: 12px; color: var(--muted); }
.stat.warn b { color: var(--warn-fg); }
.stat.bad b { color: var(--danger); }
.rv-line { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.rv-line:last-child { border-bottom: 0; }
.rv-line .txt { flex: 1; min-width: 0; }
.rv-line .nm { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; }
.rv-line .sub { font-size: 12.5px; color: var(--muted); }
.confirm { padding: 14px; display: grid; gap: 10px; border-color: var(--danger); }
.details { padding: 14px; display: grid; gap: 10px; }
.details .hint { margin: 0; }
.details-row { display: grid; grid-template-columns: auto minmax(0, 240px); gap: 12px; align-items: center; }
.danger-link { color: var(--danger); justify-self: start; }
pre.json { margin: 0; padding: 12px; font-size: 11.5px; line-height: 1.4; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 280px; white-space: pre; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-family: var(--font-display); font-weight: 500; font-size: 14.5px; z-index: 60; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.bad { background: var(--danger); }

@media (min-width: 640px) {
  .areas { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .choice.wide { grid-column: span 2; }
  .choices.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choices.three .choice.wide { grid-column: auto; }
  .keypad .key { min-height: 68px; }
}
@media (max-height: 640px) {
  .key { min-height: 52px; font-size: 24px; }
  .field { min-height: 70px; }
  .field .fval { font-size: 32px; min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) { .progress i { transition: none; } }

/* ---------- v0.3 additions ---------- */
.danger-link { color: var(--danger); justify-self: start; }
.details { padding: 14px; display: grid; gap: 10px; }
.details .hint { margin: 0; }
.details-row { display: grid; grid-template-columns: auto minmax(0, 260px); gap: 12px; align-items: center; }
.date-in { max-width: 260px; }
.tools { display: grid; gap: 10px; }
.weekly { padding: 12px 14px; }
.weekly b { font-family: var(--font-display); }
.weekly ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.weekly li { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 4px; }
.weekly .loc { font-family: var(--font-display); font-weight: 600; color: var(--blue); }
.start-grid { display: grid; gap: 18px; }
.item.disabled { opacity: .6; cursor: default; }
.item.current { box-shadow: inset 4px 0 0 var(--blue); background: #F5F9FF; }
.sent { padding: 16px; display: grid; gap: 10px; border-color: var(--ok); }
.sent h2 { font-size: 20px; }
.jsonbox { display: grid; gap: 8px; margin-top: 8px; }
.rtv-hint { margin: -8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); font-family: var(--font-display); font-weight: 500; }
.unit-hint { margin: -4px 0 0; font-size: 14px; color: var(--muted); }
.field.locked { opacity: .45; }
.key:disabled { background: transparent; box-shadow: none; }
.rv-qty { font-size: 20px; }
.ob-item .hint { margin: 0; }

/* iPad and up: bigger reading sizes */
@media (min-width: 768px) {
  body { font-size: 16px; }
  .item .nm { font-size: 17px; }
  .item .sub, .group-head .cnt, .status, .hint { font-size: 14px; }
  .group-head .lbl { font-size: 15.5px; }
  .start-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .start-grid .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main.wrap, .band .wrap, .status .wrap, .actionbar .wrap { max-width: 900px; }
  .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .key { min-height: 72px; font-size: 30px; }
}
/* iPad landscape / desktop: number pad docks on the right, list stays visible */
@media (min-width: 960px) {
  body.pad-open .sheet { left: auto; width: 440px; border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(7,7,78,.10); }
  body.pad-open .sheet .wrap { max-width: none; }
  body.pad-open main.wrap, body.pad-open .band .wrap, body.pad-open .status .wrap, body.pad-open .actionbar .wrap { max-width: none; margin-left: 0; margin-right: 440px; }
  body.pad-open .toast { left: calc((100vw - 440px) / 2); }
  .sheet .key { min-height: 64px; }
}
/* tall iPad portrait: use the height for the number pad */
@media (min-width: 768px) and (max-width: 959px) and (min-height: 1000px) {
  .key { min-height: 104px; font-size: 36px; }
  .field { min-height: 110px; }
  .field .fval { font-size: 52px; }
}
/* ---------- v0.4: account card ---------- */
.account { padding: 14px; display: grid; gap: 8px; }
.account.info { border-color: var(--sky); }
.account.bad { border-color: var(--danger); background: var(--danger-bg); }
.account .hint { margin: 0; }
.acct-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.signin { display: grid; gap: 8px; max-width: 520px; }
.signin input { width: 100%; }
input[type="email"], input[type="password"] { font-size: 17px; color: var(--fg); background: var(--surface); border: 2px solid var(--line-strong); border-radius: 12px; padding: 0 14px; min-height: var(--tap); }
.err { color: var(--danger); font-weight: 600; font-size: 15px; }

/* ---------- v0.5: photo lost on the iPad ---------- */
.photo-fix { display: grid; gap: 8px; }
.fix-line { padding: 12px 14px; display: grid; gap: 8px; border-color: var(--danger); }
.fix-line .hint { margin: 0; }
.confirm-inline { display: grid; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--danger-bg); }
