.app-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
  background:
    radial-gradient(circle at 18% 0%, rgba(242, 185, 59, 0.08), transparent 42%),
    radial-gradient(circle at 85% 100%, rgba(217, 54, 62, 0.09), transparent 45%),
    var(--bg-abyss);
  overflow: hidden;
}

/* === Topbar === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(180deg, #21192E 0%, #161120 100%);
  border-bottom: 2px solid #3B2D4E;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  z-index: 20;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-crest {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(145deg, #D9363E, #7F1D1D);
  border: 2px solid var(--gold-brass);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.15;
  color: #FFF4DC;
  letter-spacing: 0.06em;
}

.brand-sub {
  display: inline-block;
  font-size: 11px;
  color: var(--gold-brass);
  font-weight: 700;
}

.topbar-metrics {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metric-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  background: rgba(14, 10, 22, 0.72);
  border: 1px solid #3A2E4D;
  border-radius: 99px;
}

.metric-pill .m-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 700;
}

.metric-pill .m-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-light);
}

.metric-pill .m-sub {
  font-size: 11px;
  color: #F4A261;
  padding-left: 4px;
  border-left: 1px solid #3D3152;
}

.metric-gold .m-val { color: var(--gold-brass); }
.metric-crystal .m-val { color: #FF7082; }
.metric-roster .m-val { color: #5CD6A0; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hdr-btn {
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid #4A3B60;
  background: #271E36;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}

.hdr-btn:hover {
  border-color: var(--gold-brass);
  background: #35284A;
  transform: translateY(-1px);
}

.hdr-btn.icon-only {
  width: 34px;
  padding: 6px 0;
  text-align: center;
}

/* === Main Stage === */
.stage-root {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.stage-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* === Toast === */
.toast-stack {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  z-index: 90;
  pointer-events: none;
  max-width: min(520px, 90vw);
}

.toast-item {
  padding: 8px 16px;
  border-radius: 99px;
  background: rgba(24, 17, 34, 0.94);
  border: 2px solid var(--gold-brass);
  color: #FFF7E4;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.2s ease-out;
}

.toast-item.danger { border-color: var(--stamp-red); color: #FFD6D9; }
.toast-item.good { border-color: var(--hire-green); color: #D4FFE8; }

/* === Modals === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 14, 0.78);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 100;
}

.modal-card {
  width: min(920px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #221A2E 0%, #171122 100%);
  border: 2px solid #594473;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
  padding: 20px 24px;
  color: var(--text-light);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #3C2F52;
  margin-bottom: 14px;
}

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gold-brass);
}

.btn-primary {
  padding: 10px 20px;
  border-radius: 10px;
  border: 2px solid #FFE29A;
  background: linear-gradient(180deg, #D9363E 0%, #9E1E26 100%);
  color: #FFF8EB;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(217, 54, 62, 0.35);
  transition: transform 0.12s, filter 0.12s;
}

.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }

.btn-green {
  padding: 10px 20px;
  border-radius: 10px;
  border: 2px solid #96F2C0;
  background: linear-gradient(180deg, #2EB872 0%, #1D7F4D 100%);
  color: #FFFDF7;
  font-size: 14px;
  font-weight: 800;
}

.btn-secondary {
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid #55456F;
  background: #2C213D;
  color: var(--text-light);
  font-size: 13px;
  font-weight: 700;
}

.btn-secondary:hover { border-color: var(--gold-brass); }

/* Compact adaptation for 1280x720 */
@media (max-height: 760px) {
  .app-shell { grid-template-rows: 46px minmax(0, 1fr); }
  .topbar { padding: 0 12px; }
  .brand-title { font-size: 16px; }
  .metric-pill { padding: 3px 9px; }
  .metric-pill .m-val { font-size: 13px; }
}
