/* AI Network Job Cam — black & white theme (grok.com style) with one green accent. */
:root {
  --bg: #000;            /* page */
  --surface: #111;       /* cards */
  --surface-2: #161616;  /* rows inside cards, inputs */
  --surface-3: #1c1c1c;  /* hover / pressed */
  --border: #262626;
  --border-strong: #3a3a3a;
  --text: #fff;
  --muted: #9a9a9a;      /* 6.7:1 on #111, 7.5:1 on #000 */
  --green: #35771f;      /* accent for button/badge BACKGROUNDS (user's pick: the 'Go' button green) */
  --green-text: #4a9a2e; /* same hue, lighter: green TEXT and thin lines on black (5.9:1 on #000, 5.1:1 on #161616) */
  --green-press: #2c6419;
  --on-green: #fff;      /* white on #35771f = 5.5:1 (black would be 3.8:1) */
  --red: #dc2626;          /* white text 4.8:1 */
  --red-text: #ff6b6b;
  --amber: #fbbf24;
  --radius: 14px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
}
* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--green-text); }
h1, h2, h3, h4 { letter-spacing: -0.01em; font-weight: 650; }
h3 { margin: 0 0 0.75rem; font-size: 1.1rem; }
h4 { margin: 1.25rem 0 0.5rem; font-size: 0.95rem; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.muted { color: var(--muted); }

/* Header */
.header {
  background: rgba(0, 0, 0, 0.88);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  font-weight: 600;
  font-size: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
}
.header img { height: 28px; width: auto; flex: none; }
.login-box .header { position: static; background: none; border: none; justify-content: center; padding: 1.5rem 0 1rem; font-size: 1.15rem; flex-direction: column; gap: 14px; }
.login-box .header img { height: 44px; }
.hdr-title { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.15; }
.hdr-name { font-size: 0.98rem; font-weight: 650; }
.hdr-user { font-size: 0.78rem; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-logout { background: none; border: 1px solid var(--border-strong); color: var(--text); font-size: 0.8rem; padding: 0.35rem 0.7rem; border-radius: 999px; cursor: pointer; flex: none; }

/* Bottom nav: black, white labels, colorful emoji, green active */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #000;
  display: flex;
  border-top: 1px solid var(--border);
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
  /* 10 tabs don't fit a phone: swipe sideways, no visible scrollbar, snap to whole tabs */
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
}
.bottom-nav::-webkit-scrollbar { display: none; }
.bottom-nav.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.bottom-nav button {
  flex: 1 0 auto;
  min-width: 60px; /* ~6.5 tabs on a 390px phone, so the half-cut tab shows there's more */
  scroll-snap-align: start;
  white-space: nowrap;
  padding: 0.55rem 0.1rem 0.45rem;
  background: none;
  border: none;
  border-top: 2px solid transparent;
  color: #e6e6e6;
  font-size: 0.64rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-radius: 0;
  margin: 0;
  width: auto;
}
.bottom-nav button.active { color: var(--green-text); border-top-color: var(--green-text); font-weight: 650; }
.bottom-nav .icon { font-size: 1.35rem; line-height: 1; }

/* Layout */
.section { padding: 1rem 1rem 1.75rem; display: none; max-width: 720px; margin: 0 auto; }
.section.active { display: block; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.15rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.login-box { max-width: 420px; margin: 0 auto; padding: 1rem 1rem 2rem; }

/* Buttons */
button { font-family: inherit; }
/* Default (un-classed) buttons = secondary: outlined */
button.secondary, :where(button:not([class])) {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-size: 0.92rem;
  font-weight: 550;
  cursor: pointer;
  margin: 0.25rem 0.25rem 0.25rem 0;
}
button.secondary:active, :where(button:not([class])):active { background: var(--surface-3); }
/* Primary = green */
button.primary, .btn, .big-action {
  background: var(--green);
  color: var(--on-green);
  border: none;
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  width: 100%;
  margin-top: 0.6rem;
}
.big-action { border-radius: 14px; padding: 1.05rem; font-size: 1.05rem; margin: 0.45rem 0; }
button.primary:active, .btn:active, .big-action:active { background: var(--green-press); }
button.primary.inline { width: auto; padding: 0.6rem 1rem; font-size: 0.92rem; margin: 0.25rem 0; }
.big-action.danger, button.danger { background: var(--red); color: #fff; }
.big-action.danger:active, button.danger:active { background: #b91c1c; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--green-text); outline-offset: 2px; }
button[disabled] { cursor: wait; opacity: 0.6; }

/* Inputs */
input, select, textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  margin: 0.4rem 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0a0a0a;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: #8a8a8a; }
input:focus, select:focus, textarea:focus { border-color: #555; outline: none; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--green); margin: 0 0.4rem 0 0; vertical-align: middle; }
label { color: var(--text); }

/* Photos / timeline */
.photo-grid { display: flex; flex-direction: column; gap: 1rem; }
.photo-item { background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.photo-item img, .photo-item video { width: 100%; max-height: 320px; object-fit: contain; background: #000; }
.quick-card { border-left: 3px solid var(--green-text); }
.status-good { color: var(--green-text); font-weight: 650; }
.status-bad { color: var(--red-text); font-weight: 650; }

/* Keep the annotation canvas inside the card on phones (drawing math already scales by bounding rect). */
#annotation-canvas { max-width: 100%; height: auto; touch-action: none; border-radius: 10px; }

/* Ask ChatGPT / Ask Grok */
.big-action.ai-chatgpt { background: var(--green); color: var(--on-green); }
.ai-grok-small { background: none; border: 1px solid var(--border-strong); color: var(--text); border-radius: 999px; padding: 0.45rem 0.95rem; font-size: 0.85rem; margin: 0.15rem 0 0.5rem; cursor: pointer; }
.ai-grok-small:active { background: var(--surface-3); }
.ai-answer { margin-top: 0.8rem; padding: 0.9rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; white-space: pre-wrap; line-height: 1.5; }
.ai-answer:empty { display: none; }
.ask-step { background: var(--green); color: var(--on-green); border: none; border-radius: 8px; padding: 0.35rem 0.6rem; font-size: 0.8rem; font-weight: 600; margin-left: 0.5rem; white-space: nowrap; cursor: pointer; }
.ask-chatgpt-inline { background: var(--green) !important; color: var(--on-green) !important; border: none !important; }
.task-row { padding: 0.65rem 0.75rem; margin: 0.45rem 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; display: flex; align-items: center; }
.task-row .done { text-decoration: line-through; color: var(--muted); }

/* Google Drive sync indicators (status colors kept so they stay easy to read) */
.sync-line { margin: 0.35rem 0; font-size: 0.8rem; }
.sync-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; text-decoration: none; border: 1px solid transparent; }
.sync-badge.ok { background: #0f2209; color: #9fd38a; border-color: #2c5a1c; }
.sync-badge.wait { background: #2a2000; color: #fde68a; border-color: #4a3a05; }
.sync-badge.up { background: #082f49; color: #7dd3fc; border-color: #0c4a6e; }
.sync-badge.err { background: #2a0a0a; color: #fca5a5; border-color: #5a1a1a; }
#sync-chip { background: #2a2000; color: #fde68a; font-size: 0.7rem; padding: 2px 7px; border-radius: 999px; flex: none; }
#sync-toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: #fff; color: #000; font-weight: 600; padding: 0.6rem 1rem; border-radius: 999px; font-size: 0.9rem; opacity: 0; transition: all .25s; pointer-events: none; z-index: 9999; max-width: 90vw; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
#sync-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.video-thumb { position: relative; background: #000; border-radius: 10px; min-height: 80px; display: flex; align-items: center; justify-content: center; color: #fff; }
.video-thumb img { width: 100%; display: block; border-radius: 10px; opacity: 0.85; }
.video-thumb span { position: absolute; background: rgba(0,0,0,.65); padding: 2px 8px; border-radius: 6px; }

/* Admin rows */
.admin-row { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.admin-row:last-child { border-bottom: none; }
.admin-row small { color: var(--muted); }

/* Roles: ADMIN = green, SUPER ADMIN = white */
#admin-badge { background: var(--green); color: var(--on-green); font-size: 0.66rem; font-weight: 750; letter-spacing: 0.04em; padding: 3px 7px; border-radius: 999px; flex: none; }
#admin-badge.super { background: #fff !important; color: #000 !important; }
.role-pill { display: inline-block; font-size: 0.7rem; font-weight: 750; letter-spacing: 0.03em; padding: 2px 9px; border-radius: 999px; background: var(--green); color: var(--on-green); }
.role-pill.super { background: #fff; color: #000; }
#google-signin-slot { display: flex; justify-content: center; margin: 0.4rem 0; }

/* Leaflet on black */
.leaflet-container { background: #111; border-radius: 12px; }
.leaflet-control-attribution { background: #000 !important; color: #ccc !important; }
.leaflet-control-attribution a { color: #ddd !important; }

/* Install banner */
.install-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 0.9rem 1rem; padding: 0.9rem 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 0.9rem; line-height: 1.4; }
#app > .install-banner { max-width: 688px; margin-left: auto; margin-right: auto; }
.login-box .install-banner { margin: 0 0 1rem; }
.install-banner .ib-icon { width: 40px; height: 40px; border-radius: 10px; flex: none; background: #fff; }
.install-banner .ib-text { flex: 1 1 200px; min-width: 0; }
.install-banner .ib-steps { margin: 0.4rem 0 0; padding-left: 1.2rem; color: #e6e6e6; }
.install-banner .ib-steps li { margin: 0.2rem 0; }
.install-banner .ib-share { vertical-align: -3px; color: #0a84ff; background: #fff; border-radius: 4px; padding: 1px; }
.install-banner .ib-actions { display: flex; gap: 0.5rem; margin-left: auto; }
.install-banner button { width: auto; margin: 0; padding: 0.55rem 1rem; border-radius: 999px; font-size: 0.9rem; font-weight: 650; cursor: pointer; }
.install-banner .ib-install, .install-banner .ib-copy { background: var(--green); color: var(--on-green); border: none; }
.install-banner .ib-later { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.install-banner.subtle { font-size: 0.82rem; padding: 0.5rem 0.75rem; max-width: 640px; margin-left: auto; margin-right: auto; }
.install-banner.subtle .ib-icon { width: 28px; height: 28px; }
.install-banner.subtle button { padding: 0.35rem 0.8rem; font-size: 0.82rem; }

/* Narrow phones: keep "Job Cam" readable when the sync chip and role badge are both showing */
.hdr-title { min-width: 70px; }
#sync-chip, #admin-badge { white-space: nowrap; }
@media (max-width: 420px) {
  .header { gap: 8px; padding-left: 0.75rem; padding-right: 0.75rem; }
  .app-logo, #app .header img { height: 22px; }
  .hdr-logout { padding: 0.3rem 0.6rem; }
}

/* Schedule (Google Calendar) */
.sched-form { border: 1px solid var(--border); background: #0a0a0a; border-radius: 12px; padding: 0.9rem; margin-bottom: 0.5rem; }
.fld { display: block; font-size: 0.82rem; color: var(--muted); font-weight: 600; margin-top: 0.55rem; }
.fld input, .fld select, .fld textarea { margin-top: 0.3rem; }
.sched-row { display: flex; gap: 0.6rem; }
.sched-row > * { flex: 1; min-width: 0; }
input[type="date"], input[type="time"] { color-scheme: dark; min-height: 48px; }
#sched-crew { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.4rem 0 0.2rem; }
.crew-pick { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.crew-pick input { width: 22px; height: 22px; flex: none; margin: 0; }
.crew-pick small { color: var(--muted); }
.crew-pick:has(input:checked) { border-color: var(--green-text); }
.crew-role { display: inline-block; font-size: 0.62rem; font-weight: 750; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border-strong); color: #ddd; vertical-align: 1px; }
.crew-role.admin { background: var(--green); color: var(--on-green); border-color: var(--green); }
.crew-role.superadmin { background: #fff; color: #000; border-color: #fff; }
.crew-role.sub { border-color: #6b7280; color: #e5e7eb; }
.sched-item { border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 0.8rem 0.9rem; margin: 0.55rem 0; }
.sched-when { font-weight: 700; font-size: 0.95rem; }
.sched-job { font-size: 1rem; margin: 0.2rem 0 0.25rem; }
.sched-meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; white-space: pre-wrap; }
.sched-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.6rem; }
.sched-actions button { margin: 0; padding: 0.45rem 0.8rem; font-size: 0.85rem; border-radius: 999px; }
.sched-link { font-size: 0.85rem; }
button.danger-outline { color: #ff8a8a; border-color: #5a2a2a; }
.sched-msg { font-size: 0.9rem; margin-top: 0.6rem; }
.sched-msg.ok { color: var(--text); }
.sched-msg.err { color: #ff8a8a; }
a.btn-link { display: block; text-align: center; text-decoration: none; background: var(--green); color: var(--on-green); font-weight: 650; padding: 0.85rem 1rem; border-radius: 12px; margin: 0.6rem 0; }
a.btn-link:active { background: var(--green-press); }
#calendar-admin-card button.secondary, #crew-admin-card .admin-row button { margin: 0.25rem 0 0; }

/* ---------- Jobs: office filter, job page, types of work (v14) ---------- */
.jobs-top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.5rem; }
.jobs-top h3 { margin: 0; }
#office-filter, .office-select { width: auto; max-width: 58%; margin: 0; padding: 0.45rem 0.7rem; font-size: 0.85rem; border-radius: 999px; }
.jobs-msg { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem 0.8rem; font-size: 0.88rem; margin: 0.4rem 0 0.6rem; line-height: 1.45; }
.fld { display: block; font-size: 0.85rem; color: var(--muted); margin: 0.75rem 0 0.35rem; font-weight: 600; }
.wt-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.2rem 0 0.6rem; }
.wt-chip { position: relative; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.8rem; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 0.88rem; cursor: pointer; user-select: none; line-height: 1.2; }
.wt-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.wt-chip:focus-within { outline: 2px solid var(--green-text); outline-offset: 2px; }
.wt-chip.on { background: var(--green); border-color: var(--green); color: var(--on-green); font-weight: 650; }
.wt-ic { font-size: 1.1rem; line-height: 1; }
.wt-n { background: #fff; color: #000; border-radius: 999px; font-size: 0.68rem; font-weight: 800; min-width: 1.2rem; height: 1.2rem; display: inline-flex; align-items: center; justify-content: center; }
.job-page { margin: 0.75rem 0 0.25rem; }
.job-title { font-size: 1.15rem; font-weight: 700; line-height: 1.3; }
.job-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.45rem 0; }
.office-pill, .status-pill { display: inline-block; font-size: 0.75rem; font-weight: 650; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border-strong); }
.office-pill { color: var(--green-text); border-color: #2c5a1c; background: #0f2209; }
.status-pill { color: var(--muted); }
.job-meta { font-size: 0.9rem; color: #d4d4d4; line-height: 1.5; }
.job-drive { display: inline-block; margin-top: 0.4rem; font-size: 0.88rem; }
.job-save { margin: 0.5rem 0 0; min-height: 1.2rem; }
.save-pill { display: inline-block; font-size: 0.75rem; padding: 2px 9px; border-radius: 999px; border: 1px solid transparent; }
.save-pill.ok { background: #0f2209; color: #9fd38a; border-color: #2c5a1c; }
.save-pill.wait, .save-pill.demo { background: #2a2000; color: #fde68a; border-color: #4a3a05; }
.save-pill.err { background: #2a0a0a; color: #fca5a5; border-color: #5a1a1a; }
.scope-h { margin: 1rem 0 0.4rem; }
.work-sec { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--green-text); border-radius: 10px; padding: 0.65rem 0.75rem 0.55rem; margin: 0.55rem 0; }
.work-head { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.98rem; margin-bottom: 0.4rem; }
.work-sec textarea { margin: 0; background: #0b0b0b; min-height: 4.2rem; }
.job-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.9rem; }
.job-actions button { width: 100%; margin: 0; }
.job-actions button.danger { border: none; border-radius: 12px; padding: 0.8rem 1rem; font-size: 0.95rem; font-weight: 650; cursor: pointer; }
.skill-pick { display: inline-block; margin: 0.2rem 0.6rem 0.2rem 0; font-size: 0.9rem; }
.crew-office { width: auto; margin: 0.35rem 0 0; padding: 0.3rem 0.5rem; font-size: 0.8rem; }

/* v16: Upload from Phone */
.capture-hint { font-size: 0.8rem; margin: -0.1rem 0 0.5rem; }
.upload-status { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 0.7rem 0.85rem; font-size: 0.88rem; margin: 0.4rem 0 0.6rem; line-height: 1.45; }
.upload-status button { margin-top: 0.45rem; }

/* v16: Admin → Profiles */
#people-admin-card .wt-chip { font-size: 0.82rem; padding: 0.4rem 0.7rem; margin: 0; }
.pp-row { display: flex; gap: 0.6rem; justify-content: space-between; align-items: flex-start; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.pp-row:last-child { border-bottom: none; }
.pp-main { min-width: 0; flex: 1; font-size: 0.92rem; }
.pp-line { color: var(--muted); font-size: 0.82rem; margin-top: 0.2rem; overflow-wrap: anywhere; }
.pp-line a { color: var(--text); }
.pp-trades { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.pp-trade { font-size: 0.74rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.pp-actions { display: flex; flex-direction: column; gap: 0.35rem; flex: none; }
.pp-actions button { margin: 0; padding: 0.5rem 0.75rem; font-size: 0.85rem; }
.pp-bad { color: #f87171; }
.pp-err { color: #ff8a8a; background: #2a1010; border: 1px solid #5a2a2a; border-radius: 10px; padding: 0.55rem 0.75rem; font-size: 0.88rem; }
.pp-ok { color: #9fd38a; background: #0f2209; border: 1px solid #2c6419; border-radius: 10px; padding: 0.55rem 0.75rem; font-size: 0.88rem; }
.pp-dup { background: #2a2000; border: 1px solid #806000; color: #fde68a; border-radius: 12px; padding: 0.75rem 0.85rem; font-size: 0.9rem; margin: 0.4rem 0; line-height: 1.45; }
.pp-dup button { display: block; margin-top: 0.55rem; }
.pp-confirm { background: #1a0d0d; border: 1px solid #7f1d1d; border-radius: 14px; padding: 0.9rem; margin: 0.2rem 0 0.9rem; }
.pp-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; margin: 0.6rem 0 0.2rem; }
.pp-check input { width: auto; margin: 0; }
.pp-local { margin-top: 0.9rem; padding-top: 0.6rem; border-top: 1px dashed var(--border-strong); }
