/* Adventure Filming Field Workflow — field-ready, high-contrast, large touch targets */
:root {
  --bg: #F8F9FA;           /* Off White */
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --ink: #1F2933;          /* Deep Slate */
  --muted: #5f6b76;
  --line: #e3e7eb;
  --topbar: #1F2933;       /* Deep Slate */
  --topbar-ink: #F8F9FA;
  --accent: #F58220;       /* Adventure Orange */
  --accent-ink: #ffffff;
  --brand: #2F6B4F;        /* Forest Green */
  --p-essential: #c5402b;
  --p-recommended: #2f6d8f;
  --p-bonus: #7a7d52;
  --st-thin: #9aa0a6;
  --st-building: #d9822b;
  --st-good: #2e7d32;
  --st-excellent: #009688;
  --st-overlong: #c5402b;
  --radius: 14px;
  --tap: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
#app { display: flex; flex-direction: column; min-height: 100dvh; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
h1, h2, p { margin: 0; }
b { font-weight: 700; }
.muted { color: var(--muted); }
.pad { padding: 16px; }

/* Splash */
.splash { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; text-align: center; background: #0d0f12; }
.splash-fulllogo { width: 86%; max-width: 330px; height: auto; }

/* Home brand header — original logo on black */
.brandhead { position: relative; background: #0d0f12; border-bottom: 1px solid #23272c; text-align: center; padding: 14px 16px; padding-top: calc(12px + var(--safe-top)); }
.brandhead-logo { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto; }
.brandhead-net { position: absolute; top: calc(12px + var(--safe-top)); right: 12px; }
.section-h { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 10px; }
.list .empty { padding: 8px 4px; }
.steps { margin: 0 0 4px; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding: 11px 14px 11px 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; font-size: 14px; line-height: 1.45; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 11px; top: 11px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.howto-note { color: var(--muted); font-size: 13px; margin: 10px 4px 4px; }
.version { text-align: center; color: var(--muted); font-size: 11px; opacity: .7; margin-top: 18px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(26px + var(--safe-bot)); transform: translateX(-50%) translateY(8px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 26px rgba(0,0,0,.32); opacity: 0; transition: opacity .25s ease, transform .25s ease; z-index: 80; pointer-events: none; max-width: 86%; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Save-on-close confirm dialog (bottom sheet) */
.confirm-body { padding: 22px 20px 18px; }
.confirm-title { font-size: 19px; font-weight: 800; margin-bottom: 6px; }
.confirm-msg { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.confirm-actions { display: flex; flex-direction: column; gap: 10px; }
.confirm-actions > * { width: 100%; }
.btn-text { background: none; border: none; color: var(--muted); font-weight: 600; min-height: 44px; }

/* Info buttons + popups */
.info-btn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; min-width: 20px; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; color: var(--muted); font: italic 700 12px/1 Georgia, 'Times New Roman', serif; text-transform: none; padding: 0; margin-left: 6px; vertical-align: middle; flex: 0 0 auto; }
.info-btn:active { background: var(--muted); color: #fff; }
.info-btn.lg { width: 46px; height: 46px; min-width: 46px; font-size: 18px; margin: 0; align-self: center; border-color: var(--line); }
.info-btn.ms-info { width: 42px; min-width: 42px; align-self: stretch; margin: 0; font-size: 16px; }
.t-top .info-btn { align-self: center; }
.actionbar > .btn-ghost { flex: 1; }
.actionbar.trio > button { flex: 1 1 0; min-width: 0; font-size: 12.5px; font-weight: 700; padding: 0 4px; min-height: 50px; line-height: 1.15; white-space: normal; display: flex; align-items: center; justify-content: center; text-align: center; }
.info-msg { color: var(--ink); font-size: 14px; line-height: 1.5; margin-bottom: 18px; }
.info-msg ul { margin: 8px 0 0; padding-left: 20px; }
.info-msg li { margin: 3px 0; }
.info-msg b { font-weight: 700; }
.name-input { width: 100%; box-sizing: border-box; min-height: 50px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 16px; margin-bottom: 16px; background: #fff; color: var(--ink); }
.name-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,130,32,.15); }
.btn-danger { min-height: 52px; border: none; border-radius: 12px; background: var(--p-essential); color: #fff; font-size: 17px; font-weight: 700; width: 100%; }
.saved-intro { margin-bottom: 12px; }
.desc-input { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 16px; margin-bottom: 16px; background: #fff; color: var(--ink); resize: vertical; min-height: 78px; }
.desc-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,130,32,.15); }
.li-desc { font-size: 13px; color: var(--ink); margin-top: 3px; font-style: italic; line-height: 1.35; }
.step-of { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: var(--tap) 1fr var(--tap); align-items: center;
  background: var(--topbar); color: var(--topbar-ink);
  padding-top: var(--safe-top);
  min-height: calc(var(--tap) + 4px);
}
.topbar h1 { text-align: center; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.icon-btn {
  height: var(--tap); min-width: var(--tap); border: none; background: transparent; color: var(--topbar-ink);
  font-size: 26px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px;
}
.icon-btn.ghost { opacity: 0; pointer-events: none; }
.icon-btn.danger { color: #c5402b; font-size: 20px; }
.net { justify-self: end; margin-right: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 4px 8px; border-radius: 999px; }
.net.on { color: #bfe3cf; background: rgba(47,109,79,.35); }
.net.off { color: #f0d49c; background: rgba(217,130,43,.30); }
.step-pill { justify-self: end; margin-right: 12px; font-size: 13px; font-weight: 700; color: var(--topbar-ink); opacity: .85; }

/* Progress */
.progress { height: 4px; background: var(--line); }
.progress .bar { height: 100%; background: var(--accent); transition: width .25s ease; }

/* Screen / scroll area */
.screen { flex: 1; padding: 16px; padding-bottom: 24px; }
.lede { color: var(--muted); margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 20px; text-align: center; }
.step-q { font-size: 20px; font-weight: 700; margin-bottom: 6px; }

/* Home buttons */
.card-btn {
  display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px; color: var(--ink);
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.card-btn.primary { background: var(--brand); color: #fff; border-color: transparent; }
.card-btn .cb-title { font-size: 18px; font-weight: 700; }
.card-btn .cb-sub { font-size: 14px; opacity: .85; margin-top: 2px; }
.card-btn.primary .cb-sub { color: #e7f0ea; }

.stat-row { display: flex; gap: 10px; margin-top: 18px; }
.stat-row > div { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px; text-align: center; }
.stat-row b { display: block; font-size: 22px; }
.stat-row span { font-size: 12px; color: var(--muted); }

/* Category tiles */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  min-height: 92px; text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; color: var(--ink);
}
.tile.sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; }
.tile-t { font-weight: 700; font-size: 15px; line-height: 1.25; }
.tile-n { font-size: 12px; color: var(--muted); }

/* Lists */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-item.sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; }
.li-main { flex: 1; text-align: left; background: transparent; border: none; color: var(--ink); padding: 14px; }
.li-main.as-div { pointer-events: none; }
.btn-row { width: 100%; align-items: center; gap: 8px; padding: 0; }
.btn-row .li-main { padding: 14px; }
.li-title { font-weight: 700; }
.li-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.li-time { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chev, .chev::after { color: var(--muted); }
.chev { padding-right: 14px; align-self: center; font-size: 22px; color: var(--muted); }

/* Radio option cards (importance / coverage) */
.opt { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.opt:has(input:checked), .opt.sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; }
.opt input { margin-top: 3px; width: 22px; height: 22px; accent-color: var(--brand); flex: 0 0 auto; }
.opt-t { font-weight: 700; }
.opt-s { font-size: 14px; color: var(--muted); margin-top: 2px; }
.opt-meta { font-size: 13px; margin-top: 6px; font-weight: 600; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; color: #fff; background: var(--brand); border-radius: 999px; padding: 1px 7px; vertical-align: middle; }

/* Equipment chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; font-size: 14px; font-weight: 600; min-height: 42px; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip.on, .chip:has(input:checked) { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Filming mode segmented controls */
.mode-group { margin-top: 16px; }
.mg-label { font-weight: 700; margin-bottom: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-opt { flex: 1 1 auto; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 10px; font-size: 14px; font-weight: 600; min-height: 46px; display: flex; align-items: center; justify-content: center; }
.seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-opt.on, .seg-opt:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Action bar (sticky footer) */
.actionbar { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 10px; padding: 12px 16px calc(12px + var(--safe-bot)); background: linear-gradient(to top, var(--bg) 70%, rgba(243,241,234,0)); }
.actionbar.two > * { flex: 1; }
.btn-primary { flex: 1; min-height: 52px; border: none; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 700; }
.btn-ghost { min-height: 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-weight: 700; padding: 0 16px; }

/* Build header (sticky cluster) */
.build-top { position: sticky; top: 0; z-index: 25; background: var(--bg); box-shadow: 0 1px 0 var(--line); }
.chips.small { padding: 12px 16px 4px; gap: 6px; }
.chip-ro { font-size: 12px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; color: var(--ink); }
.chip-edit { font-size: 12px; font-weight: 700; background: transparent; border: 1px dashed var(--muted); border-radius: 999px; padding: 4px 9px; color: var(--muted); }

/* Timing bar */
.timing { padding: 8px 16px 10px; }
.t-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.t-now { font-size: 26px; font-weight: 800; }
.t-of { font-size: 13px; color: var(--muted); }
.t-status { margin-left: auto; font-size: 13px; font-weight: 800; }
.t-track { position: relative; height: 12px; background: var(--line); border-radius: 999px; margin: 8px 0 4px; overflow: hidden; }
.t-fill { height: 100%; border-radius: 999px; transition: width .2s ease; background: var(--st-thin); }
.t-mark { position: absolute; top: -2px; width: 2px; height: 16px; background: rgba(0,0,0,.18); }
.t-bot { font-size: 12px; color: var(--muted); }
.st-thin .t-fill { background: var(--st-thin); } .st-thin .t-status { color: var(--st-thin); }
.st-building .t-fill { background: var(--st-building); } .st-building .t-status { color: var(--st-building); }
.st-good .t-fill { background: var(--st-good); } .st-good .t-status { color: var(--st-good); }
.st-excellent .t-fill { background: var(--st-excellent); } .st-excellent .t-status { color: var(--st-excellent); }
.st-overlong .t-fill { background: var(--st-overlong); } .st-overlong .t-status { color: var(--st-overlong); }

/* Warnings */
.warn { margin: 0 16px 8px; padding: 9px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.warn.amber { background: #fbe2c6; color: #7a4a10; }
.warn.ok { background: #d7ecd9; color: #1f5b22; }

/* Plan/Film switch */
.modeswitch { display: flex; gap: 6px; padding: 4px 16px 12px; }
.modeswitch .ms { flex: 1; min-height: 42px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; font-weight: 700; color: var(--muted); }
.modeswitch .ms.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Groups + shot cards */
.build { padding-top: 12px; }
.group { margin-bottom: 18px; }
.group h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.group h2 .count { background: var(--line); color: var(--ink); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.g-essential h2 { color: var(--p-essential); }

.shot { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.shot.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; }
.shot > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px; min-height: var(--tap); }
.shot > summary::-webkit-details-marker { display: none; }
.shot-head { flex: 1; display: flex; flex-direction: column; }
.shot-name { font-weight: 700; line-height: 1.25; }
.shot-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.shot-meta.blocked { color: var(--p-essential); font-weight: 600; }
.disc { color: var(--muted); font-size: 14px; transition: transform .15s; }
.shot[open] .disc { transform: rotate(180deg); }
.shot.disabled { opacity: .6; }
.shot.disabled .shot-head { padding: 10px 12px; }

.ptag { display: inline-block; font-size: 11px; font-weight: 800; color: #fff; border-radius: 5px; padding: 1px 5px; margin-right: 4px; vertical-align: 1px; }
.p-essential { background: var(--p-essential); }
.p-recommended { background: var(--p-recommended); }
.p-bonus { background: var(--p-bonus); }

/* Custom checkbox */
.ck { display: inline-flex; align-items: center; justify-content: center; padding: 2px; }
.ck input, .filmrow input { position: absolute; opacity: 0; width: 0; height: 0; }
.ckbox { width: 26px; height: 26px; border: 2px solid var(--muted); border-radius: 7px; display: inline-block; position: relative; flex: 0 0 auto; }
.ckbox.big { width: 30px; height: 30px; }
input:checked + .ckbox { background: var(--brand); border-color: var(--brand); }
input:checked + .ckbox::after { content: ""; position: absolute; left: 8px; top: 3px; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.ckbox.big.big::after, input:checked + .ckbox.big::after { left: 10px; top: 4px; }

/* Shot body details */
.shot-body { padding: 0 12px 14px 12px; border-top: 1px dashed var(--line); }
.purpose { font-style: italic; color: var(--ink); margin: 10px 0; }
.kv { display: grid; grid-template-columns: 78px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--surface-2); font-size: 14px; }
.kv > span { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding-top: 2px; }
.kv ul { margin: 4px 0 0; padding-left: 18px; }
.kv.safety { background: #fceae6; border-radius: 8px; padding: 8px; margin-top: 6px; }
.kv.safety > span { color: var(--p-essential); }
.eq { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; margin: 2px 4px 2px 0; font-size: 13px; }
.eq.opt { color: var(--muted); }

/* Film mode rows */
.shot.film { padding: 0; }
.filmrow { display: flex; align-items: center; gap: 12px; padding: 14px 12px; min-height: var(--tap); }
.shot.film.done { background: #f2f8f2; border-color: #bfe0c2; }
.shot.film.done .shot-name { text-decoration: line-through; color: var(--muted); }
.film-detail { border-top: 1px dashed var(--line); }
.film-detail > summary { padding: 10px 12px; color: var(--brand); font-weight: 700; font-size: 14px; list-style: none; }
.film-detail > summary::-webkit-details-marker { display: none; }
.note { width: 100%; min-height: 60px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; margin: 0 0 12px; resize: vertical; }

.unavail { margin-top: 4px; }
.unavail > summary { color: var(--muted); font-size: 13px; padding: 8px 4px; cursor: pointer; }
.locked-note { color: var(--muted); font-size: 14px; text-align: center; margin: 12px 0; }
.linklike { background: none; border: none; color: var(--brand); font-weight: 700; text-decoration: underline; padding: 0; }

/* Export modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(20,26,19,.5); display: flex; align-items: flex-end; }
.sheet { background: var(--bg); width: 100%; max-height: 88dvh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; padding-bottom: var(--safe-bot); }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sheet-bar .icon-btn { color: var(--ink); }
.sheet-body { overflow: auto; padding: 16px; }
.exp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.exp-actions > * { flex: 1 1 40%; min-height: 46px; }
.exp-pre { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }

@media (min-width: 620px) {
  #app { max-width: 560px; margin: 0 auto; box-shadow: 0 0 40px rgba(0,0,0,.08); }
  .grid { grid-template-columns: 1fr 1fr 1fr; }
}
