/* ============================================================
   Agent app — simple mode (Tactical Precision Dark)

   Presentation layer on top of ../shared/sentinel-design.css.
   Inherits the dark Tactical Precision tokens and ensures the
   field security guard application provides rugged, glare-free,
   high-contrast night and day operation surfaces.
   ============================================================ */

/* ── 1. Legacy token → Tactical Precision remap ─────────────── */
:root {
  color-scheme: dark;
  --slate: var(--tp-base);
  --slate-2: var(--tp-surface);
  --slate-3: var(--tp-raised);
  --hair: var(--tp-border);
  --bone: var(--tp-text-primary);
  --bone-dim: var(--tp-text-secondary);
  --bone-faint: var(--tp-text-muted);
  --glacier: var(--tp-emerald);
  --glacier-dim: var(--tp-emerald-wash);
  --sodium: var(--tp-warn);
  --oxblood: var(--tp-danger);
  --farm-f2: #10B981;
  --farm-f3a: #38BDF8;
  --farm-f3b: #818CF8;
  --farm-f4: #F59E0B;
  --gw-outside: var(--tp-base);
}

/* ── 2a. Login: one clean tactical card ──────────────────── */
.login-box {
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-lg);
  box-shadow: var(--tp-shadow-md);
  padding: 24px;
  max-width: 430px;
}
.login-box h2 {
  font-family: var(--tp-font-sans);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tp-text-primary);
  text-align: center;
  margin-bottom: 6px;
}
#login-lead {
  text-align: center;
  color: var(--tp-text-secondary);
  font-size: 14px;
  margin-bottom: 18px;
}
#worker-select {
  background: var(--tp-raised);
  border: 1px solid var(--tp-border);
  color: var(--tp-text-primary);
  border-radius: var(--tp-radius-md);
  min-height: 48px;
  font-size: 16px;
  padding: 12px 14px;
}
#worker-select:focus {
  outline: none;
  border-color: var(--tp-emerald-bright);
  box-shadow: var(--tp-ring);
}
#btn-login { min-height: 54px; font-size: 16px; }

/* ── 2b. Farm selector: ONE segmented control ──────────── */
.sd-seg#login-farm-row,
.sd-seg#main-farm-bar {
  margin: 4px 0 18px;
  background: var(--tp-raised);
  border: 1px solid var(--tp-border);
}
#login-farm-row .btn-farm-choice,
#main-farm-bar .btn-farm-toggle {
  background: transparent;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  padding: 0 8px;
  min-height: 44px;
  width: auto;
  flex: 1 1 0;
  font-family: var(--tp-font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  text-align: center;
  color: var(--tp-text-secondary);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s var(--tp-ease),
              color 0.15s var(--tp-ease),
              box-shadow 0.15s var(--tp-ease);
}
#login-farm-row .btn-farm-choice:active,
#main-farm-bar .btn-farm-toggle:active { transform: translateY(1px) scale(0.985); }
#login-farm-row .btn-farm-choice.active,
#main-farm-bar .btn-farm-toggle.active {
  background: var(--tp-surface);
  border: 1px solid var(--tp-border-active);
  color: var(--tp-emerald-bright);
  font-weight: 700;
  box-shadow: var(--tp-shadow-sm);
}

/* ── 2c. Patrol header: avatar, name, farm chip, timer ──── */
.user-info.nf-patrol-head {
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-lg);
  box-shadow: var(--tp-shadow-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-info .agent-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}
.agent-avatar {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: var(--tp-emerald-wash);
  color: var(--tp-emerald-bright);
  border: 1px solid var(--tp-border-active);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
}
.user-info .agent-id { min-width: 0; }
.user-name {
  display: block;
  font-weight: 700;
  font-size: 15px;
  color: var(--tp-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Farm select in the header */
.nf-farm-select-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
  margin-top: 3px;
}
.nf-farm-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--tp-font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 22px 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--tp-border-active);
  background: var(--tp-raised);
  color: var(--tp-emerald-bright);
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}
.nf-farm-select:hover, .nf-farm-select:focus {
  border-color: var(--tp-emerald);
  background: var(--tp-surface);
}
.nf-farm-select-arrow {
  position: absolute;
  right: 8px;
  pointer-events: none;
  font-size: 8px;
  color: var(--tp-emerald-bright);
}
.nf-farm-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--tp-font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--tp-border);
  background: var(--tp-raised);
  color: var(--tp-text-secondary);
  margin-top: 3px;
  white-space: nowrap;
}
.nf-farm-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--farm-f2);
  flex: none;
}
.nf-farm-chip[data-farm="farm-3a"] i { background: var(--farm-f3a); }
.nf-farm-chip[data-farm="farm-3b"] i { background: var(--farm-f3b); }
.nf-farm-chip[data-farm="farm-4"] i { background: var(--farm-f4); }

