/* ============================================================
   jlm3-5.9 — field-ops console, 3–5.9.2026
   ============================================================
   Loaded AFTER css/styles.css (and after css/admin.css on the two admin
   pages), so it only consumes the tokens defined there — --blue, --mid-blue,
   --green, --radius, --border, --muted — and never redefines them.

   ⚠ styles.css paints a fixed background image plus a 45%-white overlay on
   body::before at z-index 0. Anything positioned here needs z-index 1 or it
   vanishes underneath. That is why .jlm3-wrap exists.
   ============================================================ */

.jlm3-wrap { position: relative; z-index: 1; }

/* ── Shared bits ───────────────────────────────────────────── */

.jlm3-hp { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

.jlm3-muted { color: var(--muted); font-size: .85rem; line-height: 1.5; }

.jlm3-note {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.6;
}

.jlm3-note strong { color: var(--text); }

.jlm3-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}

/* ── Task checkboxes on the join form ──────────────────────── */
/* Each task shows its own time window, so ticking one is a statement about
   availability and not just about willingness. */

.jlm3-task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 9px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  border-inline-start-width: 5px;
}

.jlm3-task:has(input:checked) { border-color: var(--mid-blue); background: #F2F7FC; }
.jlm3-task input { margin-top: 3px; flex: 0 0 auto; width: 18px; height: 18px; }
.jlm3-task-body { flex: 1; min-width: 0; }
.jlm3-task-name { font-weight: 600; color: var(--text); }
.jlm3-task-when { font-size: .82rem; color: var(--mid-blue); font-weight: 500; margin-top: 2px; }
.jlm3-task-desc { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* ── Availability windows ──────────────────────────────────── */

.jlm3-win {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.jlm3-win input[type="datetime-local"] { flex: 1; min-width: 150px; margin: 0; }
.jlm3-win-sep { color: var(--muted); font-size: .85rem; flex: 0 0 auto; }

.jlm3-win-del {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--error);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

/* ── The personal link handed back after signup ────────────── */

.jlm3-link-box {
  background: #F2F7FC;
  border: 2px dashed var(--mid-blue);
  border-radius: 10px;
  padding: 12px;
  margin: 14px 0;
  word-break: break-all;
  font-size: .85rem;
  direction: ltr;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ============================================================
   Volunteer app (jlm3.html)
   ============================================================
   This page is opened on a phone, in the field, possibly one-handed.
   Everything is big enough to hit without looking.
   ============================================================ */

.jlm3-app { max-width: 560px; margin: 0 auto; padding: 12px; }

.jlm3-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.jlm3-topbar-name { font-weight: 700; flex: 1; min-width: 0; }
.jlm3-topbar-team { font-size: .8rem; opacity: .85; }

/* The location indicator. Green when we have a recent fix, amber when the
   reader has paused it, grey when the browser will not give us one. It is
   deliberately always visible: a page quietly broadcasting your position with
   no indicator is not something to ship. */
.jlm3-gps {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.jlm3-gps-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.jlm3-gps.on  .jlm3-gps-dot { background: var(--success); animation: jlm3pulse 2s infinite; }
.jlm3-gps.off .jlm3-gps-dot { background: var(--warn); }
.jlm3-gps.err .jlm3-gps-dot { background: var(--error); }

@keyframes jlm3pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .jlm3-gps.on .jlm3-gps-dot { animation: none; } }

.jlm3-assign { border-inline-start: 5px solid var(--green); }
.jlm3-assign-task { font-size: 1.05rem; font-weight: 700; color: var(--blue); }
.jlm3-assign-row { display: flex; gap: 8px; margin-top: 7px; font-size: .9rem; }
.jlm3-assign-row .k { color: var(--muted); flex: 0 0 74px; }
.jlm3-assign-row .v { flex: 1; }

/* ── Chat ──────────────────────────────────────────────────── */

.jlm3-thread {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 180px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 4px 2px;
}

.jlm3-msg { max-width: 82%; padding: 9px 12px; border-radius: 14px; font-size: .92rem; line-height: 1.45; word-wrap: break-word; }

/* Sides follow messenger convention, mirrored for RTL: your own messages sit on
   the LEFT in Hebrew (align-self:flex-end resolves there under dir=rtl) and are
   the coloured ones; the other party's sit on the right in neutral.
   `in` and `out` are named from the VOLUNTEER's point of view — 'in' is what
   they sent — so this file is the volunteer's reading of the thread. The ops
   console flips them with .jlm3-ops-thread below, because for the admin the
   same two directions mean the opposite thing. */
.jlm3-msg-in  { align-self: flex-end;   background: var(--blue); color: #fff; border-end-end-radius: 4px; }
.jlm3-msg-out { align-self: flex-start; background: var(--light-blue); border-end-start-radius: 4px; }

/* Admin side: 'out' is the admin's own message, so the roles swap. */
.jlm3-ops-thread .jlm3-msg-out { align-self: flex-end;   background: var(--blue); color: #fff; border-end-end-radius: 4px; border-end-start-radius: 14px; }
.jlm3-ops-thread .jlm3-msg-in  { align-self: flex-start; background: var(--light-blue); color: var(--text); border-end-start-radius: 4px; border-end-end-radius: 14px; }
.jlm3-msg-meta { font-size: .68rem; opacity: .7; margin-top: 4px; }
.jlm3-msg img { max-width: 100%; border-radius: 9px; display: block; margin-bottom: 6px; }

.jlm3-composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.jlm3-composer textarea { flex: 1; margin: 0; resize: none; min-height: 44px; max-height: 120px; }

.jlm3-icon-btn {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jlm3-icon-btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.jlm3-icon-btn:disabled { opacity: .5; cursor: not-allowed; }

.jlm3-preview { position: relative; display: inline-block; margin-bottom: 8px; }
.jlm3-preview img { max-height: 130px; border-radius: 9px; display: block; }
.jlm3-preview button {
  position: absolute; top: -8px; inset-inline-end: -8px;
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: var(--error); color: #fff; cursor: pointer; font-size: .9rem;
}

/* ============================================================
   Admin: management (jlm3-admin.html) and ops (jlm3-ops.html)
   ============================================================ */

.jlm3-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

.jlm3-tab {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: .9rem;
  font-family: inherit;
}

.jlm3-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 600; }

/* A second, quieter tab row nested inside one panel (the task-status filter).
   Same buttons, smaller and in the mid-blue, so it never competes with the
   page-level tabs directly above it. */
.jlm3-subtabs { gap: 5px; margin-bottom: 12px; }
.jlm3-subtabs .jlm3-tab { padding: 5px 11px; font-size: .82rem; border-radius: 7px; }
.jlm3-subtabs .jlm3-tab.active { background: var(--mid-blue); border-color: var(--mid-blue); }
.jlm3-subtab-n { opacity: .65; font-weight: 400; margin-inline-start: 4px; }

/* Cache banner: the page is showing a saved snapshot while the live fetch runs.
   Deliberately a strip and not a spinner — the data below it is real, just old,
   and the admin can start working before the refresh lands. */
.jlm3-stale {
  padding: 7px 12px;
  margin-bottom: 12px;
  border: 1px solid #FDE68A;
  background: #FFFBEB;
  border-radius: 8px;
  font-size: .82rem;
  color: #92400E;
}
.jlm3-stale.err { border-color: #FECACA; background: #FEF2F2; color: #B91C1C; }

.jlm3-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.jlm3-row-main { flex: 1; min-width: 190px; }
.jlm3-row-name { font-weight: 600; }
.jlm3-row-sub { font-size: .8rem; color: var(--muted); margin-top: 3px; line-height: 1.6; }
.jlm3-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.jlm3-swatch { width: 15px; height: 15px; border-radius: 4px; display: inline-block; vertical-align: -2px; flex: 0 0 auto; }

/* ── Ops console layout ────────────────────────────────────── */

.jlm3-ops { display: grid; grid-template-columns: 290px 1fr 340px; gap: 12px; height: calc(100vh - 190px); min-height: 470px; }

.jlm3-ops-col {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.jlm3-ops-head {
  padding: 9px 13px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .88rem;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.jlm3-ops-body { flex: 1; overflow-y: auto; padding: 9px; min-height: 0; }
#jlm3-map { width: 100%; height: 100%; min-height: 300px; }

.jlm3-person {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.jlm3-person:hover  { background: #F1F5F9; }
.jlm3-person.active { background: var(--light-blue); border-color: var(--mid-blue); }
.jlm3-person-name { flex: 1; min-width: 0; font-size: .89rem; font-weight: 500; }
.jlm3-person-when { font-size: .72rem; color: var(--muted); }

/* Stale is a first-class state, not a styling afterthought. A volunteer whose
   phone locked ten minutes ago is not "at" the last pin any more, and the map
   has to say so rather than show a confident dot. */
.jlm3-person.stale .jlm3-person-name { color: var(--muted); }
.jlm3-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.jlm3-dot.stale { background: #fff !important; border: 2px solid var(--muted); }

.jlm3-unread {
  background: var(--error);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: .7rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.jlm3-team-hd {
  font-size: .74rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 12px 0 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.jlm3-team-hd:first-child { margin-top: 0; }

.jlm3-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.jlm3-shot { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: #fff; }
.jlm3-shot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; cursor: pointer; background: #EEF2F6; }
.jlm3-shot-meta { padding: 6px 8px; font-size: .72rem; color: var(--muted); line-height: 1.5; }

.jlm3-lightbox {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; cursor: zoom-out;
}

.jlm3-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* On a narrow screen the three ops columns stack. The map keeps a fixed height
   so it never collapses to nothing. */
@media (max-width: 1000px) {
  .jlm3-ops { grid-template-columns: 1fr; height: auto; }
  .jlm3-ops-col { max-height: 62vh; }
  #jlm3-map { height: 340px; }
}
