/* Quality Scorecard — shared styles (dashboard + self-report).
   Ported from QE Handbook prototype; selectors are wrapped with `.qs-root`
   so the bundle stays isolated from any host-app global styles. */

.qs-root,
.qs-root * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.qs-root {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  line-height: 1.6;
  color: #1a202c;
  background: #f7fafc;
  min-height: 100vh;
}

.qs-root .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.qs-root .header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 2rem 0;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.qs-root .logo {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #1a202c;
}

.qs-root .logo i {
  color: #3182ce;
}

.qs-root .subtitle {
  font-size: 1.1rem;
  color: #4a5568;
  font-weight: 400;
}

/* Main */
.qs-root .main {
  padding: 3rem 0;
}

/* Screen management */
.qs-root .screen {
  display: none;
}

.qs-root .screen.active {
  display: block;
}

/* Welcome card */
.qs-root .welcome-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 3rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  max-width: 900px;
  margin: 0 auto;
}

.qs-root .welcome-content h2 {
  font-size: 2rem;
  color: #1a202c;
  margin-bottom: 1rem;
  text-align: center;
}

.qs-root .intro-text {
  color: #4a5568;
  font-size: 1.1rem;
  margin-bottom: 2rem;
  text-align: center;
  line-height: 1.8;
}

.qs-root .info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.qs-root .info-card {
  background: #f7fafc;
  border-radius: 8px;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
}

.qs-root .info-card h3 {
  font-size: 1.2rem;
  color: #1a202c;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.qs-root .info-card h3 i {
  color: #3182ce;
}

.qs-root .info-card ul {
  list-style: none;
  padding: 0;
}

.qs-root .info-card ul li {
  padding: 0.5rem 0;
  color: #4a5568;
  padding-left: 1.5rem;
  position: relative;
}

