/* Leaders System */

/* ── Leaders Tab View ── */
.leaders-tab-view {
  grid-column: 1 / -1;
  padding: var(--sp-2, 0.5rem) 0;
}

.leaders-tab-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--sp-3, 0.75rem);
  padding: 0 var(--sp-1, 0.25rem);
}

.leaders-tab-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  letter-spacing: 0.02em;
}

.leaders-tab-slots {
  font-size: 0.8rem;
  color: var(--text-secondary, #94a3b8);
  font-variant-numeric: tabular-nums;
}

/* Slots full message */
.leaders-tab-full {
  text-align: center;
  padding: var(--sp-2, 0.5rem) var(--sp-3, 0.75rem);
  margin-top: var(--sp-3, 0.75rem);
  font-size: 0.8rem;
  color: var(--text-secondary, #94a3b8);
  background: var(--surface-1, rgba(255,255,255,0.03));
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}

/* ── Section header between active leaders and candidates ── */
.leaders-tab-section-header {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim, #64748b);
  padding: var(--sp-3, 0.75rem) var(--sp-1, 0.25rem) var(--sp-2, 0.5rem);
  display: flex;
  align-items: center;
  gap: var(--sp-2, 0.5rem);
}
.leaders-tab-cost {
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: none;
}

/* ── Candidate Cards ── */
.leader-card-candidate {
  border-style: dashed !important;
  opacity: 0.7;
  cursor: pointer;
}
.leader-card-candidate:hover {
  opacity: 1;
}
.leader-card-candidate .card-art img {
  opacity: 0.5;
  filter: grayscale(0.3);
}

/* Leader portraits: ensure cover + top-align for faces, force square aspect */
[data-card-kind="leader"] .card-art,
[data-card-kind="leader-candidate"] .card-art {
  aspect-ratio: 1;
}
[data-card-kind="leader"] .card-art img,
[data-card-kind="leader-candidate"] .card-art img {
  object-fit: cover;
  object-position: top;
}

/* ── Leader Card overrides (within building-card) ── */
.leader-card-sp {
  border-color: rgba(245, 158, 11, 0.3) !important;
}

.leader-card-meta {
  padding: 0 var(--sp-1, 0.25rem);
}

.leader-card-fleet {
  font-size: 0.7rem;
  color: var(--accent-primary, #00f0ff);
  font-weight: 500;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leader-card-unassigned {
  color: var(--text-dim, #475569);
  font-style: italic;
}

.leader-card-rank {
  font-size: 0.75rem;
  color: #f59e0b;
  font-weight: 500;
  margin-top: 2px;
}

.leader-card-spec {
  font-size: 0.72rem;
  color: var(--text-secondary, #94a3b8);
  margin-top: 1px;
}
.leader-card-mission {
  margin-top: 5px;
  font-size: 0.68rem;
  color: rgba(245, 158, 11, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leader-card-value {
  color: var(--text-secondary, #94a3b8);
}

.leader-card-bottom {
  display: flex;
  align-items: center;
  gap: var(--sp-2, 0.5rem);
  margin-top: 3px;
}

.leader-card-lvl {
  font-size: 0.75rem;
  color: var(--text-secondary, #94a3b8);
}

.leader-sp-badge {
  background: var(--accent-primary, #00f0ff);
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
}

.leader-rank-pips {
  font-size: 0.7em;
  color: #f59e0b;
  letter-spacing: 1px;
}

/* ── XP Bar ── */
.leader-xp-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}

.leader-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── Leader Detail Overlay ── */
.leader-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--scrim-70);
  backdrop-filter: blur(var(--blur-sm));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4, 1rem);
}

.leader-detail-panel {
  background: var(--surface-bg, #0f172a);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
  border-radius: var(--radius-lg, 12px);
  max-width: 860px;
  width: calc(100% - 2rem);
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  padding: 0;
}
@media (max-width: 700px) {
  .leader-detail-panel { max-width: 100%; }
}

/* ── Hero Banner ── */
.leader-detail-hero {
  position: relative;
  min-height: 132px;
  border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0;
  overflow: hidden;
  background: #0b1220;
}
.leader-detail-hero-art {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.leader-detail-hero-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../../assets/events/leaders.webp') center/cover no-repeat;
  opacity: 0.1;
  mix-blend-mode: screen;
  pointer-events: none;
}
.leader-detail-hero--tactician .leader-detail-hero-art {
  background:
    repeating-linear-gradient(-24deg, transparent, transparent 18px, rgba(239, 68, 68, 0.05) 18px, rgba(239, 68, 68, 0.05) 19px),
    radial-gradient(ellipse 90% 120% at 88% 18%, rgba(248, 113, 113, 0.42), transparent 58%),
    radial-gradient(ellipse 55% 70% at 8% 92%, rgba(127, 29, 29, 0.55), transparent),
    linear-gradient(128deg, #160808 0%, #331313 42%, #0f172a 100%);
}
.leader-detail-hero--strategist .leader-detail-hero-art {
  background:
    repeating-linear-gradient(90deg, transparent, transparent 28px, rgba(59, 130, 246, 0.06) 28px, rgba(59, 130, 246, 0.06) 29px),
    radial-gradient(ellipse 95% 110% at 92% 24%, rgba(96, 165, 250, 0.4), transparent 60%),
    radial-gradient(ellipse 50% 65% at 6% 88%, rgba(30, 64, 175, 0.5), transparent),
    linear-gradient(128deg, #07101f 0%, #12264a 45%, #0f172a 100%);
}
.leader-detail-hero--survivor .leader-detail-hero-art {
  background:
    repeating-linear-gradient(0deg, transparent, transparent 14px, rgba(16, 185, 129, 0.05) 14px, rgba(16, 185, 129, 0.05) 15px),
    radial-gradient(ellipse 85% 100% at 90% 20%, rgba(52, 211, 153, 0.34), transparent 58%),
    radial-gradient(ellipse 48% 62% at 10% 90%, rgba(6, 78, 59, 0.52), transparent),
    linear-gradient(128deg, #061410 0%, #10352a 44%, #0f172a 100%);
}
.leader-detail-hero--prodigy .leader-detail-hero-art {
  background:
    radial-gradient(circle at 78% 22%, rgba(251, 191, 36, 0.34), transparent 34%),
    radial-gradient(circle at 62% 38%, rgba(245, 158, 11, 0.16), transparent 22%),
    radial-gradient(ellipse 70% 90% at 12% 88%, rgba(120, 53, 15, 0.45), transparent),
    linear-gradient(128deg, #171005 0%, #3b2a0d 40%, #0f172a 100%);
}
.leader-detail-hero--mercenary .leader-detail-hero-art {
  background:
    repeating-linear-gradient(45deg, transparent, transparent 16px, rgba(239, 68, 68, 0.06) 16px, rgba(239, 68, 68, 0.06) 17px),
    radial-gradient(ellipse 90% 110% at 88% 18%, rgba(248, 113, 113, 0.36), transparent 58%),
    radial-gradient(ellipse 55% 70% at 8% 90%, rgba(127, 29, 29, 0.48), transparent),
    linear-gradient(128deg, #180606 0%, #3a1010 42%, #0f172a 100%);
}
.leader-detail-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(11, 18, 32, 0.82) 0%, rgba(11, 18, 32, 0.45) 48%, rgba(11, 18, 32, 0.2) 100%);
  pointer-events: none;
}
.leader-detail-hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  min-height: 132px;
  padding: 14px 48px 14px 16px;
}
.leader-detail-portrait {
  flex-shrink: 0;
  width: 76px;
  height: 96px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: #0b1220;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.leader-detail-portrait-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}
.leader-detail-hero-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (max-width: 480px) {
  .leader-detail-portrait {
    width: 64px;
    height: 82px;
  }
  .leader-detail-hero-content {
    gap: 10px;
    padding: 12px 44px 12px 12px;
    min-height: 118px;
  }
}

.leader-detail-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px var(--scrim-50);
}

.leader-detail-rank {
  font-size: 0.85rem;
  color: #f59e0b;
  font-weight: 600;
  margin-top: 2px;
  text-shadow: 0 1px 4px var(--scrim-50);
}

.leader-detail-tags {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.leader-tag-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.leader-tag-label {
  font-size: 0.52rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  text-shadow: 0 1px 3px var(--scrim-50);
  line-height: 1;
}
.leader-chat-icon { display: none; }
.leader-chat-btn {
  flex: 1;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-primary, #00f0ff);
  background: rgba(0, 240, 255, 0.18);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
  position: relative;
  overflow: hidden;
}
.leader-chat-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.15), transparent);
  animation: leader-chat-shine 3s ease-in-out infinite;
  pointer-events: none;
}
@keyframes leader-chat-shine {
  0%, 100% { left: -100%; }
  50% { left: 140%; }
}
.leader-chat-btn:hover {
  background: rgba(0, 240, 255, 0.28);
  border-color: rgba(0, 240, 255, 0.50);
}
.leader-fleet-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.leader-detail-action-row {
  display: flex;
  gap: 10px;
  margin-top: var(--sp-3, 0.75rem);
  padding-top: var(--sp-3, 0.75rem);
  border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}
.leader-detail-action-row .leader-relocate-btn,
.leader-detail-action-row .leader-chat-btn {
  flex: 1;
  justify-content: center;
  padding: 8px 14px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  border-radius: 6px;
}
.leader-detail-action-row .leader-relocate-btn svg {
  width: 14px;
  height: 14px;
}
.leader-fleet-row .leader-detail-fleet-label {
  font-size: 0.7rem;
  white-space: nowrap;
  margin-bottom: 0;
}
.leader-fleet-row .leader-fleet-select {
  flex: 1;
}
.leader-fleet-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.leader-fleet-actions .leader-relocate-btn,
.leader-fleet-actions .leader-dismiss-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-sizing: border-box;
  height: 28px;
  min-width: 88px;
  padding: 0 10px !important;
  font-size: 0.65rem !important;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
}
.leader-fleet-actions .leader-relocate-btn svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}
.leader-fleet-actions .leader-dismiss-btn {
  opacity: 0.85;
}
.leader-detail-footer {
  display: flex;
  justify-content: center;
  padding: var(--sp-2, 0.5rem) var(--sp-4, 1rem) var(--sp-4, 1rem);
}
.leader-remove-btn {
  appearance: none;
  border: none;
  background: none;
  color: rgba(239, 68, 68, 0.5);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 150ms ease;
}
.leader-remove-btn:hover {
  color: #ef4444;
}
.leader-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.leader-tag-spec {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}
.leader-tag-origin {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary, #94a3b8);
}
.leader-tag-fleet {
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-primary, #00f0ff);
}
.leader-tag-home {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
}

/* ── Stats Bar ── */
.leader-detail-stats {
  display: flex;
  gap: var(--sp-3, 0.75rem);
  padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem);
  align-items: flex-start;
}
.leader-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.leader-stat-xp {
  flex: 1;
  min-width: 0;
}
.leader-stat-label {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim, #475569);
  line-height: 1;
  min-height: 0.6rem;
}
.leader-stat-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.leader-stat-level {
  flex-shrink: 0;
}
.leader-level-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, 0.38);
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.16), rgba(15, 23, 42, 0.55));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.leader-level-badge-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fbbf24;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.leader-stat-sp {
  color: var(--accent-primary, #00f0ff);
}
.leader-stat-sp-available {
  position: relative;
  overflow: hidden;
}
.leader-stat-sp-available::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.35), transparent);
  animation: leader-sp-shimmer 3s ease-in-out infinite;
}
@keyframes leader-sp-shimmer {
  0%, 80%, 100% { left: -100%; }
  40% { left: 150%; }
}

