/* Light, high-contrast, large targets: built for one-handed use in sunlight. */
:root {
  --navy: #12263f; --ink: #0d1b2a; --mut: #5b6878; --line: #d5dbe3; --bg: #f3f5f8; --card: #fff;
  --accent: #0b57d0; --accent-soft: #e6effd; --ok: #18794e; --red: #c62828; --red-soft: #fdecec;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
button:disabled { opacity: .45; cursor: default; }
h1, h2, h3, p { margin: 0; }
#app { max-width: 720px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* header */
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  background: var(--navy); color: #fff; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); min-height: 60px; }
.bar h1 { font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar > h1, .bar .title { flex: 1; min-width: 0; color: #fff; }
.hbtn { min-height: 44px; padding: 0 14px; border-radius: 10px; font-weight: 600; font-size: 15px;
  background: rgba(255, 255, 255, .14); color: #fff; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.hbtn.back { font-size: 30px; line-height: 1; padding: 0 14px 4px; }
.hbtn.solid { background: #fff; color: var(--navy); }
.laser .dot { width: 10px; height: 10px; border-radius: 50%; background: #9aa7b6; }
.laser.on .dot { background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, .3); }
.laser.connecting .dot { background: #ffc233; }

/* home */
.search { padding: 12px 12px 4px; }
.search input, .panel input:not([type=file]) { width: 100%; height: 54px; border: 2px solid var(--line); border-radius: 12px;
  padding: 0 14px; background: #fff; font-size: 18px; }
.search input:focus, .panel input:focus { outline: none; border-color: var(--accent); }
main { padding: 12px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.rmain { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 14px 8px 14px 16px; min-height: 68px; }
.rmain:active { background: var(--accent-soft); }
.rname { font-size: 19px; font-weight: 650; }
.rsub { color: var(--mut); font-size: 14.5px; }
.redit { flex: none; align-self: center; min-height: 48px; margin-right: 10px; padding: 0 16px; border-radius: 10px; border: 2px solid var(--line);
  font-weight: 650; font-size: 15px; color: var(--accent); }
.empty { padding: 36px 20px; text-align: center; color: var(--mut); }
.empty b { display: block; color: var(--ink); font-size: 19px; margin-bottom: 4px; }

/* bottom bar */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 10px; justify-content: center;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 26%); }
.primary { flex: 1; max-width: 696px; min-height: 60px; border-radius: 14px; background: var(--accent); color: #fff;
  font-size: 19px; font-weight: 700; text-align: center; padding: 0 18px; box-shadow: 0 2px 8px rgba(11, 87, 208, .3); }
.primary.alt { background: var(--navy); box-shadow: none; }
.primary.red { background: var(--red); box-shadow: none; }
.primary:active { filter: brightness(.9); }

/* section tabs */
.tabs { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 4; display: flex; gap: 8px; overflow-x: auto;
  padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 46px; padding: 0 16px; border-radius: 23px; background: #fff; border: 2px solid var(--line);
  font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tab.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tab b { min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--accent); color: #fff;
  font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; }
.tab.on b { background: #fff; color: var(--navy); }

/* next-reading target */
.next { display: block; width: 100%; padding: 14px 16px; border-radius: 14px; background: var(--accent); color: #fff; margin-bottom: 12px; }
.next span { display: block; }
.nl { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; opacity: .85; }
.nt { font-size: 25px; font-weight: 750; line-height: 1.2; margin: 2px 0; }
.nh { font-size: 14.5px; opacity: .9; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px 12px; color: var(--mut); font-weight: 600; }
.total b { color: var(--ink); font-size: 22px; }

/* item cards */
.item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.item.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.ihead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ilabel { flex: 1; min-width: 0; min-height: 44px; font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.ilabel em, .sum em { font-style: normal; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 6px; }
.pen { color: var(--mut); font-size: 16px; font-weight: 400; }
.ires { font-size: 19px; font-weight: 700; color: var(--ok); white-space: nowrap; }
.fields { display: grid; gap: 8px; grid-template-columns: 1fr; }
.fields.n2 { grid-template-columns: 1fr 1fr; }
.field { min-height: 86px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
  display: flex; flex-direction: column; justify-content: center; }
.field .fn { font-size: 13.5px; font-weight: 700; color: var(--mut); text-transform: uppercase; letter-spacing: .05em;
  display: flex; justify-content: space-between; }
.field .fn i { font-style: normal; background: var(--accent); color: #fff; padding: 0 7px; border-radius: 5px; letter-spacing: .06em; }
.field .fv { font-size: 29px; font-weight: 750; line-height: 1.15; }
.field .fr { font-size: 13px; color: var(--mut); }
.field.blank .fv { color: #a3adba; }
.field.opt { min-height: 66px; }
.field.opt.blank { border-style: dashed; }
.field.opt.blank .fv { font-size: 17px; font-weight: 500; }
.field.opt .fv { font-size: 23px; }
.field.armed { border-color: var(--accent); border-width: 3px; background: var(--accent-soft); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.chk { min-height: 56px; padding: 0 12px; border: 2px solid var(--line); border-radius: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 10px; background: #fff; }
.chk .box { flex: none; width: 26px; height: 26px; border: 2px solid #8794a5; border-radius: 6px; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 800; color: #fff; }
.chk.on { border-color: var(--ok); background: #e8f5ee; }
.chk.on .box { background: var(--ok); border-color: var(--ok); }
.iact { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.iact button { min-height: 44px; padding: 0 10px; font-weight: 600; color: var(--accent); font-size: 15.5px; }
.danger, .iact .danger { color: var(--red); }

/* accessory counters */
.acc { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 12px 4px; margin-top: 16px; }
.acc h2 { font-size: 13.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); padding: 10px 0 4px; }
.crow { display: grid; grid-template-columns: 1fr 64px 52px 64px; align-items: center; gap: 6px; padding: 7px 0; border-top: 1px solid var(--line); }
.crow span { font-weight: 600; font-size: 18px; }
.crow b { text-align: center; font-size: 26px; }
.pm { height: 58px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 32px; font-weight: 700;
  text-align: center; line-height: 1; }
.pm:active { background: var(--accent); color: #fff; }

/* sheets */
#sheet { display: none; position: fixed; inset: 0; z-index: 20; background: rgba(13, 27, 42, .55); align-items: flex-end; justify-content: center; }
#sheet.show { display: flex; }
.panel { width: 100%; max-width: 720px; max-height: 94vh; overflow-y: auto; background: #fff; border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.panel h2 { font-size: 21px; }
.panel h3 { font-size: 13.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); }
.panel label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 15px; color: var(--mut); }
.panel label input { color: var(--ink); font-weight: 500; }
.prow { display: flex; gap: 10px; }
.prow .primary { min-height: 58px; }
.ghost { min-height: 58px; padding: 0 18px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 650; text-align: center; }
.ghost.danger { border-color: #f2c4c4; }
.ghost.wide { width: 100%; min-height: 50px; }
.confirm p { font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px; }
.chips + .chips { border-top: 1px solid var(--line); padding-top: 12px; }
.chip { min-height: 50px; padding: 0 16px; border-radius: 25px; border: 2px solid var(--line); background: #fff; font-weight: 600; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.mrow { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 14px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.mrow b { font-size: 18px; color: var(--ink); }
.mrow span { color: var(--mut); font-size: 14.5px; font-weight: 400; }
.log { margin: 0; max-height: 180px; overflow: auto; background: #0d1b2a; color: #cfe3ff; border-radius: 10px; padding: 10px;
  font: 12.5px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }

/* keypad */
.khead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.khead .ghost { min-height: 44px; }
.kdisp { background: var(--accent-soft); border: 2px solid var(--accent); border-radius: 14px; padding: 10px 14px; min-height: 92px;
  display: flex; flex-direction: column; justify-content: center; }
.kin { font-size: 36px; font-weight: 750; line-height: 1.15; }
.kin i { font-style: normal; color: #8ea3c4; font-weight: 500; }
.kout { color: var(--mut); font-size: 16px; font-weight: 600; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keys button { height: 62px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-size: 27px; font-weight: 650; text-align: center; }
.keys button:active { background: var(--accent-soft); }

/* toast */
#toast { position: fixed; left: 12px; right: 12px; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 30; max-width: 696px; margin: 0 auto;
  display: none; align-items: center; gap: 12px; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 12px 12px 16px;
  font-weight: 600; box-shadow: 0 6px 24px rgba(0, 0, 0, .3); }
#toast.show { display: flex; }
#toast span { flex: 1; }
#toast button { min-height: 46px; padding: 0 18px; border-radius: 10px; background: #fff; color: var(--ink); font-weight: 750; }

/* summary */
.sdate { color: var(--mut); font-size: 14.5px; padding: 0 4px 10px; }
.sum { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; overflow: hidden; }
.shead { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #eaf0f8; border-bottom: 1px solid var(--line); }
.shead h2 { flex: 1; font-size: 19px; }
.tv { font-size: 24px; font-weight: 800; }
.sq { color: var(--mut); font-weight: 600; font-size: 15px; }
.sum table { width: 100%; border-collapse: collapse; }
.sum th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--mut); padding: 8px 6px 4px; text-align: right; }
.sum td { padding: 3px 6px; border-top: 1px solid var(--line); text-align: right; font-size: 17px; }
.sum th.l, .sum td.l { text-align: left; padding-left: 14px; }
.sum td.l { font-weight: 600; }
.sum .opt { display: inline-block; margin: 2px 4px 2px 0; padding: 1px 7px; border-radius: 6px; background: #e8f5ee; color: var(--ok);
  font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.sum td.l .opt:first-of-type { margin-left: 0; }
.sum td.l:has(.opt) { padding-top: 8px; padding-bottom: 6px; }
.sum td.l .opt { vertical-align: middle; }
.win td.l { word-break: break-word; }
.win .cp { min-width: 0; padding: 0 3px; white-space: nowrap; }
.win td, .win th { padding-left: 3px; padding-right: 3px; }
.sum th:last-child, .sum td:last-child { padding-right: 12px; }
.mut { color: #9aa5b3; }
.cp { min-height: 44px; min-width: 48px; padding: 0 8px; border-radius: 8px; font-weight: 700; text-align: right; }
.cp:active { background: var(--accent); color: #fff; }
td .cp { font-size: 18px; }
.accs { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid var(--line); }
.accs span { background: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: 15.5px; }

@media (max-width: 400px) {
  .hbtn { padding: 0 10px; font-size: 14px; }
  .bar { gap: 6px; }
  .bar h1 { font-size: 18px; }
  .field .fv { font-size: 26px; }
}