/* ── 2d. Action buttons (tactile) ────────────────────────── */
.worker-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  margin-bottom: 16px;
}
/* The big "JE SUIS EN POSTE" vigilance button */
.btn-duty-action {
  min-height: 60px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: var(--tp-emerald);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  border-radius: var(--tp-radius-md);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s var(--tp-ease), background-color 0.15s, box-shadow 0.15s;
}
.btn-duty-action:active { transform: translateY(1px) scale(0.985); }
.btn-duty-action.flash-success {
  background: var(--tp-emerald-dark) !important;
  border-color: var(--tp-emerald-bright) !important;
  color: #fff !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35) !important;
}
.btn-duty-action:disabled,
.btn-duty-action.is-confirmed-locked {
  background: rgba(22, 101, 52, 0.45) !important;
  border-color: rgba(74, 222, 128, 0.25) !important;
  color: rgba(255, 255, 255, 0.7) !important;
  cursor: not-allowed !important;
  opacity: 0.85;
  box-shadow: none !important;
  transform: none !important;
}
.worker-buttons-row { display: flex; gap: 10px; }
.btn-worker-secondary {
  flex: 1;
  min-height: 52px;
  font-size: 14px;
  font-weight: 700;
}
.btn-worker-note {
  min-height: 48px;
  font-size: 14px;
  font-weight: 600;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ── 2e. Trail tab ─────────────────────────────────────── */
.nf-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tp-emerald-bright);
  display: inline-block;
  flex: none;
  animation: nf-pulse 1.6s ease-in-out infinite;
}
@keyframes nf-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50% { opacity: 0.75; box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}
#nf-trail-svg .trl-start,
.trl-start { color: var(--tp-emerald-bright); }

/* Trail stat units injected by JS (<em>km</em> / <em>min</em>) */
.sd-stat .v em { font-style: normal; font-size: 11px; color: var(--tp-text-muted); }

