/* Live rebuilds of the app's own panels — the inspection report, the building card, the chat, the dock
   and the hover card — as HTML/CSS instead of screenshot crops, so they stay crisp at any DPI and follow
   Día/Noche. Measurements, weights and colours are copied from the panel CSS in index.html.

   They are illustrations: every one is role="img" with an aria-label, and nothing inside is focusable. */

.pan { margin: 0; position: relative; }
.pan-sheet {
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--lift);
  padding: 16px;
  font-size: 14px;
  line-height: 1.45;
}
.pan .ic { width: 15px; height: 15px; }

/* the shared bits */
.pan-top { position: relative; padding-right: 22px; }
.pan-repo, .pan-name { font: 700 20px/1.15 var(--display); letter-spacing: -.015em; display: block; word-break: break-word; }
.pan-repo::after { content: " ↗"; font-size: .7em; color: var(--muted); }
.pan-sub { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.pan-close { position: absolute; top: -2px; right: 0; color: var(--muted); font-size: 18px; line-height: 1; }
.pan-crumbs { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); word-break: break-word; }
.pan-crumbs i { font-style: normal; opacity: .55; padding: 0 3px; }

.pan-h {
  font: 700 13px/1.3 var(--display); margin: 16px 0 5px;
  display: flex; align-items: center; gap: 6px;
}
.pan-hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

.pan-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 13px; font-size: 13px; font-weight: 500;
  white-space: nowrap; background: var(--plate);
}
.pan-btn-primary { background: var(--pbg); color: var(--pfg); border-color: var(--pbg); font-weight: 600; }
.pan-btn-wide { display: flex; width: 100%; margin-top: 14px; }
.pan-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
/* the labels must never break one word per line, which is what the cropped screenshot used to show */
.pan-acts .pan-btn { flex: 0 1 auto; min-width: 0; }

/* ---------- inspection report ---------- */
.pan-report .pan-sheet { max-width: 380px; }

.pan-cert { display: flex; gap: 14px; align-items: center; margin: 14px 0 12px; }
.pan-stamp {
  flex: none; width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 40px/1 var(--display);
  color: #ee6c1a; border: 3px solid currentColor;
  outline: 1px solid currentColor; outline-offset: 3px;
  transform: rotate(-8deg);
}
.pan-verdict { min-width: 0; }
.pan-verdict small { display: block; color: var(--muted); font-size: 12px; }
.pan-verdict b { font: 700 26px/1 var(--display); display: block; margin: 1px 0 3px; font-variant-numeric: tabular-nums; }
.pan-verdict b i { font-style: normal; }
.pan-verdict b em { font: 500 13px var(--ui); color: var(--muted); font-style: normal; }
.pan-verdict > span { color: var(--muted); font-size: 13px; display: block; }

