/* ── PWB Cam — app styles ─────────────────────────────────── */
:root {
  --navy: #1B3A66;
  --blue: #2456A6;
  --cyan: #17AEDF;
  --orange: #F0A32E;
  --ink: #22344C;
  --muted: #64748C;
  --ground: #F2F7FB;
  --card: #FFFFFF;
  --line: #D9E4EE;
  --danger: #C0392B;
  --good: #1E9E6A;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", -apple-system, Roboto, Arial, sans-serif;
  background: var(--ground); color: var(--ink);
  font-size: 16px; line-height: 1.5;
}
h1, h2, h3 { color: var(--navy); margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.error { color: var(--danger); font-size: 14px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  background: var(--navy); color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
}
.topbar h1 { color: #fff; font-size: 17px; flex: 1; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-logo { height: 30px; background: #fff; border-radius: 6px; padding: 2px 4px; }
.icon-btn {
  background: rgba(255,255,255,.12); color: #fff; border: none;
  font-size: 20px; width: 38px; height: 38px; border-radius: 8px; cursor: pointer;
}
.content { padding: 14px; max-width: 760px; margin: 0 auto; padding-bottom: 60px; }

/* Cards, forms, buttons */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px; margin-bottom: 12px;
}
.form label { display: block; margin-bottom: 10px; font-weight: 600; color: var(--navy); font-size: 14px; }
.form input:not([type=checkbox]), .form select, .login-wrap input {
  display: block; width: 100%; margin-top: 4px;
  padding: 11px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; }
legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
.check { display: block; font-weight: 400 !important; margin: 2px 0 !important; }
.btn {
  display: inline-block; text-align: center; text-decoration: none;
  background: #fff; color: var(--navy);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 16px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.btn.danger { background: none; border-color: var(--danger); color: var(--danger); margin-top: 18px; }
.btn.wide { display: block; width: 100%; }
.btn:disabled { opacity: .55; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.row input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.row select { padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; flex: 1; }

/* Login */
.login-wrap { max-width: 380px; margin: 0 auto; padding: 56px 22px; text-align: center; }
.login-logo { width: 160px; max-width: 60%; margin-bottom: 10px; }
.login-wrap form { text-align: left; margin-top: 18px; }
.login-wrap label { display: block; font-weight: 600; color: var(--navy); font-size: 14px; margin-bottom: 10px; }

/* Jobs list */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.toolbar input { flex: 1; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; }
.job-row { display: flex; width: 100%; align-items: center; gap: 10px; text-align: left; cursor: pointer; }
.job-row-main { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.job-row-main strong { color: var(--navy); }
.job-row-main span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.status-Booked { background: #E8F1FB; color: var(--blue); }
.status-Inprogress { background: #FDF3E2; color: #B87A14; }
.status-Done { background: #E6F6EF; color: var(--good); }
.status-Shared { background: #E5F7FC; color: #0E7FA6; }

/* Capture buttons */
.capture-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.btn.capture { padding: 13px 4px; font-size: 13.5px; }
.btn.capture.before { border-color: var(--blue); color: var(--blue); }
.btn.capture.after { border-color: var(--good); color: var(--good); }
.btn.capture.finding { border-color: var(--orange); color: #B87A14; }
.btn.capture.video { border-color: var(--muted); color: var(--muted); }

/* Media grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin-bottom: 16px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #dde7f0; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; top: 5px; left: 5px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px; color: #fff;
}
.badge-before { background: var(--blue); }
.badge-after { background: var(--good); }
.badge-finding { background: var(--orange); }
.badge-compare { background: var(--navy); }

.combine-btn { margin-bottom: 12px; border-color: var(--navy); }
.tile.pick { cursor: pointer; }
.tile.pick:active { outline: 3px solid var(--cyan); }
.pick-grid { margin-top: 14px; }
.finding-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.55); color: #fff; font-size: 10.5px; padding: 3px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Photo viewer */
.tile { cursor: pointer; }
.play-ic {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: #fff; font-size: 22px; text-shadow: 0 1px 6px rgba(0,0,0,.6); pointer-events: none;
}
.viewer {
  position: fixed; inset: 0; z-index: 100; background: rgba(8,14,22,.96);
  display: flex; flex-direction: column;
}
.viewer-top {
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
}
.viewer-top .icon-btn { text-decoration: none; display: flex; align-items: center; justify-content: center; }
.viewer-info { flex: 1; color: #C2D2E4; font-size: 13.5px; text-align: center; }
.viewer-body { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 8px; }
.viewer-body img, .viewer-body video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.viewer-finding { color: #F5B44E; font-size: 14px; text-align: center; margin: 0; padding: 0 16px 6px; }
.viewer-actions {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 16px);
}
.viewer-actions select {
  padding: 10px 12px; border-radius: 8px; border: 1px solid #3a4d63;
  background: #16222f; color: #fff; font-size: 15px;
}
.viewer-actions .muted { color: #8CA2BC; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Sheet menu */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15,30,50,.45); z-index: 50; display: flex; align-items: flex-end; }
.sheet { background: #fff; width: 100%; border-radius: 16px 16px 0 0; padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px); }
.sheet .btn { margin-bottom: 8px; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; transition: all .25s; z-index: 99; pointer-events: none;
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
