:root{
  --bg0:#040b14;
  --bg1:#061525;
  --panel:#071a2d;
  --panel2:#061728;
  --line: rgba(255, 214, 102, .35);
  --line2: rgba(180, 220, 255, .12);
  --gold:#f0c862;
  --gold2:#ffd88a;
  --text:#eaf2ff;
  --muted: rgba(234,242,255,.72);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  --sans: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  min-height:100vh;
  background:
    radial-gradient(900px 600px at 20% 10%, rgba(240,200,98,.10), transparent 60%),
    radial-gradient(900px 600px at 90% 25%, rgba(90,160,255,.10), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  color: var(--text);
  font-family: var(--sans);
  display:flex;
  justify-content:center;
  padding: 26px 14px;
}

.app{ width:min(1100px, 100%); }

.topbar{
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent), var(--panel2);
  border:1px solid var(--line2);
  border-bottom: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  padding:16px 18px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
}

.topbar__left{ display:flex; gap:12px; align-items:center; }

.badge{
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border:1px solid var(--line);
  color: var(--gold2);
  font-weight:800;
  letter-spacing:1px;
  border-radius:10px;
  font-family: var(--mono);
  background: rgba(0,0,0,.20);
}

.title{ font-weight:800; letter-spacing:.4px; font-size:18px; }
.subtitle{
  margin-top:2px;
  font-size:12px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: var(--mono);
}

.topbar__right{
  display:flex;
  align-items:center;
  gap:8px;
  font-family: var(--mono);
  font-size:12px;
  color: var(--muted);
  letter-spacing: .7px;
}
.dot{
  width:8px;height:8px;border-radius:50%;
  background:#00d084;
  box-shadow: 0 0 12px rgba(0,208,132,.55);
}

.tabs{
  display:flex;
  gap:10px;
  padding: 12px 14px;
  border-left:1px solid var(--line2);
  border-right:1px solid var(--line2);
  background: rgba(0,0,0,.18);
}

.tab{
  border:1px solid var(--line);
  background: rgba(0,0,0,.18);
  color: var(--gold);
  padding: 10px 14px;
  border-radius:10px;
  cursor:pointer;
  font-weight:800;
  letter-spacing:1px;
  text-transform: uppercase;
  font-family: var(--mono);
  transition: transform .08s ease, background .2s ease, border-color .2s ease;
}
.tab:hover{ background: rgba(240,200,98,.12); border-color: rgba(240,200,98,.75); }
.tab:active{ transform: translateY(1px); }
.tab.active{
  background: rgba(240,200,98,.18);
  border-color: rgba(240,200,98,.9);
  color: #fff;
}

.panel{
  border: 1px solid var(--line2);
  border-top: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  overflow:hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 140px), var(--panel);
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
}

.panel__header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,.12);
  font-family: var(--mono);
}
.panel__title{ color: var(--gold2); font-weight:900; letter-spacing:1px; }
.panel__meta{ color: var(--muted); font-size:12px; }

.panel__body{
  position:relative;
  padding: 16px;
  min-height: 420px;
}

.panel__body::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,.03),
    rgba(255,255,255,.03) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity:.28;
}

/* layout database */
.grid{
  display:grid;
  grid-template-columns: 260px 1fr;
  gap:14px;
  position:relative;
  z-index:1;
}

.card{
  border: 1px solid var(--line2);
  background: rgba(0,0,0,.14);
  border-radius: 12px;
  overflow:hidden;
}

.card__header{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  background: rgba(240,200,98,.08);
  font-family: var(--mono);
  font-weight:900;
  letter-spacing:1px;
  color: var(--gold2);
}

.photo{
  width:100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  display:block;
  filter: contrast(1.05) saturate(.95);
}

.photo__fallback{
  width:100%;
  aspect-ratio: 1/1;
  display:grid;
  place-items:center;
  font-family: var(--mono);
  color: var(--muted);
  background: rgba(0,0,0,.25);
}

.card__body{
  padding:12px;
  font-family: var(--mono);
  color: var(--muted);
  font-size:12px;
  line-height:1.5;
}

.divider{
  height:1px;
  background: rgba(180,220,255,.10);
  margin: 10px 0;
}

.mini-title{
  color: rgba(255, 216, 138, 0.95);
  font-weight: 900;
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.mini-item{
  color: rgba(234,242,255,.78);
  font-family: var(--mono);
  line-height: 1.55;
}
.mini-list{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.table{
  border: 1px solid var(--line2);
  background: rgba(0,0,0,.14);
  border-radius: 12px;
  overflow:hidden;
}

.table__top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  background: rgba(240,200,98,.08);
  font-family: var(--mono);
  letter-spacing:1px;
}
.table__top .left{ font-weight:900; color: var(--gold2); }
.table__top .right{ color: var(--muted); font-size:12px; }

.rows{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:0;
}

.row{
  padding:10px 12px;
  border-bottom:1px solid rgba(180,220,255,.10);
  border-right:1px solid rgba(180,220,255,.10);
}
.row:nth-child(2n){ border-right:none; }

.label{
  font-family: var(--mono);
  color: var(--gold);
  font-weight:900;
  letter-spacing:.8px;
  text-transform: uppercase;
  font-size:11px;
  margin-bottom:6px;
}
.value{
  font-family: var(--mono);
  color: var(--text);
  font-size:13px;
  line-height:1.45;
  white-space: pre-wrap;
}

/* tags */
.tags{ display:flex; flex-wrap:wrap; gap:10px; }
.tag{
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: rgba(0,0,0,.18);
  color: var(--muted);
}
.tag.small{
  font-size: 11px;
  padding: 6px 8px;
  opacity: .92;
}

/* typed area */
.typed{
  font-family: var(--mono);
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(180,220,255,.10);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  padding: 12px;
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--text);
}