/* ── Skill Instruction Banner ── */
.leader-skill-instruction {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 0 var(--sp-4, 1rem) 10px;
  font-size: 0.78rem;
  color: var(--accent-primary, #00f0ff);
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: var(--radius-sm, 6px);
}
.leader-skill-instruction .icon {
  width: 14px; height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* ── Skill Tree ── */
.leader-skill-tree {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3, 0.75rem);
  padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem);
}
@media (max-width: 600px) {
  .leader-skill-tree { grid-template-columns: 1fr; }
}

.leader-skill-branch {
  --branch-color: #94a3b8;
  background: var(--surface-1, rgba(255,255,255,0.03));
  border-radius: var(--radius-sm, 6px);
  padding: 0 var(--sp-3, 0.75rem) var(--sp-2, 0.5rem);
  border-top: 2px solid color-mix(in srgb, var(--branch-color) 40%, transparent);
  overflow: hidden;
}
.leader-skill-branch[data-branch="combat"]  { --branch-color: #ef4444; }
.leader-skill-branch[data-branch="fleet"]   { --branch-color: #3b82f6; }
.leader-skill-branch[data-branch="survival"]{ --branch-color: #10b981; }

.leader-branch-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--branch-color);
  margin: 0;
  padding: var(--sp-2, 0.5rem) 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: var(--sp-2, 0.5rem);
  background: linear-gradient(90deg, color-mix(in srgb, var(--branch-color) 8%, transparent), transparent 70%);
  margin-left: calc(-1 * var(--sp-3, 0.75rem));
  margin-right: calc(-1 * var(--sp-3, 0.75rem));
  padding-left: var(--sp-3, 0.75rem);
  padding-right: var(--sp-3, 0.75rem);
}

.leader-skill-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 0;
  font-size: 0.85rem;
  color: var(--text-secondary, #94a3b8);
  border-radius: var(--radius-sm, 4px);
  transition: background 0.15s;
}

.leader-skill-row.upgradable {
  cursor: pointer;
  color: var(--text-primary, #e2e8f0);
}

.leader-skill-row.upgradable:hover {
  background: rgba(0, 240, 255, 0.08);
}

.leader-skill-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-secondary, #94a3b8);
}
.leader-skill-icon svg {
  width: 100%;
  height: 100%;
}
.leader-skill-row.upgradable .leader-skill-icon {
  color: var(--accent-primary, #00f0ff);
}

.leader-skill-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.leader-skill-name {
  flex: none;
  min-width: 0;
  line-height: 1.25;
}

.leader-skill-bonus {
  font-size: 0.75rem;
  color: var(--accent-primary, #00f0ff);
  opacity: 0.8;
  margin-top: 1px;
}

.leader-skill-bonus-next {
  color: var(--text-dim, #475569);
  font-style: italic;
}

.leader-skill-pips {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
  align-self: center;
}

.leader-skill-pips .pip {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.2);
}

.leader-skill-pips .pip.filled {
  background: var(--branch-color, #00f0ff);
  border-color: var(--branch-color, #00f0ff);
}

.leader-skill-pips .pip.empty {
  background: rgba(255,255,255,0.05);
}

/* ── Fleet Assignment (detail modal) ── */
.leader-detail-fleet {
  margin: 0 var(--sp-4, 1rem) var(--sp-3, 0.75rem);
  padding: var(--sp-3, 0.75rem);
  background: var(--surface-1, rgba(255,255,255,0.03));
  border-radius: var(--radius-sm, 6px);
}

.leader-detail-fleet-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: var(--sp-2, 0.5rem);
}

.leader-fleet-select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  background: var(--surface-2, rgba(255,255,255,0.05));
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
  border-radius: var(--radius-sm, 6px);
  color: var(--text-primary, #e2e8f0);
  font-size: 0.85rem;
  cursor: pointer;
}

.leader-fleet-select:focus {
  outline: none;
  border-color: var(--accent-primary, #00f0ff);
}

/* ── Detail Actions ── */
.leader-detail-actions {
  display: flex;
  gap: var(--sp-2, 0.5rem);
  justify-content: space-between;
  padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem);
  border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}

.leader-detail-actions .btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.leader-detail-actions .btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ── Close Button (top-right X) ── */
.leader-detail-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  background: var(--scrim-50);
  color: #fff;
  line-height: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  backdrop-filter: blur(var(--blur-sm));
  -webkit-appearance: none;
  appearance: none;
}
.leader-detail-close:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255,255,255,0.4);
}

/* ── Branch-colored skill icons ── */
.leader-skill-row.branch-combat .leader-skill-icon {
  color: #ef4444;
}
.leader-skill-row.branch-fleet .leader-skill-icon {
  color: #3b82f6;
}
.leader-skill-row.branch-survival .leader-skill-icon {
  color: #10b981;
}
/* Upgradable overrides branch color with brighter variant */
.leader-skill-row.upgradable.branch-combat .leader-skill-icon {
  color: #f87171;
}
.leader-skill-row.upgradable.branch-fleet .leader-skill-icon {
  color: #60a5fa;
}
.leader-skill-row.upgradable.branch-survival .leader-skill-icon {
  color: #34d399;
}

/* ── Branch-colored bonus text ── */
.leader-skill-row.branch-combat .leader-skill-bonus-active {
  color: #f87171;
}
.leader-skill-row.branch-fleet .leader-skill-bonus-active {
  color: #60a5fa;
}
.leader-skill-row.branch-survival .leader-skill-bonus-active {
  color: #34d399;
}

/* Active bonus: prominent current value */
.leader-skill-bonus-active {
  font-size: 0.78rem;
  opacity: 1;
}
.leader-skill-bonus-active strong {
  font-weight: 700;
  font-size: 0.85rem;
}

/* Next tier arrow preview (dimmed) */
.leader-skill-bonus-active .leader-skill-bonus-next {
  font-size: 0.72rem;
  font-style: italic;
}

/* ── Skill description line ── */
.leader-skill-desc {
  font-size: 0.72rem;
  color: var(--text-dim, #475569);
  line-height: 1.35;
  margin-top: 1px;
}

/* ── Detail Body (profile + skills) ── */
.leader-detail-body {
  padding-bottom: var(--sp-3, 0.75rem);
}

.leader-detail-body .leader-skill-tree {
  margin-top: var(--sp-1, 0.25rem);
  padding-top: var(--sp-3, 0.75rem);
}

.leader-detail-body .leader-skill-instruction {
  margin-top: var(--sp-2, 0.5rem);
}

/* ── Detail Tabs (candidates / merc previews) ── */
.leader-detail-tabs {
  display: flex;
  gap: 4px;
  padding: var(--sp-2, 0.5rem) var(--sp-4, 1rem);
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
  margin-bottom: var(--sp-3, 0.75rem);
}

.leader-detail-tab {
  appearance: none;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-secondary, #94a3b8);
  border-radius: 0;
  padding: 8px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.leader-detail-tab:hover {
  color: var(--text-primary, #e2e8f0);
}

.leader-detail-tab.is-active {
  background: none;
  border-bottom-color: var(--accent-primary, #00f0ff);
  color: var(--accent-primary, #00f0ff);
}

.leader-detail-tab-panel {
  display: none;
}

.leader-detail-tab-panel.is-active {
  display: block;
}

/* ── Leader Chat ── */
.leader-chat-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 var(--sp-4, 1rem) var(--sp-4, 1rem);
}

.leader-chat-head {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  background:
    radial-gradient(circle at top right, rgba(0, 240, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(8, 16, 32, 0.92), rgba(8, 16, 32, 0.78));
}

.leader-chat-kicker {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-primary, #00f0ff);
}

.leader-chat-subtitle {
  margin-top: 6px;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
}

.leader-chat-copy {
  margin-top: 6px;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--text-secondary, #94a3b8);
}

.leader-chat-mission-card {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.18);
  background: linear-gradient(180deg, rgba(48, 28, 10, 0.78), rgba(20, 16, 18, 0.86));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leader-chat-mission-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leader-chat-mission-kicker {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f59e0b;
}

.leader-chat-mission-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
}

.leader-chat-mission-objective {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-secondary, #cbd5e1);
}

.leader-chat-mission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.68rem;
  color: var(--text-dim, #94a3b8);
}

.leader-chat-mission-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.leader-chat-mission-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary, #94a3b8);
}

.leader-chat-mission-status.status-accepted {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
}

.leader-chat-mission-status.status-completed {
  background: rgba(0, 240, 255, 0.14);
  color: var(--accent-primary, #00f0ff);
}

.leader-chat-mission-status.status-rejected,
.leader-chat-mission-status.status-expired {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
}

.leader-chat-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 240px;
  max-height: 38vh;
  max-height: 38dvh;
  overflow-y: auto;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(3, 7, 18, 0.62);
}

.leader-chat-empty {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 18px;
}

.leader-chat-empty-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
}

.leader-chat-empty-copy {
  max-width: 34ch;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--text-secondary, #94a3b8);
}

.leader-chat-system {
  align-self: center;
  max-width: 90%;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary, #94a3b8);
  font-size: 0.7rem;
  text-align: center;
}

.leader-chat-message {
  display: flex;
}

.leader-chat-message.role-player {
  justify-content: flex-end;
}

.leader-chat-message.role-leader {
  justify-content: flex-start;
}

.leader-chat-bubble {
  max-width: min(78%, 520px);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(17, 24, 39, 0.88);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

.leader-chat-message.role-player .leader-chat-bubble {
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.16), rgba(0, 240, 255, 0.08));
  border-color: rgba(0, 240, 255, 0.18);
}

.leader-chat-message.is-pending .leader-chat-bubble,
.leader-chat-message.is-thinking .leader-chat-bubble {
  opacity: 0.8;
}

.leader-chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.leader-chat-author {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary, #e2e8f0);
}

.leader-chat-time {
  font-size: 0.64rem;
  color: var(--text-dim, #64748b);
}

.leader-chat-text {
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-secondary, #dbe4ef);
}

.leader-chat-thinking {
  color: var(--accent-primary, #00f0ff);
}

.leader-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.leader-chat-pill {
  appearance: none;
  border: 1px solid rgba(0, 240, 255, 0.16);
  background: rgba(0, 240, 255, 0.08);
  color: var(--text-primary, #e2e8f0);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.leader-chat-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 240, 255, 0.3);
  background: rgba(0, 240, 255, 0.12);
}

.leader-chat-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(6, 10, 18, 0.8);
}

.leader-chat-input {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary, #e2e8f0);
  padding: 10px 12px;
  font: inherit;
  line-height: 1.5;
}

.leader-chat-input:focus {
  outline: none;
  border-color: rgba(0, 240, 255, 0.34);
  box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.12);
}

.leader-chat-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.leader-chat-compose-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.leader-chat-note {
  font-size: 0.68rem;
  color: var(--text-dim, #64748b);
}

.leader-chat-error {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(127, 29, 29, 0.3);
  color: #fecaca;
  font-size: 0.76rem;
}

@media (max-width: 700px) {
  .leader-detail-tabs {
    padding-left: var(--sp-3, 0.75rem);
    padding-right: var(--sp-3, 0.75rem);
  }

  .leader-chat-shell {
    padding-left: var(--sp-3, 0.75rem);
    padding-right: var(--sp-3, 0.75rem);
  }

  .leader-chat-bubble {
    max-width: 100%;
  }

  .leader-chat-compose-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ── Mercenary System ──────────────────────────────────────────── */

.merc-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(239, 68, 68, 0.2);
  padding-top: var(--sp-3, 0.75rem);
  margin-top: var(--sp-3, 0.75rem);
}

.merc-slots {
  color: #ef4444;
}

.merc-rotation-timer {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: var(--sp-2, 0.5rem);
  text-align: right;
}

.leader-card-mercenary .card-glow,
.leader-card-mercenary .card-border {
  --card-color: #ef4444 !important;
}

.leader-card-hourly {
  font-size: 0.7rem;
  color: #ef4444;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
}

.merc-cost-info {
  margin-top: 4px;
  padding: 4px 6px;
  background: rgba(239, 68, 68, 0.08);
  border-radius: 4px;
  font-size: 0.72rem;
}

.merc-cost-row {
  display: flex;
  align-items: center;
  gap: 3px;
  color: rgba(255, 255, 255, 0.7);
}

.merc-cost-row + .merc-cost-row {
  margin-top: 2px;
}

.leader-tag-merc-cost {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* ─── Tiered merc cards (T2-T4 with personal fleet) ───────────────── */
.leader-card-tier-locked {
  opacity: 0.78;
}
.leader-card-tier-locked .card-image {
  filter: grayscale(0.45) brightness(0.8);
}

/* Reuses .fleet-tpl-card-* layout from app.js but reskins
   from the default purple to merc red. */
.leader-card-mercenary-fleet .fleet-tpl-card-info {
  border-color: rgba(239, 68, 68, 0.3);
}
.leader-card-mercenary-fleet .fleet-tpl-card-info:hover {
  border-color: rgba(239, 68, 68, 0.65);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.2), inset 0 0 12px rgba(239, 68, 68, 0.05);
}
.leader-card-mercenary-fleet .fleet-tpl-leader-thumb {
  border-color: #ef4444;
}
.leader-card-mercenary-fleet .fleet-tpl-card-action {
  color: rgba(239, 68, 68, 0.85);
  border-top-color: rgba(239, 68, 68, 0.2);
}

/* Compact ship composition line under the stats row */
.merc-fleet-card-ships {
  font-size: 0.66rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

/* Tighten cost info inside merc cards (single line, no background panel) */
.leader-card-mercenary .merc-cost-info {
  margin-top: 4px;
  padding: 0;
  background: transparent;
  font-size: 0.7rem;
}
.leader-card-mercenary .merc-cost-info .merc-cost-row {
  color: rgba(255, 255, 255, 0.85);
}

/* Whole merc candidate card is clickable to open the detail modal */
.leader-card-mercenary {
  cursor: pointer;
}

/* Merc card brightness reflects real availability, not :hover (touch never
   hovers). Hireable = full brightness + cyan CTA; unavailable = dimmed with
   a reason and a disabled CTA. Overrides the shared .leader-card-candidate
   default-dim + hover-lift so hireable mercs never read as disabled. */
.leader-card-mercenary.merc-available,
.leader-card-mercenary.merc-available:hover {
  opacity: 1;
}
.leader-card-mercenary.merc-available .card-art img {
  opacity: 1;
  filter: none;
}
.leader-card-mercenary.merc-unavailable,
.leader-card-mercenary.merc-unavailable:hover {
  opacity: 0.62;
}
.leader-card-mercenary.merc-unavailable .card-art img {
  opacity: 0.5;
  filter: grayscale(0.55);
}
.merc-unavail-reason {
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #f87171;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Personal fleet list inside the merc candidate detail modal */
.merc-detail-fleet-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.merc-detail-fleet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 4px;
}
.merc-detail-fleet-row[data-ship-detail] {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.merc-detail-fleet-row[data-ship-detail]:hover {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(239, 68, 68, 0.45);
}
.merc-detail-fleet-thumb {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}
.merc-detail-fleet-name {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-primary);
}
.merc-detail-fleet-qty {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--cyan);
  font-weight: 600;
}

/* ─── Empty state: Command Academy recruitment wall ───────────────── */
.leaders-empty-wall {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 12px;
}
.leaders-empty-hero {
  position: relative;
  min-height: 320px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.22);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  isolation: isolate;
}
.leaders-empty-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(1.05);
  transform: scale(1.02);
  z-index: 0;
}
.leaders-empty-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 12, 22, 0.25) 0%, rgba(8, 12, 22, 0.55) 45%, rgba(8, 12, 22, 0.92) 100%),
    radial-gradient(120% 80% at 50% 100%, rgba(34, 211, 238, 0.18), transparent 60%);
  z-index: 1;
}
.leaders-empty-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 32px 28px 28px;
  max-width: 560px;
  margin-top: auto;
  height: 100%;
  min-height: 320px;
  justify-content: flex-end;
}
.leaders-empty-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(34, 211, 238, 0.85);
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid rgba(34, 211, 238, 0.4);
  border-radius: 2px;
  background: rgba(34, 211, 238, 0.08);
}
.leaders-empty-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-shadow: 0 2px 12px var(--scrim-60);
}
.leaders-empty-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(226, 232, 240, 0.85);
  max-width: 480px;
  text-shadow: 0 1px 6px var(--scrim-50);
}
.leaders-empty-cta {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #0b1420;
  background: linear-gradient(135deg, #22d3ee, #06b6d4);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 24px rgba(6, 182, 212, 0.35), 0 0 0 1px rgba(34, 211, 238, 0.6) inset;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}
.leaders-empty-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 14px 32px rgba(6, 182, 212, 0.5), 0 0 0 1px rgba(34, 211, 238, 0.85) inset;
}
.leaders-empty-cta:active { transform: translateY(0); }
.leaders-empty-cta-arrow {
  transition: transform 160ms ease;
}
.leaders-empty-cta:hover .leaders-empty-cta-arrow {
  transform: translateX(3px);
}

.leaders-empty-slots {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.leaders-empty-slots-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.7);
  text-align: center;
}
.leaders-empty-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.leaders-empty-slot {
  aspect-ratio: 3 / 4;
  border: 1.5px dashed rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.25);
  opacity: 0.65;
  transition: opacity 200ms ease, border-color 200ms ease;
}
.leaders-empty-slot:hover {
  opacity: 0.85;
  border-color: rgba(34, 211, 238, 0.35);
}
.leaders-empty-slot-icon {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 300;
  color: rgba(148, 163, 184, 0.4);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px dashed rgba(148, 163, 184, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.leaders-empty-slot-name {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(148, 163, 184, 0.55);
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .leaders-empty-hero { min-height: 260px; }
  .leaders-empty-hero-content { padding: 24px 20px 22px; min-height: 260px; }
  .leaders-empty-slot-icon { width: 48px; height: 48px; font-size: 28px; }
}

/* ══════════════════════════════════════════════════════════════
   Candidate Detail - Full Character Sheet
   ══════════════════════════════════════════════════════════════ */

.leader-detail-panel-candidate {
  max-width: 740px;
}

/* ── Sections inside overview tab ── */
.candidate-section {
  padding: 0 var(--sp-4, 1rem);
  margin-bottom: var(--sp-4, 1rem);
}
.candidate-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: var(--sp-2, 0.5rem);
}

/* ── Specialty perk card ── */
.candidate-perk-card {
  background: var(--surface-1, rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm, 6px);
  padding: var(--sp-3, 0.75rem);
}
.candidate-perk-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2, 0.5rem);
  margin-bottom: var(--sp-2, 0.5rem);
}
.candidate-perk-discount {
  font-size: 0.7rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245,158,11,0.12);
  padding: 2px 8px;
  border-radius: 4px;
}
.candidate-perk-desc {
  font-size: 0.78rem;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.5;
}

