/* SGD Field App — phone-first shared styles */
:root {
  --bg: #0a0a0a;
  --card: #141414;
  --line: #262626;
  --text: #ffffff;
  --muted: #878a8d;
  --accent: #f7ec00; /* SGD yellow — single accent only */
  --ok: #34c759;
  --warn: #ff9f0a;
  --danger: #ff453a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.wrap { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }
.brand { font-weight: 800; letter-spacing: .04em; font-size: 13px; color: var(--accent); text-transform: uppercase; }
h1 { font-size: 22px; margin: 6px 0 2px; line-height: 1.2; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.status-badge { display: inline-block; padding: 6px 12px; border-radius: 999px; background: #000; border: 1px solid var(--accent); color: var(--accent); font-weight: 700; font-size: 14px; text-transform: capitalize; }
.desc { white-space: pre-wrap; color: #dcdcdc; font-size: 15px; line-height: 1.5; }
.btn {
  display: block; width: 100%; padding: 18px; margin: 10px 0; border: none; border-radius: 14px;
  font-size: 18px; font-weight: 700; cursor: pointer; color: #111; background: var(--accent);
}
.btn:active { transform: scale(.99); }
.btn.secondary { background: #2a2a2a; color: var(--text); border: 1px solid var(--line); font-size: 16px; padding: 14px; }
.btn[disabled] { opacity: .5; }
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 22px 0 6px; }
input[type="password"], input[type="text"] {
  width: 100%; padding: 16px; font-size: 18px; border-radius: 12px; border: 1px solid var(--line);
  background: #000; color: var(--text); margin: 8px 0;
}
.overlay { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.overlay .card { width: 100%; max-width: 360px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ok); color: #062; font-weight: 700; padding: 12px 18px; border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.4); opacity: 0; transition: opacity .2s; z-index: 60;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); color: #fff; }
.hidden { display: none !important; }
.spinner { color: var(--muted); text-align: center; padding: 40px; }
.contact { display: block; padding: 13px 0; color: var(--text); text-decoration: none; font-size: 15px; border-top: 1px solid var(--line); }
.contact:first-child { border-top: none; padding-top: 4px; }
.contact:active { color: var(--accent); }

/* Install queue */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter-btn { flex: 0 0 auto; padding: 9px 15px; border-radius: 999px; border: 1px solid var(--line); background: #1c1c1c; color: var(--text); font-size: 14px; font-weight: 600; white-space: nowrap; }
.filter-btn.active { background: var(--accent); color: #111; border-color: var(--accent); }
.dim { opacity: .55; }
.queue-item { display: flex; align-items: center; gap: 12px; padding: 14px; margin: 10px 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--text); }
.queue-item:active { border-color: var(--accent); }
.queue-item.done { opacity: .6; }
.queue-item.done .qi-date { color: var(--ok); }
.qi-date { font-size: 12px; font-weight: 800; color: var(--accent); min-width: 56px; text-align: center; line-height: 1.25; text-transform: uppercase; }
.qi-main { flex: 1; min-width: 0; }
.qi-name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qi-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qi-arrow { color: var(--muted); font-size: 22px; }
.empty { color: var(--muted); padding: 14px 4px; font-style: italic; }
.back { display: inline-block; color: var(--accent); text-decoration: none; margin: 0 0 10px; font-weight: 600; }
.thumb { max-width: 100%; border-radius: 10px; margin: 8px 0; border: 1px solid var(--line); display: block; }

/* M3 capture + complete */
.cap-group { margin: 14px 0; }
.cap-sub { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.sel { width: 100%; padding: 12px; font-size: 16px; border-radius: 10px; border: 1px solid var(--line); background: #000; color: var(--text); margin-bottom: 8px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb-wrap { position: relative; width: 76px; height: 76px; }
.thumb-sm { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumb-tag { position: absolute; right: 3px; bottom: 3px; background: rgba(0,0,0,.7); color: var(--muted); font-size: 12px; padding: 1px 5px; border-radius: 6px; }
.thumb-tag.ok { color: var(--ok); }
.thumb-tag.bad { color: var(--danger); }
.toggle { display: flex; gap: 8px; margin-bottom: 12px; }
.toggle-btn { flex: 1; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: #2a2a2a; color: var(--text); font-size: 15px; font-weight: 600; }
.toggle-btn.active { background: var(--accent); color: #111; border-color: var(--accent); }
.sigpad { width: 100%; height: 180px; background: #000; border: 1px dashed var(--line); border-radius: 10px; touch-action: none; display: block; margin-bottom: 8px; }

/* ── Desktop / wide screens (phone layout untouched below 768px) ─────────── */
@media (min-width: 768px) {
  .wrap { max-width: 960px; padding: 28px 24px 60px; }

  /* Install queue → 2-column card grid */
  #readyList, #upcomingList, #doneList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  #readyList .queue-item, #upcomingList .queue-item, #doneList .queue-item { margin: 0; }
  #readyList .empty, #upcomingList .empty, #doneList .empty { grid-column: 1 / -1; }

  /* Job detail → use the horizontal space. Back link, job header, and the
     complete-install card span full width; customer / instructions / files
     flow into two columns between them. */
  #detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }
  #detail > .card { margin: 0; }
  #detail > .back,
  #detail > .card:first-of-type,
  #detail > .card:last-child {
    grid-column: 1 / -1;
  }
}
