/* Hail Mary command modal — generic "calculable field -> mobilize" overlay.
   Mounted once in base.html (#global-hailmary), opened via window.openHailMary.
   Theme-aware: uses the same design tokens as opp_detail.css. */

[x-cloak] { display: none !important; }

.hm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.45);
}

.hm-panel {
  width: min(1180px, 96vw);
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header / diagnosis ------------------------------------------------------ */
.hm-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.hm-head-main { flex: 1; min-width: 0; }
.hm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b91c1c;
}
.hm-eyebrow::before { content: "\1F3C8"; font-size: 13px; } /* football */
.hm-headline {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 4px 0 2px;
  line-height: 1.2;
}
.hm-subhead { font-size: var(--font-sm); color: var(--text-muted); }
.hm-metric-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.hm-metric-chip .v { font-size: var(--font-lg); font-weight: 700; color: var(--accent); }
.hm-metric-chip .l { font-size: var(--font-2xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hm-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 22px; line-height: 1; padding: 2px 6px;
}
.hm-close:hover { color: var(--text-primary); }

/* Inventory scarcity strip ------------------------------------------------ */
.hm-scarcity {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.hm-scar-chip {
  font-size: var(--font-2xs); font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-secondary);
}
.hm-scar-chip.low { border-color: #f59e0b; color: #b45309; background: rgba(245, 158, 11, 0.12); }
.hm-scar-chip.out { border-color: #dc2626; color: #b91c1c; background: rgba(220, 38, 38, 0.10); }

/* Body: triage board (left) + action sidecar (right) --------------------- */
.hm-body { flex: 1; display: flex; min-height: 0; }
.hm-board {
  flex: 1; min-width: 0; overflow-y: auto; padding: 12px 16px;
  border-right: 1px solid var(--border);
}
.hm-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.hm-search {
  flex: 1; padding: 6px 10px; font-size: var(--font-sm);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-secondary); color: var(--text-primary);
}
.hm-count { font-size: var(--font-2xs); color: var(--text-muted); white-space: nowrap; }

.hm-cohort { margin-bottom: 14px; }
.hm-cohort-head {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--font-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-secondary);
  padding: 4px 2px; position: sticky; top: 0; background: var(--bg-card); z-index: 1;
}
.hm-cohort-head .n {
  font-size: var(--font-2xs); color: var(--text-muted);
  background: var(--bg-secondary); border-radius: 999px; padding: 1px 7px;
}

.hm-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer;
  background: var(--bg-card);
}
.hm-row:hover { border-color: var(--accent); }
.hm-row.is-active { border-color: var(--accent); background: var(--bg-secondary); }
.hm-score {
  font-size: var(--font-sm); font-weight: 700; color: var(--accent);
  text-align: center;
}
.hm-row-main { min-width: 0; }
.hm-acct { font-size: var(--font-sm); font-weight: 600; color: var(--text-primary); }
.hm-contact { font-size: var(--font-2xs); color: var(--text-muted); }
.hm-row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.hm-play {
  font-size: var(--font-2xs); font-weight: 600; padding: 2px 7px;
  border-radius: 999px; background: var(--bg-secondary);
  border: 1px solid var(--border); color: var(--text-secondary);
  white-space: nowrap;
}
.hm-tier { font-size: var(--font-2xs); color: var(--text-muted); }

/* Action sidecar ---------------------------------------------------------- */
.hm-sidecar {
  width: 420px; flex-shrink: 0; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.hm-sc-empty { color: var(--text-muted); font-size: var(--font-sm); text-align: center; margin-top: 40px; }
.hm-sc-acct { font-size: var(--font-md); font-weight: 700; color: var(--text-primary); }
.hm-sc-sub { font-size: var(--font-2xs); color: var(--text-muted); margin-bottom: 4px; }
.hm-sc-section-title {
  font-size: var(--font-2xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-secondary); margin-bottom: 4px;
}
.hm-draft-subject { font-weight: 600; font-size: var(--font-sm); color: var(--text-primary); margin-bottom: 6px; }
.hm-draft-body {
  white-space: pre-wrap; font-size: var(--font-sm); color: var(--text-secondary);
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px; max-height: 320px; overflow-y: auto;
}
.hm-cites { display: flex; flex-wrap: wrap; gap: 4px; }
.hm-cite { font-size: 9px; font-weight: 600; color: var(--accent); background: rgba(0,0,0,0.04); border-radius: 4px; padding: 1px 5px; }
.hm-rejected {
  font-size: var(--font-sm); color: #b45309; background: rgba(245, 158, 11, 0.10);
  border: 1px solid #f59e0b; border-radius: var(--radius-sm); padding: 10px;
}
.hm-sc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.hm-sc-actions .btn { font-size: var(--font-2xs); }

.hm-loading, .hm-error {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: var(--font-sm);
}
.hm-error { color: #b91c1c; }

/* Make any field with a scope opt-in look clickable. */
[data-hm-scope] { cursor: pointer; }
