/* Field capture page (phone-first) */
#collect { padding-bottom: 24px; }
.sync {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 0 0 12px; padding: 10px 12px 10px 14px; border-radius: 12px; font-size: .92rem; font-weight: 600;
  background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--yellow);
}
.sync.offline { border-left-color: #b45309; }
.sync.bad { border-left-color: #b42318; }
.sync .btn { min-height: 40px; padding: 4px 14px; font: inherit; font-weight: 700; cursor: pointer; }

.cform { display: grid; gap: 14px; }
.cform fieldset { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); display: grid; gap: 12px; min-width: 0; }
.cform legend { padding: 0 6px; font-weight: 800; }
.cform label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; min-width: 0; }
.cform label .opt { color: var(--muted); font-weight: 500; }
.cform input[type="text"], .cform input[type="tel"], .cform input[type="url"], .cform select, .cform textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--ink); font: inherit; font-weight: 400;
}
.cform textarea { min-height: 84px; resize: vertical; }
.cform :is(input, select, textarea):focus-visible, .cform summary:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.cform input:disabled { opacity: .5; }

.pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick label.filebtn, .pick button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center;
  min-height: 74px; padding: 8px 4px; border-radius: 12px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer;
}
.pick .ico { font-size: 1.6rem; line-height: 1; }
.pick label.filebtn:active, .pick button:active { transform: scale(.97); }
.pick input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pick label.filebtn:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }

.thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.thumbs li { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--yellow); color: var(--black); display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.thumbs img, .thumbs video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumbs .x {
  position: absolute; top: 3px; right: 3px; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--black); color: var(--yellow); font-size: 1.1rem; line-height: 1; font-weight: 800;
}
.thumbs .kind { position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: 6px; font-size: .7rem; font-weight: 800; background: var(--black); color: var(--yellow); }
.check { display: flex !important; grid-template-columns: none; align-items: center; gap: 10px !important; min-height: var(--tap); font-weight: 600; }
.check input { width: 22px; height: 22px; flex: none; }
.check[hidden] { display: none !important; }

.gps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.gps .btn { min-height: 44px; font: inherit; font-weight: 700; cursor: pointer; }
.gps output { color: var(--muted); font-size: .92rem; }

.chipset { display: flex; flex-wrap: wrap; gap: 8px; }
.chipset .fchip { min-height: 44px; }
.cform details { border-top: 1px dashed var(--line); padding-top: 8px; }
.cform summary { min-height: 44px; display: flex; align-items: center; font-weight: 800; cursor: pointer; }
.cform details > .stack { display: grid; gap: 12px; margin-top: 6px; }

.savebar { position: sticky; bottom: 0; z-index: 5; display: grid; gap: 8px; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 22%); }
.savebar .btn { width: 100%; font: inherit; font-weight: 800; cursor: pointer; }
.savebar .btn:disabled { opacity: .6; }

.entries h2 { margin: 22px 0 8px; font-size: 1.15rem; }
.entry { display: grid; gap: 8px; margin-bottom: 10px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.entry-top { display: flex; gap: 10px; align-items: center; }
.entry .mini { flex: none; width: 52px; height: 52px; border-radius: 10px; background: var(--yellow); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; overflow: hidden; position: relative; color: var(--black); }
.entry .mini img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.entry h3 { margin: 0; font-size: 1rem; line-height: 1.25; overflow-wrap: anywhere; }
.entry .meta { margin: 0; }
.entry .state { margin: 0; font-weight: 700; font-size: .9rem; }
.entry .state.ok { color: #17803d; }
.entry .state.err { color: #b42318; }
.entry .state.wait { color: #b45309; }
@media (prefers-color-scheme: dark) { .entry .state.ok { color: #4ade80; } .entry .state.err { color: #f87171; } .entry .state.wait { color: #fbbf24; } }
.entry .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.entry .bar i { display: block; height: 100%; background: var(--yellow); outline: 1px solid var(--black); width: 0; }
.entry-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.entry-acts button { min-height: 42px; padding: 4px 14px; border-radius: 10px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.need { text-align: center; padding: 24px 12px; }
.need[hidden], .cform[hidden], .entries[hidden], .sync[hidden] { display: none; }

@media (min-width: 600px) {
  .cform { max-width: 640px; }
  .pick { max-width: 460px; }
}

/* fixes: hidden buttons stay hidden; label text and "(optional)" stay on one line */
.sync .btn[hidden], .savebar .btn[hidden], #clear-done[hidden], #mem-note[hidden] { display: none; }
.cform label { display: block; }
.cform label > :is(input, select, textarea) { display: block; margin-top: 4px; }
.cform label > small { display: block; margin-top: 4px; }
.cform label[hidden] { display: none; }
#clear-done { width: 100%; font: inherit; font-weight: 700; cursor: pointer; }
