:root{
  --bg:#0b1220;
  --panel:#0f1a2e;
  --text:#e8eefc;
  --muted:#a9b7d4;
  --primary:#4f8cff;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1000px 600px at 20% 0%, #101c35 0%, var(--bg) 55%);
  color:var(--text);
}

.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 18px;
  background: rgba(10, 18, 34, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand{ display:flex; gap:12px; align-items:center; }
.logo{
  width:44px; height:44px; border-radius:12px;
  display:grid; place-items:center;
  background: linear-gradient(145deg, rgba(79,140,255,0.25), rgba(79,140,255,0.05));
  border:1px solid rgba(79,140,255,0.35);
  font-weight:700;
}

h1{ margin:0; font-size:16px; }
.sub{ margin:2px 0 0; color:var(--muted); font-size:12px; }

.top-actions{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }

.layout{
  display:grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap:16px;
  padding:16px;
  max-width: 1300px;
  margin:0 auto;
}

.panel{
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border:1px solid rgba(255,255,255,0.06);
  border-radius:16px;
  padding:16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

.panel h2{ margin:0 0 12px; font-size:15px; }

hr{
  border:none;
  border-top:1px solid rgba(255,255,255,0.08);
  margin:14px 0;
}

.grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:12px;
}
.grid.two{ grid-template-columns: 1fr 1fr; }

.row{ display:flex; gap:12px; margin-top:12px; }
.grow{ flex:1; }

.field label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin:0 0 6px;
}

.field input, .field select, .field textarea{
  width:100%;
  background: rgba(10, 18, 34, 0.55);
  color: var(--text);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:12px;
  padding:10px 10px;
  outline:none;
}
.field textarea{ resize: vertical; min-height: 120px; }

.field input:focus, .field select:focus, .field textarea:focus{
  border-color: rgba(79,140,255,0.45);
  box-shadow: 0 0 0 3px rgba(79,140,255,0.10);
}

.hint{ margin-top:6px; font-size:12px; color: var(--muted); }
.tiny{ margin:10px 0 0; font-size:12px; color: var(--muted); }

.btn{
  border:none;
  border-radius:12px;
  padding:10px 12px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  cursor:pointer;
  transition: transform .05s ease, background .2s ease;
}
.btn:hover{ background: rgba(255,255,255,0.12); }
.btn:active{ transform: translateY(1px); }

.btn.primary{
  background: rgba(79,140,255,0.95);
  color: #061023;
}
.btn.primary:hover{ background: rgba(79,140,255,1); }

.btn.ghost{
  background: transparent;
  border: 1px solid rgba(255,255,255,0.14);
}
.btn.ghost:hover{ background: rgba(255,255,255,0.06); }

.exports{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top: 14px;
}

.preview{
  position:sticky;
  top: 88px;
  height: fit-content;
}

.preview-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 12px;
}

.badge{
  font-size:12px;
  color: var(--muted);
  border:1px solid rgba(255,255,255,0.12);
  padding:6px 10px;
  border-radius:999px;
}

.handoff{
  background: rgba(10, 18, 34, 0.55);
  border:1px solid rgba(255,255,255,0.10);
  border-radius:14px;
  padding:14px;
  min-height: 520px;
}

.empty{ color: var(--muted); font-size:13px; padding: 10px; }

.handoff .title{
  font-size:16px;
  font-weight:700;
  margin-bottom: 10px;
}

.handoff .meta{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  padding:10px;
  border-radius:12px;
  background: rgba(255,255,255,0.04);
  border:1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.handoff .section{
  margin-top: 12px;
  padding-top: 12px;
  border-top:1px solid rgba(255,255,255,0.08);
}
.handoff .section h3{
  margin:0 0 8px;
  font-size:13px;
}
.handoff .section .content{
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.35;
}
.handoff .section .content.muted{ color: var(--muted); }

/* clickable links in preview */
.handoff a{
  color: var(--primary);
  text-decoration: underline;
  word-break: break-word;
}
.handoff a:hover{
  text-decoration: none;
}

/* Unified Staffing input block */
.staffing-wrapper {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255,255,255,0.03);
  margin-bottom: 16px;
}
.staff-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.floaters-block { margin-top: 14px; }

/* --- Compact staffing in the HANDOFF PREVIEW (this is the fix) --- */
.staffing-preview-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px; /* tight */
  margin-top: 6px;
}

.staffing-preview-item{
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

.staffing-preview-label{
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.staffing-preview-body{
  font-size: 12px;
  line-height: 1.25;  /* tighter */
  white-space: pre-wrap;
}

.staffing-preview-body.muted{
  color: var(--muted);
}

/* make Floaters span full width in preview */
.staffing-preview-item.full{
  grid-column: 1 / -1;
}

.advanced{ margin-top: 12px; color: var(--muted); }
.advanced summary{ cursor:pointer; }
.adv-grid{
  margin-top: 10px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.footer{
  max-width: 1300px;
  margin: 0 auto;
  padding: 10px 16px 18px;
  color: var(--muted);
  font-size: 12px;
}

@media print{
  body{ background: #fff; color:#000; }
  .topbar, .panel:not(.preview), .footer, details{ display:none !important; }
  .layout{ display:block; padding:0; }
  .panel.preview{
    position: static;
    border:none;
    box-shadow:none;
    background:#fff;
    padding:0;
  }
  .handoff{
    border:none;
    background:#fff;
    padding:0;
    min-height:auto;
  }
  .handoff .meta{
    border:1px solid #ddd;
    background:#f7f7f7;
    color:#333;
  }
  .handoff .section{ border-top:1px solid #ddd; }
}
@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .preview{ position:static; }
  .grid{ grid-template-columns: 1fr; }
  .grid.two{ grid-template-columns: 1fr; }
  .staff-grid{ grid-template-columns: 1fr; }
  .staffing-preview-grid{ grid-template-columns: 1fr; }
}