/* ── Rank progression ladder ── */
.candidate-rank-ladder {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.candidate-rank-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2, 0.5rem);
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--text-dim, #475569);
  transition: background 0.15s;
}
.candidate-rank-row.is-current {
  background: rgba(245,158,11,0.1);
  color: var(--text-primary, #e2e8f0);
  border: 1px solid rgba(245,158,11,0.25);
}
.candidate-rank-pips {
  width: 40px;
  flex-shrink: 0;
  text-align: center;
}
.candidate-rank-pips .leader-rank-pips {
  font-size: 0.7rem;
}
.candidate-rank-row.is-current .leader-rank-pips {
  color: #f59e0b;
}
.candidate-rank-name {
  flex: 1;
  font-weight: 600;
  min-width: 0;
}
.candidate-rank-levels {
  font-size: 0.65rem;
  color: var(--text-dim, #475569);
  white-space: nowrap;
}
.candidate-rank-row.is-current .candidate-rank-levels {
  color: var(--text-secondary, #94a3b8);
}
.candidate-rank-ships {
  font-size: 0.65rem;
  color: var(--text-dim, #475569);
  white-space: nowrap;
  min-width: 70px;
  text-align: right;
}
.candidate-rank-row.is-current .candidate-rank-ships {
  color: #f59e0b;
  font-weight: 600;
}

/* ── Info note ── */
.candidate-note {
  padding: var(--sp-2, 0.5rem) var(--sp-4, 1rem);
  font-size: 0.68rem;
  color: var(--text-dim, #475569);
  font-style: italic;
  border-top: 1px solid rgba(255,255,255,0.04);
  margin-top: var(--sp-2, 0.5rem);
}

/* ── Recruit button row ── */
.candidate-recruit-row {
  padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem) var(--sp-4, 1rem);
  text-align: center;
}

/* ── Discount badge on branch titles ── */
.candidate-branch-discount {
  font-size: 0.6rem;
  font-weight: 700;
  color: #f59e0b;
  margin-left: 4px;
}

@media (max-width: 600px) {
  .candidate-rank-ships { display: none; }
  .candidate-rank-levels { min-width: 60px; }
}

/* ─── Leaders Subtabs (Academy / Mercenaries) ────────────────────── */
.leaders-subtabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 12px;
  padding: 4px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
}
.leaders-subtab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: rgba(226, 232, 240, 0.64);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  /* Prevent iOS double-tap-to-zoom when switching ship class subtabs quickly. */
  touch-action: manipulation;
}
.leaders-subtab .icon { width: 16px; height: 16px; flex-shrink: 0; }
.leaders-subtab:hover { color: #fff; background: rgba(245, 158, 11, 0.1); }
.leaders-subtab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(245, 158, 11, 0.14));
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.3) inset, 0 4px 16px rgba(245, 158, 11, 0.15);
}
.leaders-subtab.active-merc {
  color: #fff;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(239, 68, 68, 0.14));
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3) inset, 0 4px 16px rgba(239, 68, 68, 0.15);
}
.leaders-subtab.active-merc:hover { background: linear-gradient(135deg, rgba(239, 68, 68, 0.28), rgba(239, 68, 68, 0.18)); }
.leaders-subtab.active-fleet {
  color: #fff;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.22), rgba(0, 240, 255, 0.12));
  border-color: rgba(0, 240, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.3) inset, 0 4px 16px rgba(0, 240, 255, 0.15);
}
.leaders-subtab.active-fleet:hover { background: linear-gradient(135deg, rgba(0, 240, 255, 0.28), rgba(0, 240, 255, 0.16)); }

