/* mapon-installation — KJIT design system (navy + ice + signal-cyan),
   same grammar as air-check / Signal. */

@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --navy-900: #0e1a2e;
  --navy-800: #14263f;
  --navy-700: #1c3252;
  --navy-600: #284568;
  --ice-50:  #f4f6fa;
  --ice-100: #e6ebf3;
  --ice-200: #c7d1e0;
  --ice-300: #94a3b8;
  --signal:  #6dd3ff;
  --signal-soft: rgba(109, 211, 255, 0.45);
  --paper:   #fbfbfa;

  --st-ok-bg:      #dff3e3;
  --st-ok-fg:      #1f7a3a;
  --st-ok-stroke:  #3aa55c;
  --st-warn-bg:    #fff4d6;
  --st-warn-fg:    #8a5a00;
  --st-warn-stroke:#e0a020;
  --st-alert-bg:   #ffe1de;
  --st-alert-fg:   #a02a20;
  --st-alert-stroke:#d04a3e;

  /* Departure-urgency colours for the numbered markers */
  --u-now:   #dc2626; /* 0–1 h  */
  --u-soon:  #f59e0b; /* 2–4 h  */
  --u-later: #2563eb; /* 5–8 h  */
  --u-idle:  #64748b; /* 9+ / none */
  --u-mapon: #9ca3af; /* already has mapon */

  --font-display: "Inter Tight", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--navy-900);
  font-family: var(--font-display);
}

.mono { font-family: var(--font-mono); letter-spacing: 0.08em; }
.label-tiny { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; }

.grain { position: relative; }
.grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
}

/* Form controls */
.field {
  width: 100%; box-sizing: border-box;
  background: white; border: 1px solid var(--ice-200);
  border-radius: 8px; padding: 12px 14px;
  font: 500 14px/1 var(--font-display);
  color: var(--navy-900);
}
.field:focus { outline: none; border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(20,38,63,0.10); }
.field::placeholder { color: var(--ice-300); }

.btn-primary {
  width: 100%; box-sizing: border-box; cursor: pointer;
  background: var(--navy-800); color: white; border: none;
  border-radius: 10px; padding: 14px;
  font: 600 14px/1 var(--font-display); letter-spacing: 0.01em;
}
.btn-primary:hover { background: var(--navy-700); }

.btn-sso {
  width: 100%; box-sizing: border-box; cursor: pointer;
  background: white; color: var(--navy-900);
  border: 1px solid var(--ice-200);
  border-radius: 10px; padding: 12px 14px;
  font: 500 13px/1 var(--font-display);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-sso:hover { border-color: var(--navy-700); background: var(--ice-50); }

@keyframes ac-blip-pulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.7; }
}

/* Status pills */
.pill {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; font-weight: 600;
  padding: 4px 8px; border-radius: 4px;
  display: inline-block;
}
.pill-alert   { background: var(--st-alert-bg); color: var(--st-alert-fg); }
.pill-warn    { background: var(--st-warn-bg);  color: var(--st-warn-fg); }
.pill-mapon   { background: var(--ice-100);     color: var(--navy-700); }

/* Vehicle-list rows */
.vehicle-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--ice-200);
  border-radius: 12px;
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
}
.vehicle-row:active { background: var(--ice-50); }
.vehicle-row .icon-tile {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--ice-50);
  display: flex; align-items: center; justify-content: center;
  color: var(--navy-800);
}
.vehicle-row .id-line   { font: 500 11px/1 var(--font-mono); color: var(--ice-300); letter-spacing: 0.06em; }
.vehicle-row .name-line { font-weight: 600; font-size: 14px; color: var(--navy-900); margin-top: 1px; }
.vehicle-row .meta-line { font-size: 11px; color: var(--navy-600); margin-top: 1px; }

/* Leaflet look */
.leaflet-container { z-index: 0; }
.leaflet-tile-pane { filter: grayscale(0.9) contrast(1.15) brightness(0.95); }

/* Numbered departure markers (vehicles missing mapon) */
.mapon-marker .mm {
  position: relative;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: var(--c, var(--u-idle));
  border: 2px solid #fff;
  border-radius: 9px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.35);
}
.mapon-marker .mm svg { width: 20px; height: 20px; }
.mapon-marker .mm-badge {
  position: absolute; right: -7px; top: -7px;
  min-width: 17px; height: 17px; padding: 0 3px;
  box-sizing: border-box;
  background: #fff; color: var(--navy-900);
  border: 1.5px solid var(--c, var(--u-idle));
  border-radius: 9px;
  font: 700 10px/14px var(--font-mono);
  text-align: center;
}

/* Stat tiles */
.stat-tile {
  background: white;
  border: 1px solid var(--ice-200);
  border-radius: 10px;
  padding: 10px 12px;
}
.stat-tile .label { font: 500 10px/1 var(--font-mono); letter-spacing: 0.18em; color: var(--ice-300); text-transform: uppercase; }
.stat-tile .value { font-weight: 700; font-size: 22px; color: var(--navy-900); margin-top: 2px; }
.stat-tile.tone-alert .label { color: var(--st-alert-fg); }
.stat-tile.tone-mapon .label { color: var(--navy-600); }

/* Truck/trailer toggle */
.seg {
  display: inline-flex; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18); border-radius: 10px; padding: 3px;
}
.seg button {
  border: none; background: transparent; cursor: pointer;
  color: rgba(255,255,255,0.7);
  font: 600 12px/1 var(--font-display);
  padding: 8px 16px; border-radius: 7px;
}
.seg button.active { background: white; color: var(--navy-900); }

/* Install modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(14,26,46,0.55);
  display: none; align-items: flex-end; justify-content: center;
}
.modal-backdrop.open { display: flex; }
@media (min-width: 640px) { .modal-backdrop.open { align-items: center; } }
.modal {
  width: 100%; max-width: 420px;
  background: white; border-radius: 16px 16px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
}
@media (min-width: 640px) { .modal { border-radius: 16px; } }
.modal h2 { font-size: 18px; margin: 0 0 2px; letter-spacing: -0.01em; }
.modal .sub { font-size: 12px; color: var(--navy-600); margin: 0 0 16px; }
.modal label { display: block; font: 500 10px/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ice-300); margin: 12px 0 6px; }
.modal .row { display: flex; gap: 10px; margin-top: 18px; }
.modal .btn-ghost {
  flex: 1; background: white; border: 1px solid var(--ice-200);
  border-radius: 10px; padding: 13px; cursor: pointer;
  font: 600 14px/1 var(--font-display); color: var(--navy-700);
}
.modal .btn-primary { flex: 2; }

/* Undo / status toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 1100; background: var(--navy-900); color: white;
  padding: 12px 16px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  display: none; align-items: center; gap: 14px;
}
.toast.open { display: flex; }

/* Scope-grid + rings (login) */
.scope-grid { position: relative; }
.scope-grid::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(circle at 50% 38%, black 0%, transparent 70%);
  mask-image: radial-gradient(circle at 50% 38%, black 0%, transparent 70%);
  pointer-events: none;
}
.scope-rings { position: absolute; inset: 0; pointer-events: none; opacity: 0.45; }
.scope-rings circle { fill: none; stroke: rgba(109,211,255,0.22); stroke-width: 1; }
