/* Profile-mode overrides for /infra/<type>/<id>.
 *
 * The page reuses the app shell (topbar + LAYERS sidebar + ticker) but
 * the <main id="map"> holds static profile HTML instead of Leaflet. We
 * convert that area into a scrollable content panel and style the inner
 * blocks to match the app's dark-mode tokens. */

body.profile-mode #map {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}
body.profile-mode #map .leaflet-container { display: none; }

/* The legacy Tools section / Timeline / Markers blocks in the left panel
 * are still visible but slightly dimmed in profile mode to hint they're
 * map-bound. Layer toggles are kept full-bright since clicking them
 * deep-links to /app with that state. */
body.profile-mode #left-panel .panel-section:not(:first-of-type) { opacity: 0.7; }
body.profile-mode #left-panel .panel-section:not(:first-of-type):hover { opacity: 1; }

/* ─── Profile content ─────────────────────────────────────── */
.profile-shell {
  max-width: 960px;
  margin: 24px auto 64px;
  padding: 0 28px;
  color: var(--text-primary);
}

.profile-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.profile-head .kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.profile-head h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
}
.profile-head .sub {
  color: var(--text-muted);
  font-size: 13px;
}
.profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.profile-actions a {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.profile-actions a:hover { border-color: #00b3e6; }
.profile-actions .primary {
  background: #00b3e6;
  color: #06121a;
  border-color: #00b3e6;
}
.profile-actions .primary:hover { background: #00d4ff; border-color: #00d4ff; }

.profile-badge-main {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 179, 230, 0.16);
  color: #00b3e6;
  letter-spacing: 0.04em;
  margin-left: 8px;
  vertical-align: middle;
  font-family: "IBM Plex Mono", monospace;
}

.profile-narr {
  font-size: 14px;
  line-height: 1.65;
  padding: 14px 18px;
  background: rgba(0, 179, 230, 0.06);
  border-left: 3px solid #00b3e6;
  border-radius: 4px;
  margin-bottom: 28px;
}

.profile-section { margin-bottom: 32px; }
.profile-section h2 {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.profile-subhead {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 22px 0 8px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.profile-stat {
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.profile-stat .label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.profile-stat .value {
  font-size: 20px;
  font-weight: 600;
  word-break: break-word;
}
.profile-stat.warn {
  background: rgba(220, 60, 60, 0.10);
  border-color: #cc4444;
}

.profile-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.profile-table th,
.profile-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.profile-table th {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 500;
}
.profile-table td.num,
.profile-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.profile-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 12px 0;
}

.profile-signal {
  padding: 10px 12px;
  border-left: 3px solid var(--border);
  margin-bottom: 8px;
  background: var(--bg-secondary);
  border-radius: 0 4px 4px 0;
}
.profile-signal.urgent { border-left-color: #ef4444; }
.profile-signal.watch  { border-left-color: #f59e0b; }
.profile-signal .sev {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--border);
  margin-right: 8px;
  font-family: "IBM Plex Mono", monospace;
}
.profile-signal.urgent .sev { background: #ef4444; color: white; }
.profile-signal.watch  .sev { background: #f59e0b; color: #1a1100; }
.profile-signal .title { font-weight: 600; }
.profile-signal .body {
  color: var(--text-muted);
  margin-top: 4px;
  font-size: 13px;
}

/* ─── Profile tabs ───────────────────────────────────────────
 * Used by both the inline overlay view and the standalone profile
 * page. Click handlers live in command-center.js (overlay) and an
 * inline script in templates/_infra_profile_body.html (standalone). */
.profile-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: 4px 0 24px;
}
.profile-tab {
  font: inherit;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 10px 16px;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.profile-tab:hover { color: var(--text-primary); }
.profile-tab.active {
  color: #00b3e6;
  border-bottom-color: #00b3e6;
}

.profile-tab-body { display: none; }
.profile-tab-body.active { display: block; }

/* ─── Profile tab — simple key/value table (no cards) ─────────── */
.profile-kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.profile-kv th,
.profile-kv td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.profile-kv th {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 500;
  width: 240px;
  white-space: nowrap;
}
.profile-kv td {
  color: var(--text-primary);
  font-weight: 500;
}
.profile-kv tr:last-child th,
.profile-kv tr:last-child td { border-bottom: 0; }
.profile-kv tr.warn th,
.profile-kv tr.warn td {
  background: rgba(220, 60, 60, 0.08);
  color: #ff8a8a;
}

/* Icon-only action in the profile head — transparent, no border, no
 * background. Sits next to the title and just shows the emoji glyph. */
.profile-actions .profile-icon-btn {
  background: transparent;
  border: 0;
  padding: 4px 6px;
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 4px;
  transition: opacity 0.15s;
}
.profile-actions .profile-icon-btn:hover {
  opacity: 0.75;
  background: transparent;
  border: 0;
}

/* ─── Inline-row link affordances ────────────────────────────
 * 📍 pin at the start of each row in supply chain / chokepoint /
 * vessel tables flies the map there. Names become subtle text links
 * that route to the relevant detail surface. */
.profile-row-pin-cell {
  width: 28px;
  text-align: center;
  vertical-align: middle;
  padding-left: 4px !important;
  padding-right: 4px !important;
}
.profile-row-pin {
  text-decoration: none;
  font-size: 13px;
  line-height: 1;
  opacity: 0.7;
  cursor: pointer;
}
.profile-row-pin:hover { opacity: 1; }
.profile-row-pin-empty {
  color: var(--text-muted);
  opacity: 0.4;
  cursor: default;
}
.profile-row-link {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px dotted var(--border);
  transition: color 0.12s, border-color 0.12s;
}
.profile-row-link:hover {
  color: #00b3e6;
  border-bottom-color: #00b3e6;
}
