* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  padding: 12px;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  padding: 18px;
}

h1 { color: #333; margin-bottom: 6px; font-size: 22px; }
h2 { color: #555; margin: 12px 0; font-size: 18px; }
h3 { color: #666; margin: 10px 0; font-size: 16px; }
h4 { color: #777; margin: 8px 0; font-size: 14px; }
h5 {
  color: #888; margin: 6px 0; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
p { color: #666; margin-bottom: 6px; font-size: 14px; }

.step { display: none; }
.step.active { display: block; }

/* Sticky actions bar */
.actions-bar {
  top: 0; z-index: 10; background: #fff;
  border-bottom: 1px solid #e9ecef; padding: 8px 0 6px; margin: -8px 0 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.left-actions, .right-actions { display: flex; align-items: center; gap: 6px; }

/* Two-column layout for instruments (Step 1) */
.instruments-grid { display: flex; gap: 16px; margin: 12px 0; }
.instruments-column { flex: 1; }
.instruments-column h4 {
  margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid #dee2e6;
}

.instrument-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0;
}
.instrument-row label { font-weight: 500; color: #444; font-size: 13px; }
.instrument-row input {
  width: 56px; padding: 4px 6px; border: 1px solid #ddd; border-radius: 4px;
  text-align: center; font-size: 13px;
}

.btn-primary, .btn-secondary {
  padding: 8px 14px; border: none; border-radius: 5px; font-size: 14px;
  cursor: pointer; margin: 0;
}
.btn-primary { background: #007bff; color: white; }
.btn-primary:hover { background: #0056b3; }
.btn-secondary { background: #007bff; color: white; }
.btn-secondary:hover { background: #0056b3; }

.hidden { display: none !important; }

#results-content { max-height: 70vh; overflow-y: auto; }

/* Assignment UI */
.assignment-container { background: #f8f9fa; border-radius: 6px; padding: 12px; }
.assignment-header { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #dee2e6; }
.part-info p { margin: 3px 0; font-size: 13px; }
.folder-options { margin: 10px 0; }

/* Keep side-by-side families (Woodwinds | Brass) */
.options-columns {
  display: flex; gap: 12px; margin-top: 8px;
}
.family-block {
  flex: 1; background: #fff; border: 1px solid #dee2e6; border-radius: 6px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.subcols {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.options-column { background: #fff; border: 1px dashed #e9ecef; border-radius: 6px; padding: 8px; }

.parts-list { max-height: 220px; overflow-y: auto; }
.part-option { padding: 4px 6px; margin: 2px 0; border-radius: 4px; transition: background-color 0.15s; }
.part-option:hover { background: #f1f3f5; }
.part-option.default-option { background: #e7f3ff; border: 1px solid #b3d9ff; }
.part-option label { display: flex; align-items: center; cursor: pointer; font-size: 13px; gap: 6px; }
.part-option input[type="checkbox"] { margin: 0; }
.default-label { font-size: 10px; color: #007bff; font-weight: 600; }

.apply-all-option {
  margin: 10px 0; padding: 8px; background: #fff3cd; border: 1px solid #ffeeba; border-radius: 4px;
}
.apply-all-option label { display: flex; align-items: center; cursor: pointer; font-weight: 500; font-size: 13px; gap: 8px; }
.apply-all-option input[type="checkbox"] { margin: 0; }

/* Book Distribution */
.summary-section {
  background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px;
  padding: 12px; margin-bottom: 12px;
}
.summary-section h3 { margin-bottom: 6px; }
.summary-section p { margin: 4px 0; font-weight: 500; }

.distribution-container { display: flex; flex-direction: column; gap: 10px; }
.folder-group { border: 1px solid #dee2e6; border-radius: 6px; overflow: hidden; }

.folder-header {
  background: #007bff; color: white; padding: 8px 10px; display: flex;
  justify-content: space-between; align-items: center;
}
.folder-title { font-weight: 600; font-size: 14px; }
.folder-musicians { font-size: 12px; opacity: 0.95; }

.pieces-list { padding: 8px 10px; background: #f8f9fa; }
.piece-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 5px 0; border-bottom: 1px solid #e9ecef;
}
.piece-item:last-child { border-bottom: none; }
.piece-name { font-weight: 500; color: #495057; font-size: 13px; }
.piece-file { font-size: 12px; color: #6c757d; font-style: italic; }

/* export row */
.export-row { justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* instructions */
.helper-text {
  max-width: 60rem;
  line-height: 1.4;
  margin: 0.75rem 0 1rem;
}

figure.example {
  margin: 0 0 1.25rem;
}

figure.example img {
  width: auto;
  height: auto;
  border-radius: 8px;
  display: block;
  border: 1px solid #e9ecef;
}

/* folder selection summary */
.piece-summary-box {
  max-width: 60rem;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 12px;
  margin: 10px 0 10px;
}

.piece-summary-title {
  margin: 0 0 8px;
}

.piece-summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.piece-summary-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #e9ecef;
}

.piece-summary-item:last-child {
  border-bottom: none;
}

.piece-summary-name {
  font-weight: 600;
  color: #495057;
  font-size: 13px;
}

.piece-summary-count {
  font-size: 13px;
  color: #6c757d;
  font-style: italic;
}

body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}

.modal {
  width: min(720px, 100%);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  padding: 18px;
}

.modal h2 {
  margin-bottom: 10px;
  font-size: 20px;
  color: #222;
}

.modal p {
  margin: 10px 0;
  line-height: 1.45;
  color: #444;
}

.modal-actions {
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.modal-footnote {
  margin-top: 12px;
  font-size: 12px;
  color: #777;
}