.fleet-cmd-contract-list { display: flex; flex-direction: column; gap: 10px; }
.fleet-contract-card {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.18);
}
.fleet-contract-card.fleet-contract-active { border-color: rgba(56, 189, 248, 0.35); }
.fleet-contract-card.fleet-contract-used { opacity: 0.78; border-color: rgba(148, 163, 184, 0.25); }
.fleet-contract-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.fleet-contract-name { font-weight: 700; color: rgba(241, 245, 249, 0.95); }
.fleet-contract-status {
  font-size: 0.72em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(125, 211, 252, 0.9);
  font-weight: 700;
}
.fleet-contract-desc { font-size: 0.84em; line-height: 1.45; color: rgba(203, 213, 225, 0.82); }
.fleet-contract-meta { margin-top: 8px; font-size: 0.78em; color: rgba(226, 232, 240, 0.72); }
.fleet-contract-meta-label { color: rgba(148, 163, 184, 0.95); }

/* ─── Mercenary Locked Hero Wall ─────────────────────────────────── */
.merc-locked-wall { padding: 12px 0; }
.merc-locked-hero {
  position: relative;
  min-height: 280px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(239, 68, 68, 0.22);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  isolation: isolate;
}
.merc-locked-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(1.05);
  transform: scale(1.02);
  z-index: 0;
}
.merc-locked-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 12, 22, 0.25) 0%, rgba(8, 12, 22, 0.55) 45%, rgba(8, 12, 22, 0.92) 100%),
    radial-gradient(120% 80% at 50% 100%, rgba(239, 68, 68, 0.18), transparent 60%);
  z-index: 1;
}
.merc-locked-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 280px;
  padding: 24px;
}
.merc-locked-kicker {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(239, 68, 68, 0.85);
  margin-bottom: 6px;
}
.merc-locked-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
  line-height: 1.2;
}
.merc-locked-copy {
  font-size: 0.82rem;
  color: rgba(226, 232, 240, 0.8);
  line-height: 1.5;
  max-width: 420px;
  margin: 0 0 16px;
}
.merc-locked-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.35), 0 0 0 1px rgba(248, 113, 113, 0.6) inset;
  transition: filter 150ms ease;
}
.merc-locked-cta:hover { filter: brightness(1.1); }
.merc-locked-cta-arrow { transition: transform 150ms ease; }
.merc-locked-cta:hover .merc-locked-cta-arrow { transform: translateX(3px); }

