/* ============================================================
   Cheat-sheet page — A4 landscape print-friendly single-page summary
   ============================================================ */

.cs-body {
  margin: 0;
  background: #ECEEF2;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
}

/* ============================================================
   Top toolbar (screen only)
   ============================================================ */
.cs-toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.cs-toolbar-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-800);
  text-decoration: none;
  background: var(--blue-50);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}
.cs-toolbar-home:hover { background: var(--blue-100); }
.cs-toolbar-role-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-muted);
  padding: 4px;
  border-radius: var(--radius-md);
}
.cs-role-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.cs-role-tab:hover { background: #fff; color: var(--blue-800); }
.cs-role-tab.is-active { background: var(--blue-700); color: #fff; }

.cs-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cs-toolbar-print {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--blue-700);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}
.cs-toolbar-print:hover { background: var(--blue-900); }
.cs-toolbar-print i { font-size: 16px; }

/* ============================================================
   The A4 sheet (landscape: 297mm × 210mm)
   ============================================================ */
.cs-page {
  padding: 24px 16px 64px;
  display: flex;
  justify-content: center;
}
.cs-sheet {
  background: #fff;
  width: 297mm;
  min-height: 210mm;
  box-shadow: 0 8px 32px rgba(0,0,0,0.10);
  padding: 10mm 12mm;
  display: flex;
  flex-direction: column;
  gap: 6mm;
  box-sizing: border-box;
  /* Slight zoom-down so it fits typical screens better */
}
/* On smaller screens, allow the sheet to scale */
@media (max-width: 1200px) {
  .cs-sheet { width: 100%; min-width: 0; padding: 6mm 6mm; }
}

/* Header strip */
.cs-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--blue-700);
}
.cs-header-left { line-height: 1.25; }
.cs-eyebrow {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blue-600);
}
.cs-role-name {
  font-size: 24px;
  font-weight: 800;
  color: var(--blue-900);
  margin: 2px 0 1px;
  letter-spacing: -0.01em;
}
.cs-tagline {
  font-size: 11px;
  font-style: italic;
  color: var(--text-secondary);
}
.cs-header-right { text-align: right; font-size: 9.5px; color: var(--text-tertiary); }
.cs-version {
  display: inline-block;
  padding: 1px 8px;
  background: var(--blue-50);
  color: var(--blue-700);
  font-weight: 700;
  border-radius: 99px;
  letter-spacing: 0.05em;
}
.cs-print-hint { margin-top: 4px; }

/* Progression ladder */
.cs-ladder {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.cs-ladder-cell {
  padding: 5px 8px;
  border-radius: 4px;
  text-align: center;
  line-height: 1.2;
}
.cs-ladder-cell.cs-lvl-1 { background: #F1EFE8; color: #2C2C2A; }
.cs-ladder-cell.cs-lvl-2 { background: #E6F1FB; color: #042C53; }
.cs-ladder-cell.cs-lvl-3 { background: #E1F5EE; color: #04342C; border: 2px solid #1D9E75; padding: 3px 8px; }
.cs-ladder-cell.cs-lvl-4 { background: #FAEEDA; color: #412402; }
.cs-ladder-cell.cs-lvl-5 { background: #EEEDFE; color: #26215C; }
.cs-ladder-cell .cs-ladder-name {
  font-size: 10.5px;
  font-weight: 700;
}
.cs-ladder-cell .cs-ladder-time {
  font-size: 9px;
  font-weight: 600;
  opacity: 0.75;
  margin-top: 1px;
}
.cs-hire-bar-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 5px;
  background: #fff;
  color: #1D9E75;
  border-radius: 99px;
  margin-left: 4px;
  letter-spacing: 0.05em;
}

/* Competency grid */
.cs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4mm;
  flex: 1;
}
/* For roles with 9 comps (PM), it's 3×3. For 8 comps (BA/QA/SE), it's 3×3 with one slot empty,
   or 4×2. We dynamically pick at JS time. Default to 3 cols. */
.cs-grid.cs-cols-4 { grid-template-columns: repeat(4, 1fr); }
.cs-grid.cs-cols-3 { grid-template-columns: repeat(3, 1fr); }

.cs-comp {
  background: #fff;
  border: 1px solid #DDE4EE;
  border-radius: 4px;
  padding: 6px 9px 7px;
  display: flex;
  flex-direction: column;
}
.cs-comp-head {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-bottom: 3px;
  border-bottom: 1px dashed #DDE4EE;
  margin-bottom: 3px;
}
.cs-comp-head .ti {
  font-size: 14px;
  color: var(--blue-700);
}
.cs-comp-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue-900);
}
.cs-comp-rungs {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--text-primary);
}
.cs-comp-rung {
  padding: 1px 4px;
  border-radius: 3px;
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.cs-comp-rung-lbl {
  font-weight: 800;
  flex-shrink: 0;
  min-width: 14px;
}
.cs-comp-rung-text { flex: 1; }
.cs-comp-rung.cs-rung-1 .cs-comp-rung-lbl { color: #5F5E5A; }
.cs-comp-rung.cs-rung-2 .cs-comp-rung-lbl { color: #185FA5; }
.cs-comp-rung.cs-rung-3 {
  background: #E1F5EE;
  color: #04342C;
}
.cs-comp-rung.cs-rung-3 .cs-comp-rung-lbl { color: #0F6E56; }
.cs-comp-rung.cs-rung-3::before {
  content: "★";
  color: #1D9E75;
  font-size: 9px;
  font-weight: 800;
  margin-right: 2px;
}
.cs-comp-rung.cs-rung-4 .cs-comp-rung-lbl { color: #854F0B; }
.cs-comp-rung.cs-rung-5 .cs-comp-rung-lbl { color: #3C3489; }

/* Anti-signals strip */
.cs-anti {
  background: #FCEBEB;
  border: 1px solid #F09595;
  border-radius: 4px;
  padding: 6px 10px 7px;
}
.cs-anti-head {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}
.cs-anti-head .ti {
  font-size: 12px;
  color: #791F1F;
}
.cs-anti-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #791F1F;
}
.cs-anti-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px 10px;
  font-size: 9.5px;
  line-height: 1.4;
  color: #791F1F;
}
.cs-anti-item::before {
  content: "·";
  font-weight: 800;
  margin-right: 4px;
}

/* Footer */
.cs-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid #DDE4EE;
  font-size: 9.5px;
  color: var(--text-secondary);
}
.cs-source { color: var(--text-tertiary); }

/* ============================================================
   Print rules — fits perfectly on A4 landscape
   ============================================================ */
@media print {
  .no-print { display: none !important; }
  @page {
    size: A4 landscape;
    margin: 0;
  }
  body { background: #fff; }
  .cs-page { padding: 0; }
  .cs-sheet {
    box-shadow: none;
    width: 297mm;
    min-height: 210mm;
    padding: 8mm 10mm;
    page-break-after: avoid;
    page-break-inside: avoid;
  }
  /* Force backgrounds to print */
  * {
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