.pan-sevs { list-style: none; padding: 0; margin: 4px 0 0; }
.pan-sevs li {
  display: grid; grid-template-columns: 84px 44px minmax(0, 1fr);
  gap: 8px; align-items: center; padding: 5px 6px; border-radius: 6px;
}
.pan-sev-name { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pan-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.pan-sevs b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.pan-bar { display: block; height: 8px; border-radius: 2px; background: var(--c); width: var(--w); min-width: 2px; transform-origin: left center; }
.pan-sev-debt .ic, .pan-sevs li[style*="--ink"] .ic { color: var(--muted); }
.pan-sev-unit { color: var(--muted); font-size: 12px; }

.pan-dists { list-style: none; padding: 0; margin: 0; }
.pan-dists li {
  display: grid; grid-template-columns: 11px minmax(0, 1fr) auto auto;
  gap: 9px; align-items: center; padding: 5px 6px; font-size: 13px;
}
.pan-dists i { width: 11px; height: 11px; border-radius: 2px; background: var(--c); }
.pan-dists b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pan-dists span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.pan-dists em { font-style: normal; font-size: 12px; color: var(--muted); white-space: nowrap; }
.pan-dists em.is-hot { color: var(--hazard); font-weight: 600; }

/* ---------- building card ---------- */
.pan-card .pan-sheet { max-width: 420px; }

.pan-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin: 13px 0 9px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.pan-stats div { padding: 7px 8px; border-left: 1px solid var(--line); min-width: 0; }
.pan-stats div:first-child { border-left: 0; }
.pan-stats b { display: block; font: 700 16px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.pan-stats span { font-size: 11px; color: var(--muted); }

.pan-note { margin: 0; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pan-rel {
  border: 1px solid currentColor; border-radius: 999px;
  padding: 1px 9px; font-size: 12px; white-space: nowrap;
}
.pan-rel-out { color: #e8752a; }
.pan-rel-in { color: #1fa3cf; }

.pan-find { border-left: 3px solid var(--c); padding: 3px 0 3px 9px; margin: 7px 0; font-size: 13px; }
.pan-find b { font-weight: 600; }
.pan-find small { display: block; color: var(--muted); word-break: break-all; font-size: 12px; }

/* ---------- chat ---------- */
.pan-chat .pan-sheet { max-width: 440px; padding: 0; overflow: hidden; }
.pan-chat-top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.pan-chat-top b { font: 700 16px var(--display); display: inline-flex; align-items: center; gap: 8px; }
.pan-select {
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.pan-select::after { content: " ⌄"; }

.pan-log { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.pan-msg { padding: 10px 12px; border-radius: 12px; margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.pan-msg code { background: var(--hover); border-radius: 4px; padding: 0 4px; font-size: 12.5px; word-break: break-all; }
.pan-user { background: var(--pbg); color: var(--pfg); align-self: flex-end; max-width: 88%; border-bottom-right-radius: 3px; }
.pan-bot { background: var(--soft); border-bottom-left-radius: 3px; }
.pan-bot p { margin: 0 0 .7em; }
.pan-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 0 !important; }
.pan-chip {
  border: 1px solid var(--survey); color: var(--survey);
  border-radius: 999px; padding: 2px 9px; font-size: 12px; white-space: nowrap;
}
.pan-meta { display: block; margin-top: 9px; font-size: 11px; color: var(--muted); }
/* the caret only exists while the motion module is typing the answer */
.pan-bot.is-typing .pan-word:last-of-type::after {
  content: ""; display: inline-block; width: 2px; height: 1em;
  background: var(--survey); margin-left: 2px; vertical-align: -2px;
  animation: pan-caret .8s steps(1) infinite;
}
@keyframes pan-caret { 50% { opacity: 0; } }

/* ---------- dock ---------- */
.pan-dock .pan-sheet { width: fit-content; max-width: 100%; padding: 7px 10px 5px; border-radius: 12px; }
.pan-dock-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pan-seg { display: flex; gap: 2px; background: var(--hover); border-radius: 10px; padding: 2px; }
.pan-seg > span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 8px; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.pan-seg > span.is-on { background: var(--pbg); color: var(--pfg); }
.pan-dock-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.pan-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); padding: 0 6px; white-space: nowrap; }
.pan-box { width: 13px; height: 13px; border-radius: 3px; background: var(--survey); position: relative; }
.pan-box::after { content: ""; position: absolute; inset: 0; border-left: 2px solid var(--plate); border-bottom: 2px solid var(--plate); width: 7px; height: 4px; margin: 3px auto auto 3px; transform: rotate(-45deg); }
.pan-tool { display: inline-grid; place-items: center; width: 34px; height: 32px; border-radius: 9px; font: 600 12px var(--ui); }
.pan-dock-legend { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 11px; color: var(--muted); padding: 4px 8px 2px; }
.pan-ramp { display: block; width: 110px; height: 8px; border-radius: 2px; background: var(--heat); transform-origin: left center; }

/* ---------- hover card ---------- */
.pan-hover .pan-sheet { max-width: 300px; padding: 12px 14px; border-left: 4px solid var(--c); }
.pan-hover .pan-name { font-size: 16px; }
.pan-where { display: block; color: var(--muted); font-size: 12px; margin: 2px 0 9px; word-break: break-all; }
.pan-nums { display: flex; gap: 14px; margin-bottom: 9px; }
.pan-nums b { font: 700 15px/1.2 var(--display); display: block; font-variant-numeric: tabular-nums; }
.pan-nums span { font-size: 11px; color: var(--muted); }
.pan-hover-sevs { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; font-weight: 600; font-size: 13px; }
.pan-hover-sevs span { display: inline-flex; align-items: center; gap: 5px; }
.pan-hover-sevs i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.pan-hover-hint { display: block; color: var(--muted); font-size: 12px; margin-top: 9px; }

/* ---------- placement ---------- */
/* the card and the hover card as one overlapping cluster, the way they sit over the real city */
.pan-cluster { position: relative; display: grid; justify-items: start; padding-bottom: 148px; }
.pan-cluster .pan-hover { position: absolute; right: -18px; bottom: 0; z-index: 2; width: min(300px, 82%); }

.pan-figcap {
  margin-top: 14px; padding-left: 12px; border-left: 2px solid var(--line);
  font-size: .875rem; line-height: 1.5; color: var(--muted); max-width: 44ch;
}
.pan-figcap b { color: var(--ink); font-weight: 600; }

@media (max-width: 760px) {
  .pan-sheet { font-size: 13.5px; }
  /* the dock is the one component with a row that will not wrap on its own */
  .pan-dock .pan-sheet { width: auto; }
  .pan-dock-row { justify-content: center; }
  .pan-seg { flex-wrap: wrap; justify-content: center; }
  .pan-dock-sep { display: none; }
  .pan-stamp { width: 62px; height: 62px; font-size: 32px; }
  .pan-cluster { padding-bottom: 0; }
  .pan-cluster .pan-hover { position: static; max-width: 100%; margin-top: 16px; }
  .pan-sevs li { grid-template-columns: 76px 40px minmax(0, 1fr); }
}