/* ── 2f. Menu tab: tidy list rows ───────────────────────── */
.nf-menu { display: flex; flex-direction: column; gap: 8px; }
.nf-row {
  width: 100%;
  text-align: left;
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-md);
  box-shadow: var(--tp-shadow-sm);
  padding: 12px 14px;
  min-height: 60px;
  color: var(--tp-text-primary);
  font-family: var(--tp-font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s var(--tp-ease), background-color 0.15s;
}
.nf-row:active {
  background: var(--tp-hover);
  transform: translateY(1px) scale(0.985);
}
.nf-row .ttl { font-weight: 600; font-size: 15px; color: var(--tp-text-primary); display: block; }
.nf-row small { display: block; font-weight: 400; color: var(--tp-text-secondary); font-size: 12.5px; margin-top: 2px; }
.nf-row .ico {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--tp-emerald-wash);
  color: var(--tp-emerald-bright);
  border: 1px solid var(--tp-border-active);
}
.nf-row.danger { border-color: rgba(239, 68, 68, 0.35); }
.nf-row.danger .ico { background: var(--tp-danger-wash); color: #F87171; border-color: rgba(239, 68, 68, 0.35); }
.nf-row.danger .ttl { color: #F87171; }

/* ── 3. Simple-mode sizing (dark) ──────────────────── */
/* Map */
.ck-map-wrap {
  height: 46dvh !important;
  min-height: 260px !important;
  max-height: 440px !important;
  background: var(--tp-base) !important;
}
.ck-gps-chip {
  font-family: var(--tp-font-mono) !important;
  font-size: 12px !important;
  font-weight: 600;
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  color: var(--tp-text-primary);
}
.ck-map-wrap .sync-pill {
  font-family: var(--tp-font-mono) !important;
  font-size: 11px !important;
  font-weight: 600;
  letter-spacing: 0.05em !important;
}
.ck-pin { width: 34px !important; height: 34px !important; font-size: 14px !important; }
.ck-pin.target { outline-width: 3px; }

/* Guidance */
.ck-target-label { font-size: 11px !important; color: var(--tp-text-muted); }
.ck-target-name { font-size: 19px !important; white-space: normal !important; line-height: 1.25; color: var(--tp-text-primary); }
.ck-target-meta { font-family: var(--tp-font-sans) !important; font-size: 14px !important; white-space: normal !important; color: var(--tp-text-secondary); }
.ck-dist b { font-size: 38px !important; font-family: var(--tp-font-mono); color: var(--tp-text-primary); }
.ck-dist span { font-size: 13px !important; color: var(--tp-text-secondary); }
.ck-confirm { min-height: 64px !important; font-size: 18px !important; }
.ck-confirm .ck-sub { font-family: var(--tp-font-sans) !important; font-size: 13px !important; }
.ck-status { font-size: 14.5px !important; line-height: 1.45; color: var(--tp-text-secondary); }
.ck-link { min-height: 48px !important; font-size: 14px !important; }

/* Progress */
.gw-prog-count { font-size: 15px !important; font-family: var(--tp-font-mono); }

/* Checklist */
.checklist-title { font-size: 12px !important; color: var(--tp-text-muted); }
.cp-flat {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-lg);
  overflow: hidden;
  background: var(--tp-surface);
  box-shadow: var(--tp-shadow-sm);
}
.cp-flat .cp-row {
  min-height: 64px;
  padding: 12px 14px;
  gap: 12px;
  border-bottom: 1px solid var(--tp-border);
}
.cp-flat .cp-row:last-child { border-bottom: 0; }
.cp-flat .cp-mark {
  width: 34px; height: 34px; border-radius: 10px;
  font: 700 14px/1 var(--tp-font-mono); color: var(--tp-text-primary);
  background: var(--tp-raised); border: 1px solid var(--tp-border);
}
.cp-flat .cp-row.done .cp-mark {
  color: var(--tp-emerald-bright);
  background: var(--tp-emerald-wash);
  border-color: var(--tp-border-active);
}
.cp-flat .cp-name { font-size: 16px; font-weight: 600; white-space: normal; line-height: 1.25; color: var(--tp-text-primary); }
.cp-flat .cp-meta { font-family: var(--tp-font-sans); font-size: 13px; letter-spacing: 0; margin-top: 3px; white-space: normal; color: var(--tp-text-secondary); }
.cp-flat .cp-dist { font-size: 15px; font-weight: 600; color: var(--tp-text-primary); font-family: var(--tp-font-mono); }
.cp-flat .cp-dist.near { color: var(--tp-emerald-bright); }
.cp-flat .cp-time { font-size: 14px; color: var(--tp-text-secondary); font-family: var(--tp-font-mono); }
.cp-flat .cp-row.target { background: var(--tp-hover); box-shadow: inset 4px 0 0 var(--tp-emerald-bright); }
.cp-flat .cp-row.target .cp-mark { background: var(--tp-emerald); color: #fff; border-color: var(--tp-emerald); }

@media (prefers-reduced-motion: reduce) {
  .nf-live-dot { animation: none; }
}

/* ── Clutter removal & Single Recenter Control ── */
#main-farm-bar,
.sd-seg#main-farm-bar,
#ck-sim-banner,
.ck-sim-banner,
.ck-map-tools,
#ck-btn-fit {
  display: none !important;
}

/* ── Prominent End Shift Button ── */
#btn-end-shift-main {
  width: 100% !important;
  min-height: 52px !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  letter-spacing: 0.02em !important;
  background: var(--tp-danger-wash) !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
  color: #F87171 !important;
  border-radius: var(--tp-radius-md) !important;
  box-shadow: var(--tp-shadow-sm) !important;
  cursor: pointer !important;
  transition: background-color 0.15s, border-color 0.15s, transform 0.12s var(--tp-ease) !important;
}
#btn-end-shift-main:hover {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: rgba(239, 68, 68, 0.65) !important;
  color: #FCA5A5 !important;
}
#btn-end-shift-main:active {
  transform: translateY(1px) scale(0.985) !important;
}

/* ── Streamlined 2-Tab Navigation Bar (Patrol & Trajet only) ── */
.sd-tabbar {
  grid-template-columns: repeat(2, 1fr) !important;
}
.sd-tabbar button {
  width: 100% !important;
}