/* ── Leaders hub: recruit access (Flotas > Líderes) ── */
.leaders-recruit-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: var(--sp-3, 0.75rem);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fbbf24;
  text-align: left;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: filter 150ms ease, border-color 150ms ease;
}
.leaders-recruit-cta:hover { filter: brightness(1.12); border-color: rgba(245, 158, 11, 0.7); }
.leaders-recruit-cta .icon { width: 20px; height: 20px; flex: none; color: #f59e0b; }
.leaders-recruit-cta-label { flex: 1 1 auto; }
.leaders-recruit-cta-go { flex: none; font-size: 1.2rem; line-height: 1; color: rgba(251, 191, 36, 0.7); }

/* ── Leaders ficha in the commander profile ── */
.leaders-profile-summary {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3, 0.75rem);
  padding: var(--sp-2, 0.5rem) 0;
}
.leaders-profile-stats {
  display: flex;
  gap: var(--sp-4, 1rem);
  flex-wrap: wrap;
}
.leaders-profile-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.leaders-profile-stat .lps-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  font-variant-numeric: tabular-nums;
}
.leaders-profile-stat .lps-lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim, #64748b);
}
.leaders-profile-faces {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.leaders-profile-face {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: var(--surface-1, rgba(255,255,255,0.03));
}
.leaders-profile-empty {
  font-size: 0.8rem;
  color: var(--text-secondary, #94a3b8);
}
.leaders-profile-manage {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fbbf24;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: filter 150ms ease, border-color 150ms ease;
}
.leaders-profile-manage:hover { filter: brightness(1.12); border-color: rgba(245, 158, 11, 0.7); }
.leaders-profile-manage-go { font-size: 1.1rem; line-height: 1; color: rgba(251, 191, 36, 0.7); }

/* ── Leader relocate (charter) ───────────────────────────────── */
.leader-tag-charter {
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
  animation: leader-charter-pulse 1.8s ease-in-out infinite;
}
@keyframes leader-charter-pulse {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}

.leader-relocate-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 3px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 150ms ease;
}
.leader-relocate-btn:hover { background: rgba(251, 191, 36, 0.3); }
.leader-relocate-btn svg { stroke: currentColor; }

.leader-relocate-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: var(--scrim-70);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4, 1rem);
}
.leader-relocate-modal {
  background: var(--surface-bg, #0f172a);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: var(--radius-lg, 12px);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--sp-4, 1rem);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.leader-relocate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.leader-relocate-header h3 {
  font-size: 1rem;
  color: #fbbf24;
  margin: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.leader-relocate-close {
  background: transparent;
  border: none;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  padding: 4px;
}
.leader-relocate-close:hover { color: #fff; }
.leader-relocate-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: var(--sp-3, 0.75rem);
}
.leader-relocate-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.leader-relocate-select {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.9rem;
  margin-bottom: var(--sp-3, 0.75rem);
}
.leader-relocate-tiers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: var(--sp-3, 0.75rem);
}
@media (min-width: 540px) {
  .leader-relocate-tiers { grid-template-columns: repeat(3, 1fr); }
}
.leader-relocate-tier {
  text-align: left;
  background: rgba(20, 26, 48, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  color: #e2e8f0;
  transition: border-color 120ms ease, background 120ms ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.leader-relocate-tier:hover { border-color: rgba(251, 191, 36, 0.4); }
.leader-relocate-tier.is-active {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}
.leader-relocate-tier.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.leader-relocate-tier-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.leader-relocate-tier-desc {
  font-size: 0.72rem;
  color: var(--text-secondary, #94a3b8);
}
.leader-relocate-tier-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  font-size: 0.78rem;
  color: #cbd5e1;
}
.leader-relocate-tier-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: #fbbf24;
}
.leader-relocate-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: var(--sp-2, 0.5rem);
}
.leader-relocate-balance {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary, #94a3b8);
}
.leader-relocate-confirm {
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  color: #0f172a;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter 120ms ease;
}
.leader-relocate-confirm:hover:not(:disabled) { filter: brightness(1.1); }
.leader-relocate-confirm:disabled {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-secondary, #94a3b8);
  cursor: not-allowed;
}
.leader-relocate-loading,
.leader-relocate-empty {
  text-align: center;
  padding: var(--sp-4, 1rem);
  color: var(--text-secondary, #94a3b8);
  font-size: 0.85rem;
}

/* ── Charter confirmed modal (above everything: detail 10000, relocate 10050) ─ */
.leader-charter-confirmed-overlay {
  position: fixed;
  inset: 0;
  z-index: 10100;
  background: var(--scrim-70);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4, 1rem);
  animation: leader-charter-confirmed-fade 180ms ease-out;
}
@keyframes leader-charter-confirmed-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.leader-charter-confirmed-modal {
  background: var(--surface-bg, #0f172a);
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: var(--radius-lg, 12px);
  max-width: 420px;
  width: 100%;
  padding: var(--sp-4, 1rem);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(251, 191, 36, 0.15);
  animation: leader-charter-confirmed-pop 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes leader-charter-confirmed-pop {
  from { transform: translateY(10px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.leader-charter-confirmed-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
  margin-bottom: var(--sp-2, 0.5rem);
}
.leader-charter-confirmed-title {
  color: #fbbf24;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 4px 0 8px;
}
.leader-charter-confirmed-body {
  color: var(--text-primary, #e2e8f0);
  font-size: 0.88rem;
  line-height: 1.4;
  margin: 0 0 var(--sp-3, 0.75rem);
}
.leader-charter-confirmed-ok {
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  color: #0f172a;
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  min-width: 120px;
  transition: filter 120ms ease;
}
.leader-charter-confirmed-ok:hover { filter: brightness(1.1); }