.qs-root .info-card ul li::before {
  content: "•";
  color: #3182ce;
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* Maturity level pills */
.qs-root .maturity-levels {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.qs-root .level-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: #ffffff;
  border-radius: 6px;
  border-left: 4px solid;
}

.qs-root .level-item.level-1 { border-left-color: #e74c3c; }
.qs-root .level-item.level-2 { border-left-color: #e67e22; }
.qs-root .level-item.level-3 { border-left-color: #f1c40f; }
.qs-root .level-item.level-4 { border-left-color: #3498db; }
.qs-root .level-item.level-5 { border-left-color: #2ecc71; }

.qs-root .level-number {
  background: #3182ce;
  color: white;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.qs-root .level-item strong {
  display: block;
  color: #1a202c;
  font-size: 0.95rem;
}

.qs-root .level-item small {
  display: block;
  color: #718096;
  font-size: 0.85rem;
}

/* Team input section */
.qs-root .team-input-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.qs-root .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.qs-root .form-group label {
  font-weight: 600;
  color: #4a5568;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.qs-root .form-group label i {
  color: #3182ce;
}

.qs-root .form-group input,
.qs-root .form-group select {
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s;
  background: #ffffff;
  color: #1a202c;
}

.qs-root .form-group input:focus,
.qs-root .form-group select:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* Buttons */
.qs-root .btn-primary,
.qs-root .btn-secondary {
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.qs-root .btn-primary {
  background: #3182ce;
  color: white;
}

.qs-root .btn-primary:hover:not(:disabled) {
  background: #2c5aa0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
}

.qs-root .btn-primary:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
}

.qs-root .btn-secondary {
  background: #718096;
  color: white;
}

.qs-root .btn-secondary:hover:not(:disabled) {
  background: #5a6268;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(113, 128, 150, 0.3);
}

.qs-root .btn-secondary:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
}

.qs-root #start-self-report {
  width: 100%;
  justify-content: center;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  margin-top: 1rem;
}

/* Assessment / self-report card */
.qs-root .assessment-container {
  max-width: 900px;
  margin: 0 auto;
}

.qs-root .progress-header {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

.qs-root .progress-info {
  margin-bottom: 1rem;
}

.qs-root .progress-text {
  display: block;
  color: #4a5568;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.qs-root .progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.qs-root .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3182ce 0%, #2c5aa0 100%);
  transition: width 0.3s ease;
  width: 0%;
}

.qs-root .category-badge {
  display: inline-block;
  background: #3182ce;
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.qs-root .question-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

.qs-root .question-header {
  margin-bottom: 1.5rem;
}

.qs-root .question-header h3 {
  font-size: 1.3rem;
  color: #1a202c;
  line-height: 1.6;
}

.qs-root .question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: center;
}

/* Source badge (Auto / Self-Report / Hybrid) */
.qs-root .source-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.qs-root .source-badge.auto    { background: #ebf8ff; color: #2c5aa0; border: 1px solid #bee3f8; }
.qs-root .source-badge.self-report  { background: #fefcbf; color: #744210; border: 1px solid #f6e05e; }
.qs-root .source-badge.hybrid  { background: #faf5ff; color: #553c9a; border: 1px solid #d6bcfa; }

/* Answer options (TMMi radios) */
.qs-root .answers-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.qs-root .answer-option {
  padding: 1rem 1.5rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  background: #ffffff;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.qs-root .answer-option:hover {
  border-color: #3182ce;
  background: #f7fafc;
  transform: translateX(4px);
}

.qs-root .answer-option.selected {
  border-color: #3182ce;
  background: #ebf8ff;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.qs-root .answer-option input[type="radio"] {
  margin-top: 0.2rem;
  cursor: pointer;
}

.qs-root .answer-content {
  flex: 1;
}

.qs-root .answer-text {
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 0.25rem;
  display: block;
}

.qs-root .answer-description {
  color: #718096;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Evidence section */
.qs-root .evidence-section {
  background: #f7fafc;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  border: 1px dashed #cbd5e0;
  margin-bottom: 1.5rem;
}

.qs-root .evidence-section label {
  font-weight: 600;
  color: #4a5568;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.qs-root .evidence-section label i {
  color: #3182ce;
}

.qs-root .evidence-section input,
.qs-root .evidence-section textarea {
  width: 100%;
  padding: 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #ffffff;
  color: #1a202c;
}

.qs-root .evidence-section input:focus,
.qs-root .evidence-section textarea:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.qs-root .evidence-section textarea {
  min-height: 70px;
  resize: vertical;
}

.qs-root .evidence-hint {
  color: #718096;
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

.qs-root .navigation-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.qs-root .submit-error {
  background: #fff5f5;
  border: 1px solid #fc8181;
  border-left: 4px solid #e53e3e;
  color: #742a2a;
  padding: 0.85rem 1.1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem;
}

.qs-root .submit-error i {
  color: #e53e3e;
}

/* Result screen */
.qs-root .results-container {
  max-width: 900px;
  margin: 0 auto;
}

.qs-root .results-header {
  text-align: center;
  margin-bottom: 2rem;
}

.qs-root .results-header h2 {
  font-size: 2.5rem;
  color: #1a202c;
  margin-bottom: 0.5rem;
}

.qs-root .team-name-result {
  font-size: 1.2rem;
  color: #718096;
  font-weight: 500;
}

.qs-root .expiry-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  margin-bottom: 2rem;
  text-align: center;
}

.qs-root .expiry-card .expiry-date {
  font-size: 1.6rem;
  font-weight: 700;
  color: #2c5aa0;
  margin: 0.5rem 0;
}

.qs-root .expiry-card .expiry-note {
  color: #4a5568;
  font-size: 0.95rem;
}

.qs-root .self-report-summary {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  margin-bottom: 2rem;
}

.qs-root .self-report-summary h3 {
  font-size: 1.4rem;
  color: #1a202c;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.qs-root .self-report-summary h3 i {
  color: #3182ce;
}

.qs-root .summary-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid #edf2f7;
}

.qs-root .summary-row:last-child {
  border-bottom: none;
}

.qs-root .summary-row .summary-label {
  color: #4a5568;
  flex: 1;
}

.qs-root .summary-row .summary-value {
  font-weight: 600;
  color: #1a202c;
  text-align: right;
  white-space: nowrap;
}

.qs-root .summary-row .summary-score {
  background: #ebf8ff;
  color: #2c5aa0;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-block;
}

.qs-root .action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Expired banner */
.qs-root .expired-banner {
  background: #fffaf0;
  border: 1px solid #f6ad55;
  border-left: 4px solid #ed8936;
  color: #744210;
  padding: 0.9rem 1.2rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
}

.qs-root .expired-banner i {
  color: #ed8936;
}

/* Return + footer */
.qs-root .return-section {
  padding: 3rem 0;
  text-align: center;
}

.qs-root .return-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  background: #3182ce;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  border: 1px solid #3182ce;
}

.qs-root .return-link:hover {
  background: #2c5aa0;
  border-color: #2c5aa0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
}

.qs-root .footer {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 2rem 0;
  text-align: center;
  color: #718096;
  margin-top: 3rem;
}

/* Dashboard-specific (index.html) */

.qs-root .dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  margin-bottom: 1.5rem;
}

.qs-root .dashboard-toolbar .form-group {
  min-width: 280px;
  flex: 1 1 240px;
}

.qs-root .dashboard-toolbar .toolbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.qs-root .dashboard-toolbar .meta {
  flex: 1 1 100%;
  color: #718096;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.qs-root .overall-score-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.qs-root .score-circle { text-align: center; }

.qs-root .score-value {
  font-size: 3.5rem;
  font-weight: 700;
  color: #3182ce;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.qs-root .score-label {
  color: #718096;
  font-size: 1rem;
  font-weight: 500;
}

.qs-root .maturity-level-display { text-align: center; }

.qs-root .level-badge {
  display: inline-block;
  background: #3182ce;
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.qs-root .maturity-level-display h3 {
  font-size: 1.8rem;
  color: #1a202c;
  margin-bottom: 0.5rem;
}

.qs-root .maturity-level-display p {
  color: #718096;
  font-size: 1rem;
  max-width: 420px;
}

.qs-root .criteria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.qs-root .criterion-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.4rem 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  border-left: 4px solid #cbd5e0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.qs-root .criterion-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
}

.qs-root .criterion-card.score-1 { border-left-color: #e74c3c; }
.qs-root .criterion-card.score-2 { border-left-color: #e67e22; }
.qs-root .criterion-card.score-3 { border-left-color: #f1c40f; }
.qs-root .criterion-card.score-4 { border-left-color: #3498db; }
.qs-root .criterion-card.score-5 { border-left-color: #2ecc71; }
.qs-root .criterion-card.score-0 { border-left-color: #a0aec0; }

.qs-root .criterion-card .criterion-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.qs-root .criterion-card .criterion-name {
  font-weight: 600;
  color: #1a202c;
  font-size: 1rem;
  line-height: 1.4;
  flex: 1;
}

.qs-root .criterion-card .criterion-number {
  font-size: 0.8rem;
  color: #718096;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  display: block;
}

.qs-root .criterion-card .criterion-score {
  font-size: 1.8rem;
  font-weight: 700;
  color: #3182ce;
  line-height: 1;
  white-space: nowrap;
}

.qs-root .criterion-card .criterion-score small {
  font-size: 0.7rem;
  color: #718096;
  font-weight: 500;
  display: block;
  margin-top: 0.1rem;
}

.qs-root .criterion-card .criterion-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.qs-root .criterion-card .criterion-value {
  color: #4a5568;
  font-size: 0.9rem;
}

.qs-root .criterion-card .criterion-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.4rem;
  gap: 0.5rem;
}

.qs-root .criterion-card .criterion-updated {
  color: #a0aec0;
  font-size: 0.78rem;
}

.qs-root .criterion-card .criterion-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.qs-root .criterion-card .link-btn {
  font-size: 0.8rem;
  color: #3182ce;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid #bee3f8;
  background: #ebf8ff;
  padding: 0.25rem 0.65rem;
  border-radius: 12px;
}

.qs-root .criterion-card .link-btn:hover {
  background: #bee3f8;
  text-decoration: none;
}

.qs-root .dashboard-banner {
  background: #fffaf0;
  border: 1px solid #f6ad55;
  border-left: 4px solid #ed8936;
  color: #744210;
  padding: 0.9rem 1.2rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.qs-root .dashboard-banner .banner-msg {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.qs-root .dashboard-banner i { color: #ed8936; }

.qs-root .dashboard-banner a.btn-primary {
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
}

.qs-root .offline-banner {
  background: #fff5f5;
  border: 1px solid #fc8181;
  border-left: 4px solid #e53e3e;
  color: #742a2a;
  padding: 0.85rem 1.1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem;
}

.qs-root .offline-banner i {
  color: #e53e3e;
}

.qs-root .empty-state {
  background: #ffffff;
  border-radius: 12px;
  padding: 3rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  text-align: center;
  color: #718096;
}

.qs-root .empty-state i {
  color: #3182ce;
  font-size: 2rem;
  margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .qs-root .welcome-card {
    padding: 2rem 1.5rem;
  }

  .qs-root .info-grid {
    grid-template-columns: 1fr;
  }

  .qs-root .navigation-buttons {
    flex-direction: column;
  }

  .qs-root .navigation-buttons button {
    width: 100%;
    justify-content: center;
  }

  .qs-root .summary-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .qs-root .summary-row .summary-value {
    text-align: left;
  }

  .qs-root .overall-score-card {
    flex-direction: column;
    gap: 1.5rem;
  }

  .qs-root .dashboard-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .qs-root .criterion-card .criterion-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Team-confirmation checkbox on the Self-Report welcome screen */
.qs-root .form-confirm {
  margin-top: 1rem;
  margin-bottom: 1.25rem;
}
.qs-root .confirm-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  color: #4a5568;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}
.qs-root .confirm-row input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1rem;
  height: 1rem;
  accent-color: #3182ce;
  cursor: pointer;
}