/* ✅ PROFILE bottom (fills the empty area inside Agency Record) */
.profile-bottom{
  border-top: 1px solid rgba(180,220,255,.12);
  background: rgba(0,0,0,.10);
}
.profile-bottom__header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 12px;
  border-bottom:1px solid rgba(180,220,255,.10);
  background: rgba(240,200,98,.06);
  font-family: var(--mono);
  letter-spacing:1px;
}
.profile-bottom__header .left{
  font-weight:900;
  color: var(--gold2);
}
.profile-bottom__header .right{
  color: var(--muted);
  font-size:12px;
}

.profile-bottom__body{
  padding:12px;
  display:grid;
  grid-template-columns: 1fr 320px;
  gap:12px;
}
.profile-chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-content:flex-start;
}
.profile-assessment{
  border: 1px solid rgba(180,220,255,.10);
  border-left: 3px solid rgba(255, 90, 90, 0.70);
  border-radius: 12px;
  background: rgba(0,0,0,.18);
  padding: 10px 10px 10px 12px;
}
.assessment-pre{
  margin:0;
  font-family: var(--mono);
  color: rgba(234,242,255,.82);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* responsive: stack on narrow screens */
@media (max-width: 860px){
  .grid{ grid-template-columns: 1fr; }
  .profile-bottom__body{ grid-template-columns: 1fr; }
}

/* footer */
.footer{
  margin-top:10px;
  display:flex;
  justify-content:space-between;
  gap:10px;
  color: rgba(234,242,255,.55);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 4px;
}

/* ===== MAP VIEWER ===== */
.map-viewer{
  border-radius: 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255, 216, 138, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
  overflow: hidden;
  position: relative;
}

.map-toolbar{
  position:absolute;
  top:10px;
  right:10px;
  display:flex;
  gap:8px;
  z-index: 5;
}

.map-btn{
  font-family: var(--mono);
  font-weight: 900;
  letter-spacing: .8px;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 216, 138, 0.28);
  background: rgba(0,0,0,.25);
  color: var(--gold2);
  cursor:pointer;
  user-select:none;
}
.map-btn:hover{
  border-color: rgba(255, 216, 138, 0.6);
  background: rgba(240,200,98,.10);
}
.map-btn:active{ transform: translateY(1px); }

.map-hint{
  position:absolute;
  left:12px;
  top:12px;
  z-index:5;
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(234,242,255,.7);
  background: rgba(0,0,0,.20);
  border: 1px solid rgba(180,220,255,.12);
  border-radius: 10px;
  padding: 8px 10px;
}

.map-stage{
  height: 510px;
  width: 100%;
  position: relative;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.map-stage.dragging{ cursor: grabbing; }

.map-inner{
  position:absolute;
  left:0; top:0;
  transform-origin: 0 0;
  will-change: transform;
}

.map-img{
  display:block;
  max-width:none;
  user-select:none;
  pointer-events:none;
  image-rendering: auto;
  filter: contrast(1.02) saturate(.98);
}

/* ===== CINEMATIC ALERT PIN ===== */
.map-pin{
  position:absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  z-index: 6;
  pointer-events: none;
}

.pin-pulse{
  position:absolute;
  left:50%;
  top:100%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255, 110, 110, .55);
  box-shadow: 0 0 22px rgba(255,110,110,.22);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse{
  0%{ opacity:.90; transform: translate(-50%,-50%) scale(.65); }
  100%{ opacity:0; transform: translate(-50%,-50%) scale(2.0); }
}

.pin-marker{
  position:absolute;
  left:50%;
  top:100%;
  transform: translate(-50%, -92%);
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.45));
}

.pin-svg{ width: 54px; height: 54px; display:block; }
.pin-svg path{
  fill: rgba(255, 90, 90, 0.98);
  stroke: rgba(255,255,255,.22);
  stroke-width: 1.2;
}
.pin-svg circle{
  fill: rgba(0,0,0,.22);
  stroke: rgba(255,255,255,.18);
  stroke-width: 1.2;
}
.pin-svg rect{ fill: rgba(255,216,138,0.95); }
.pin-svg circle:last-child{ fill: rgba(255,216,138,0.95); }

.pin-label{
  position:absolute;
  left: 62px;
  top: 100%;
  transform: translate(0, -110%);
  min-width: 260px;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 216, 138, 0.28);
  background: rgba(0,0,0,.42);
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  font-family: var(--mono);
  color: rgba(234,242,255,.90);
  letter-spacing: .2px;
}
.pin-label::before{
  content:"";
  position:absolute;
  left:-8px;
  top: 22px;
  width: 14px;
  height: 14px;
  background: rgba(0,0,0,.42);
  border-left: 1px solid rgba(255, 216, 138, 0.28);
  border-bottom: 1px solid rgba(255, 216, 138, 0.28);
  transform: rotate(45deg);
}
.pin-head{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom: 8px;
}
.warn-badge{
  font-weight:900;
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 90, 90, 0.95);
  color: #0b0f17;
  letter-spacing: .8px;
}
.pin-title{
  font-weight: 900;
  text-transform: uppercase;
  color: rgba(255, 216, 138, 0.95);
  letter-spacing: .8px;
}
.pin-body{
  font-size: 12px;
  line-height: 1.45;
  color: rgba(234,242,255,.82);
}