/* ===================================
   CSS Variables
   =================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* District Maroon & Gold Theme (Cañon City Schools), flat Google-style accents */
  --color-primary: #8c2846;
  /* Cañon City maroon, lightened for UI */
  --color-primary-dark: #461025;
  /* True logo maroon */
  --color-secondary: #b5872a;
  /* Cañon City gold, darkened for AA contrast */
  --color-success: #1e8e3e;
  /* Google green 600 */
  --color-warning: #f9ab00;
  /* Google yellow 600 */
  --color-error: #d93025;
  /* Google red 600 */

  --color-bg: #f9fafb;
  /* Gray 50 (Warmer) */
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  /* Slate 200 */
  --color-text: #0f172a;
  /* Slate 900 */
  --color-text-muted: #64748b;
  /* Slate 500 */

  /* Rating colors - flat, Google-inspired */
  --rating-green: #1e8e3e;
  /* Google green 600 */
  --rating-blue: #1a73e8;
  /* Google blue 600 */
  --rating-orange: #f9ab00;
  /* Google yellow 600 */
  --rating-red: #d93025;
  /* Google red 600 */

  --rating-green-bg: #ecfdf5;
  /* Emerald 50 */
  --rating-blue-bg: #eff6ff;
  /* Blue 50 */
  --rating-orange-bg: #fffbeb;
  /* Amber 50 */
  --rating-red-bg: #fef2f2;
  /* Red 50 */

  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   Base Styles
   =================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===================================
   Typography
   =================================== */
h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-sm);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--spacing-md);
  color: var(--color-primary-dark);
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
}

p {
  margin-bottom: var(--spacing-md);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

strong {
  font-weight: 600;
}

/* ===================================
   Header
   =================================== */
.app-header {
  background: var(--color-primary-dark);
  color: white;
  padding: var(--spacing-xl) var(--spacing-lg);
  text-align: center;
  box-shadow: var(--shadow-md);
}

.app-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  gap: var(--spacing-md);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  text-align: left;
}

.header-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 50%;
  background-color: #ffffff;
  padding: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.header-titles {
  display: flex;
  flex-direction: column;
}

.app-header h1 {
  color: white;
  margin-bottom: 2px;
}

.subtitle {
  font-size: 1.125rem;
  opacity: 0.95;
  margin-bottom: 0;
}

.header-links {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
}

.header-links a {
  color: white;
  padding: var(--spacing-xs) var(--spacing-md);
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  transition: var(--transition);
}

.header-links a:hover {
  background: rgba(255, 255, 255, 0.3);
  text-decoration: none;
}

/* ===================================
   Layout
   =================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-md);
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  position: relative;
}

.step-description {
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-lg);
}

/* ===================================
   Forms
   =================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--color-text);
}

input[type="number"],
input[type="text"],
select {
  height: 44px;
  /* Enforce strict height */
  line-height: normal;
  /* Reset line height */
  padding: 0 var(--spacing-md);
  /* Vertical padding handled by height/flex */
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  min-height: 44px;
  transition: var(--transition);
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  /* Subtle inner depth */
}

textarea.msl-desc {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  transition: var(--transition);
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  color: var(--color-text);
}

textarea.msl-desc:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(140, 40, 70, 0.15);
}

textarea.msl-desc::placeholder {
  color: var(--color-text-muted);
  opacity: 0.7;
  font-style: italic;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(140, 40, 70, 0.15);
}

input[type="number"]::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

select {
  cursor: pointer;
}

select option[value=""] {
  color: var(--color-text-muted);
}

/* ===================================
   Grids
   =================================== */
.weights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.elements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

/* ===================================
   Validation
   =================================== */
.validation-summary {
  background: var(--color-bg);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-top: var(--spacing-lg);
}

.validation-error {
  color: var(--color-error);
  font-weight: 500;
  margin-top: var(--spacing-xs);
}

.validation-success {
  color: var(--color-success);
  font-weight: 500;
  margin-top: var(--spacing-xs);
}

.validation-info {
  color: var(--color-text-muted);
  font-weight: 500;
  margin-top: var(--spacing-xs);
}

/* Input validation states */
input[type="number"].invalid {
  border-color: var(--color-error);
  background-color: #fef2f2;
}

input[type="number"].valid {
  border-color: var(--color-success);
  background-color: #f0fdf4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23059669'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  flex-wrap: wrap;
}

.btn-small {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.875rem;
  min-height: 36px;
}

/* ===================================
   Standards & Elements
   =================================== */
.standard-section {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  transition: var(--transition);
}

.standard-section:hover {
  border-color: var(--color-primary);
}

.standard-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
}

/* ===================================
   Overall Summary
   =================================== */
.overall-summary {
  position: relative;
  background: #f3e9ed;
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  margin-top: var(--spacing-xl);
  min-height: 200px;
}

/* Summary Card at Top */
.summary-card {
  position: relative;
  z-index: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  transition: padding 0.3s ease, margin 0.3s ease, box-shadow 0.3s ease;
}

.summary-card.collapsed {
  padding: var(--spacing-sm) var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.summary-card h2 {
  color: var(--color-primary-dark);
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-xs);
  transition: all 0.3s ease;
}

.summary-card.collapsed h2 {
  font-size: 0.875rem;
  margin-bottom: 0;
  display: inline-block;
  margin-right: var(--spacing-md);
}

.summary-card .summary-description {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: var(--spacing-lg);
  transition: opacity 0.2s ease, max-height 0.3s ease;
}

.summary-card.collapsed .summary-description {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0;
}

.summary-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  transition: gap 0.3s ease;
}

.summary-card.collapsed .summary-content {
  gap: var(--spacing-sm);
}

.summary-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  transition: margin 0.3s ease;
}

.summary-card.collapsed .summary-stats-row {
  margin-bottom: 0;
  gap: var(--spacing-sm);
  grid-template-columns: auto auto;
  justify-content: center;
}

.summary-stat {
  text-align: center;
  padding: 1.25rem 1rem;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, padding 0.3s ease;
}

.summary-stat:hover {
  border-color: #cbd5e1;
}

.summary-card.collapsed .summary-stat {
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
}

/* RANDA Hero Stat Card — district gold accent */
.summary-stat.summary-stat-randa {
  background: #fbf3d9 !important;
  border: 2px solid #b5872a !important;
}

.summary-stat.summary-stat-randa .summary-label {
  color: #8a6a14 !important;
}

.summary-stat.summary-stat-randa .summary-value-randa {
  color: #6b5010 !important;
  font-size: 3.25rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em;
}

.summary-stat.summary-stat-randa .summary-subtext {
  color: #8a6a14 !important;
  font-weight: 600;
}

.summary-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-xs);
  transition: all 0.3s ease;
}

.summary-card.collapsed .summary-label {
  font-size: 0.625rem;
  margin-bottom: 1px;
}

.summary-value {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-primary);
  margin: var(--spacing-xs) 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  transition: all 0.3s ease;
}

.summary-card.collapsed .summary-value {
  font-size: 1.125rem;
  margin: 1px 0;
}

/* Rating Pill in Summary */
.summary-stat #summary-rating.summary-value {
  font-size: 1.15rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 1.1rem;
  border-radius: 9999px;
  min-height: 42px;
  margin: 0.35rem 0;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
  max-width: 90%;
}

.summary-stat #summary-rating.rating-more-than-expected,
.summary-stat #summary-rating.rating-highly-effective,
.summary-stat #summary-rating.rating-exemplary {
  background-color: var(--rating-blue-bg);
  color: #1e40af;
  border-color: #bfdbfe;
}

.summary-stat #summary-rating.rating-expected,
.summary-stat #summary-rating.rating-effective,
.summary-stat #summary-rating.rating-accomplished,
.summary-stat #summary-rating.rating-proficient {
  background-color: var(--rating-green-bg);
  color: #065f46;
  border-color: #a7f3d0;
}

.summary-stat #summary-rating.rating-partially-effective,
.summary-stat #summary-rating.rating-partially-proficient {
  background-color: var(--rating-orange-bg);
  color: #92400e;
  border-color: #fde68a;
}

.summary-stat #summary-rating.rating-less-than-expected,
.summary-stat #summary-rating.rating-ineffective,
.summary-stat #summary-rating.rating-basic {
  background-color: var(--rating-orange-bg);
  color: #92400e;
  border-color: #fde68a;
}

.summary-subtext {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-top: var(--spacing-xs);
  transition: all 0.3s ease;
}

.summary-card.collapsed .summary-subtext {
  font-size: 0.625rem;
  margin-top: 2px;
}

/* Range Continuum Bar (Yellow - Green - Blue Palette) */
.summary-range-bar {
  display: flex;
  width: 100%;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.04), 0 2px 6px -1px rgba(0, 0, 0, 0.05);
  position: relative;
  transition: height 0.3s ease;
}

.summary-card.collapsed .summary-range-bar {
  height: 28px;
}

.summary-range-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem;
  transition: all 0.2s ease;
  position: relative;
}

.summary-range-segment:not(:last-child) {
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.summary-range-segment:hover {
  filter: brightness(0.97);
  z-index: 1;
}

/* 1. Less Than Expected: Yellow/Amber */
.summary-range-ineffective {
  width: 18.8%;
  background: #fef3c7;
}

/* 2. Expected: Green/Emerald */
.summary-range-partially-effective {
  width: 21.9%;
  background: #d1fae5;
}

.summary-range-effective {
  width: 39.4%;
  background: #d1fae5;
}

/* 3. More Than Expected: Blue/Sky */
.summary-range-highly-effective {
  width: 20%;
  background: #dbeafe;
}

.summary-range-label {
  font-weight: 700;
  font-size: 0.78rem;
  color: #1e293b;
  text-align: center;
  line-height: 1.2;
  transition: font-size 0.3s ease;
}

.summary-card.collapsed .summary-range-label {
  font-size: 0.625rem;
}

.summary-range-values {
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  margin-top: 1px;
}

.summary-marker-container {
  position: relative;
  height: 18px;
  margin-top: 4px;
  transition: all 0.3s ease;
}

.summary-card.collapsed .summary-marker-container {
  height: 12px;
  margin-top: 2px;
}

.summary-score-marker {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  transition: left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

.summary-marker-arrow {
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 12px solid var(--color-primary);
  border-top: none;
  margin: 0 auto;
  filter: drop-shadow(0 2px 4px rgba(140, 40, 70, 0.35));
  transition: all 0.3s ease;
}

.summary-card.collapsed .summary-marker-arrow {
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid var(--color-primary);
}

.overall-summary.disabled {
  opacity: 0.6;
}

.overall-summary h3 {
  color: var(--color-primary-dark);
  margin-bottom: var(--spacing-md);
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--spacing-md);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.stat .label {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.stat .value {
  font-size: 1.125rem;
}

.stat.highlight {
  background: white;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.stat.highlight .value.rating {
  color: var(--color-primary);
  font-size: 1.25rem;
}

/* ===================================
   MSL Measures
   =================================== */
.msl-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.msl-measure-row {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease;
}

.msl-measure-row.visible {
  opacity: 1;
  max-height: 1200px;
  /* Increased for more fields */
}

.msl-measure-number {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--spacing-sm);
}

.msl-inputs {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  gap: var(--spacing-md);
  align-items: end;
}

/* Measure Fields Grid (Simple Method) */
.measure-fields {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.field-weight {
  border-left: 4px solid var(--color-primary);
  background: var(--rating-blue-bg);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
}

.field-weight label {
  color: var(--color-primary-dark);
  font-size: 0.85rem;
  font-weight: 600;
}

.field-range {
  border-left: 4px solid var(--color-text-muted);
  background: #f1f5f9;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
}

.field-range label {
  font-size: 0.85rem;
  font-weight: 600;
}

.field-actual {
  border-left: 4px solid var(--color-warning);
  background: var(--rating-orange-bg);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
}

.field-actual label {
  color: #92400e; /* Amber 800 */
  font-weight: 700;
  font-size: 0.85rem;
}

.field-actual input {
  border-color: var(--color-warning) !important;
  font-weight: 600;
}

/* Auto-Derived Outputs Ribbon */
.measure-auto-ribbon {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
  flex-wrap: wrap;
}

.auto-ribbon-pill {
  flex: 1;
  min-width: 210px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 0.6rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auto-ribbon-pill-min {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.auto-ribbon-pill-score300 {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  flex: 1.5;
  min-width: 280px;
}

.auto-ribbon-pill-contrib {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  flex: 1.15;
  min-width: 230px;
}

.auto-ribbon-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.auto-ribbon-label {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.auto-ribbon-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

.auto-ribbon-value-primary {
  color: #15803d;
  font-size: 1.2rem;
  font-weight: 800;
}

.auto-ribbon-value-contrib {
  color: #1d4ed8;
  font-size: 1.12rem;
  font-weight: 800;
}

.score-with-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.score-contrib-parenthetical {
  font-size: 0.78rem;
  font-weight: 500;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(37, 99, 235, 0.07);
  border: 1px solid rgba(59, 130, 246, 0.22);
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 2px;
}

.score-contrib-parenthetical strong {
  color: #1d4ed8;
  font-weight: 700;
}

.measure-rating-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.2;
}

.measure-rating-badge.badge-rating-expected {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.measure-rating-badge.badge-rating-more-than-expected {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.measure-rating-badge.badge-rating-less-than-expected {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.auto-ribbon-subtext {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-left: auto;
}

.auto-badge {
  display: inline-flex;
  align-items: center;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.2;
}

.auto-badge-primary {
  background: #16a34a;
  color: #ffffff;
}

.feedback-highlight-score {
  font-weight: 700;
  color: #166534;
  background: #dcfce7;
  padding: 1px 6px;
  border-radius: 4px;
}

.feedback-highlight-contrib {
  font-weight: 700;
  color: #1e40af;
  background: #eff6ff;
  padding: 1px 6px;
  border-radius: 4px;
}

/* MSL Simple Enhancements */
.ipr-row {
  background: #f8fafc;
  border-left: 6px solid var(--color-primary);
  border-radius: var(--radius-lg);
}

.ipr-row .measure-fields {
  grid-template-columns: repeat(2, 1fr);
}

/* Weight Allocation Budget Meter */
.weight-meter-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md) var(--spacing-lg);
  margin-top: var(--spacing-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.weight-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.weight-meter-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.weight-meter-title {
  font-weight: 700;
  color: var(--color-text);
  font-size: 0.95rem;
}

.weight-meter-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.weight-meter-badge.badge-incomplete {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.weight-meter-badge.badge-complete {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.weight-meter-badge.badge-over {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.weight-meter-status {
  font-size: 0.85rem;
  font-weight: 600;
}

.weight-meter-track {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.weight-meter-fill {
  height: 100%;
  border-radius: var(--radius-md);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.35s ease;
  background: var(--color-primary);
}

.weight-meter-fill.fill-progress {
  background: var(--color-primary);
}

.weight-meter-fill.fill-complete {
  background: var(--color-success);
}

.weight-meter-fill.fill-over {
  background: var(--color-error);
}

.ipr-badge {
  background: var(--color-primary);
  color: white;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: var(--spacing-sm);
}

.measure-visual-feedback {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.measure-range-bar-container {
  position: relative;
  height: 24px;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  overflow: visible;
  margin: 1.5rem 0 2rem;
}

.measure-range-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(to right, var(--rating-red) 0%, var(--rating-orange) 40%, var(--rating-blue) 70%, var(--rating-green) 100%);
  opacity: 0.2;
  border-radius: var(--radius-md);
}

.measure-range-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: var(--color-primary);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(140, 40, 70, 0.4);
  transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

.measure-range-label-min,
.measure-range-label-max {
  position: absolute;
  bottom: -20px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.measure-range-label-min { left: 0; }
.measure-range-label-max { right: 0; }

/* Status Checklist */
.status-checklist {
  list-style: none;
  padding: 0;
  margin: var(--spacing-md) 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  transition: var(--transition);
}

.status-item.complete {
  color: var(--color-success);
}

.status-item.incomplete {
  color: var(--color-warning);
}

.status-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-border);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.status-item.complete .status-icon {
  background: var(--color-success);
  color: white;
}

.status-item.incomplete .status-icon {
  background: var(--color-warning);
  color: white;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.4s ease-out forwards;
}

@media (max-width: 900px) {
  .measure-fields {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .measure-fields {
    grid-template-columns: 1fr;
  }
}

/* About Modal Two-Column Grid */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-xl);
  text-align: left;
}

@media (max-width: 640px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}


/* Precise MSL version with grid layout */
.msl-measure-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e0e0e0;
}


/* MSL Section Layout */
.msl-section {
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: 6px;
  background-color: #ffffff;
}

.msl-identification {
  background-color: #f8f9fa;
}

.msl-identification .form-group {
  margin-bottom: 0;
}

.msl-identification input {
  font-weight: 500;
  font-size: 1.05em;
}

.msl-weight-section {
  background-color: #e3f2fd;
  border-left: 4px solid #2196f3;
}

.msl-weight-section .form-group {
  margin-bottom: 0;
}

.msl-weight-section label {
  font-weight: 600;
  color: #1976d2;
}

.msl-weight-section input {
  font-weight: 600;
  font-size: 1.1em;
  border: 2px solid #2196f3;
}

/* Cutscore Configuration Section */
.msl-cutscores {
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
}

.msl-cutscores-header {
  font-weight: 600;
  font-size: 0.95em;
  color: #424242;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.msl-cutscores-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.msl-cutscores-grid .form-group {
  margin-bottom: 0;
}

.range-indicator {
  display: inline-block;
  font-size: 0.8em;
  margin-right: 0.25rem;
}

.range-indicator.less-range {
  color: #f44336;
}

.range-indicator.expected-range {
  color: #ff9800;
}

.range-indicator.higher-range {
  color: #4caf50;
}

/* Actual Score Section */
.msl-actual-section {
  background-color: #fff3e0;
  border-left: 4px solid #ff9800;
}

.msl-actual-section .form-group {
  margin-bottom: 0;
}

.msl-actual-section label {
  font-weight: 600;
  color: #e65100;
}

.msl-actual-section input {
  font-weight: 600;
  font-size: 1.1em;
  border: 2px solid #ff9800;
}

/* Readonly Field Styling */
.readonly-field {
  background-color: #e0e0e0 !important;
  color: #616161 !important;
  border: 1px solid #bdbdbd !important;
  cursor: not-allowed;
  font-style: italic;
}

.readonly-field:focus {
  outline: none;
  box-shadow: none;
}

/* ===================================
   Per-Measure Band Visualization
   =================================== */
.msl-band-viz {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 1rem 1rem 0.75rem;
}

.msl-band-header {
  font-weight: 600;
  font-size: 0.82em;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0.6rem;
}

/* The outer wrapper provides the positioning context for the marker row */
.msl-band-bar-wrap {
  position: relative;
}

/* The three-segment bar */
.msl-band-bar {
  display: flex;
  width: 100%;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.msl-band-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), filter 0.25s ease, box-shadow 0.25s ease;
  min-width: 0;
  overflow: hidden;
}

.msl-band-less {
  background-color: var(--rating-red-bg);
  border-right: 2px solid rgba(0,0,0,0.06);
}

.msl-band-expected {
  background-color: var(--rating-orange-bg);
  border-right: 2px solid rgba(0,0,0,0.06);
}

.msl-band-higher {
  background-color: var(--rating-green-bg);
}

/* Active band — solid border highlight matching the rating color */
.msl-band-segment.msl-band-active {
  z-index: 1;
}

.msl-band-less.msl-band-active {
  background-color: var(--rating-red-bg);
  box-shadow: inset 0 0 0 2px var(--rating-red);
}

.msl-band-expected.msl-band-active {
  background-color: var(--rating-orange-bg);
  box-shadow: inset 0 0 0 2px var(--rating-orange);
}

.msl-band-higher.msl-band-active {
  background-color: var(--rating-green-bg);
  box-shadow: inset 0 0 0 2px var(--rating-green);
}

.msl-band-label {
  font-size: 0.72em;
  font-weight: 700;
  color: rgba(0,0,0,0.65);
  text-align: center;
  line-height: 1.2;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Marker row sits ABOVE the bar */
.msl-band-marker-row {
  position: relative;
  height: 32px;
  margin-bottom: 2px;
}

.msl-band-marker {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.msl-band-marker-arrow {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid var(--color-primary);
}

.msl-band-marker-label {
  background: var(--color-primary);
  color: white;
  font-size: 0.72em;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

/* Scale ruler below */
.msl-band-scale {
  position: relative;
  height: 18px;
  margin-top: 2px;
  font-size: 0.72em;
  color: #78909c;
  font-weight: 500;
}

.msl-band-scale-min {
  position: absolute;
  left: 0;
}

.msl-band-scale-max {
  position: absolute;
  right: 0;
}

/* Cutscore ticks are absolutely positioned by JS */
.msl-band-scale-cut1,
.msl-band-scale-cut2 {
  position: absolute;
  transform: translateX(-50%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 4px;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.95em;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .msl-band-label {
    font-size: 0.62em;
  }
  .msl-band-bar {
    height: 40px;
  }
}


@media (max-width: 768px) {
  .msl-inputs {
    grid-template-columns: 1fr;
  }

  .msl-cutscores-grid {
    grid-template-columns: 1fr;
  }

  .table-scroll table {
    min-width: 580px;
  }
}

/* ===================================
   Buttons
   =================================== */
.btn {
  padding: 0.65rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  min-height: 44px;
  min-width: 44px;
  user-select: none;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(140, 40, 70, 0.25);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

/* Primary Hero Action */
.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary-dark);
  box-shadow: 0 4px 12px rgba(140, 40, 70, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(140, 40, 70, 0.3);
}

/* Secondary Actions */
.btn-secondary {
  background: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Copy Success State */
.btn-copy-success {
  background: #059669 !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3) !important;
  transform: scale(1.02);
}

/* Remove button on measure cards */
.btn-remove {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  min-height: 32px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-remove:hover:not(:disabled) {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-remove:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Ghost Danger Action for Reset */
.btn-ghost-danger {
  background: transparent;
  color: #64748b;
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-ghost-danger:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* ===================================
   Results Table
   =================================== */
/* Table scroll wrapper for mobile */
.table-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}

.table-scroll table {
  min-width: 640px;
}

.table-scroll:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.results-section {
  position: relative;
  min-height: 300px;
}

.results-section.disabled {
  opacity: 0.6;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.results-table thead {
  background: var(--color-primary);
  color: white;
}

.results-table th,
.results-table td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.results-table tbody tr:hover {
  background: var(--color-bg);
}

.results-table .final-row {
  background: #dbeafe;
  font-size: 1.125rem;
}

.results-table .final-row td {
  border-bottom: none;
}

.results-table .final-rating {
  color: var(--color-primary);
  font-size: 1.25rem;
}

/* ===================================
   Overlay
   =================================== */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  z-index: 10;
}

.overlay-content {
  text-align: center;
  padding: var(--spacing-xl);
  max-width: 500px;
}

.overlay-content p {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-warning);
  margin-bottom: var(--spacing-md);
}

.overlay-content ul {
  text-align: left;
  list-style-position: inside;
  color: var(--color-text-muted);
}

.overlay-content li {
  margin-bottom: var(--spacing-xs);
}

/* ===================================
   Score Range Visualization
   =================================== */
.score-range-container {
  margin-top: var(--spacing-2xl);
  padding: var(--spacing-xl);
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-border);
}

.score-range-container h3 {
  margin-bottom: var(--spacing-xs);
  color: var(--color-primary-dark);
}

.range-description {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--spacing-lg);
}

.score-range-bar {
  display: flex;
  width: 100%;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: var(--spacing-md);
}

.range-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-sm);
  position: relative;
  transition: var(--transition);
}

.range-segment:hover {
  filter: brightness(0.97);
  z-index: 1;
}

.range-ineffective {
  width: 18.8%;
  background-color: var(--rating-red-bg);
  border-right: 2px solid rgba(0, 0, 0, 0.1);
}

.range-partially-effective {
  width: 21.9%;
  background-color: var(--rating-orange-bg);
  border-right: 2px solid rgba(0, 0, 0, 0.1);
}

.range-effective {
  width: 39.4%;
  background-color: var(--rating-blue-bg);
  border-right: 2px solid rgba(0, 0, 0, 0.1);
}

.range-highly-effective {
  width: 20%;
  background-color: var(--rating-green-bg);
}

.range-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
  text-align: center;
  margin-bottom: var(--spacing-xs);
}

.range-values {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.score-marker-container {
  position: relative;
  height: 60px;
  margin-top: var(--spacing-sm);
}

.score-marker {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  transition: left 0.3s ease;
}

.marker-arrow {
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 16px solid var(--color-primary);
  margin: 0 auto;
}

.marker-label {
  background: var(--color-primary);
  color: white;
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-md);
  text-align: center;
  margin-top: 4px;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

.marker-score {
  font-size: 1.25rem;
  font-weight: 700;
  display: block;
}

.marker-rating {
  font-size: 0.75rem;
  opacity: 0.9;
  display: block;
  margin-top: 2px;
}

.range-insights {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
  background: white;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-primary);
}

.range-insights p {
  margin: 0;
  color: var(--color-text);
  font-size: 0.9375rem;
}

.range-thresholds {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  pointer-events: none;
}

.threshold-marker {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}

.threshold-line {
  width: 2px;
  height: 80px;
  background: rgba(0, 0, 0, 0.2);
  margin: 0 auto;
}

.threshold-label {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: white;
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .score-range-bar {
    height: 100px;
  }

  .range-label {
    font-size: 0.75rem;
  }

  .range-values {
    font-size: 0.6875rem;
  }

  .marker-score {
    font-size: 1rem;
  }

  .marker-label {
    padding: var(--spacing-xs) var(--spacing-sm);
  }
}

/* ===================================
   Actions
   =================================== */
.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  margin: var(--spacing-xl) 0;
  flex-wrap: wrap;
  padding: var(--spacing-md) 0;
}

.actions-primary-group {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  align-items: center;
}

.actions-danger-group {
  display: flex;
  align-items: center;
  margin-left: auto;
}

@media (max-width: 640px) {
  .actions {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
  }

  .actions-primary-group {
    flex-direction: column;
    width: 100%;
  }

  .actions-primary-group .btn,
  .actions-danger-group .btn {
    width: 100%;
  }

  .actions-danger-group {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

/* ===================================
   Footer
   =================================== */
.app-footer {
  background: var(--color-surface);
  border-top: 2px solid var(--color-border);
  padding: var(--spacing-xl) var(--spacing-lg);
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.app-footer p {
  margin-bottom: var(--spacing-sm);
}

/* ===================================
   Responsive
   =================================== */
@media (max-width: 768px) {
  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .card {
    padding: var(--spacing-lg);
  }

  .weights-grid,
  .elements-grid {
    grid-template-columns: 1fr;
  }

  .summary-stats {
    grid-template-columns: 1fr;
  }

  .summary-stats-row {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .summary-value {
    font-size: 2rem;
  }

  .summary-range-label {
    font-size: 0.6875rem;
  }

  .standard-summary {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .results-table {
    font-size: 0.875rem;
  }

  .results-table th,
  .results-table td {
    padding: var(--spacing-sm);
  }

  .table-scroll table {
    min-width: 520px;
  }
}

/* ===================================
   Mobile Phone Optimizations (<= 640px)
   =================================== */
@media (max-width: 640px) {
  .app-header {
    padding: var(--spacing-md) var(--spacing-sm);
  }

  .app-header-content {
    flex-direction: column;
    text-align: center;
    gap: var(--spacing-sm);
  }

  .header-brand {
    flex-direction: column;
    text-align: center;
    gap: var(--spacing-xs);
  }

  .header-logo {
    width: 52px;
    height: 52px;
  }

  .app-header h1 {
    font-size: 1.35rem;
    line-height: 1.25;
  }

  .subtitle {
    font-size: 0.875rem;
    margin-bottom: var(--spacing-xs);
  }

  #btn-about-tool {
    width: 100%;
    max-width: 240px;
    justify-content: center;
    font-size: 0.875rem;
  }

  .container {
    padding: var(--spacing-sm) 0.5rem;
  }

  .card {
    padding: var(--spacing-md) 0.75rem;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
  }

  /* Summary Card on Phone */
  .summary-content {
    gap: var(--spacing-md);
  }

  .summary-stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .summary-stat {
    padding: var(--spacing-sm) 0.5rem;
    border-radius: var(--radius-sm);
  }

  .summary-stat-randa {
    grid-column: 1 / -1;
    order: -1;
  }

  .summary-label {
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
  }

  .summary-value {
    font-size: 1.5rem;
  }

  .summary-value-randa {
    font-size: 2.2rem;
    font-weight: 800;
  }

  .summary-subtext {
    font-size: 0.7rem;
  }

  .summary-range-bar {
    height: 52px;
  }

  .summary-range-segment {
    padding: 2px;
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

  .summary-range-label {
    font-size: 0.65rem;
    line-height: 1.15;
  }

  .summary-range-values {
    font-size: 0.58rem;
    margin-top: 1px;
  }

  /* MSL Measures Phone Layout */
  .msl-measure-row {
    padding: var(--spacing-md) 0.75rem;
    margin-bottom: var(--spacing-md);
  }

  .msl-measure-header {
    flex-wrap: wrap;
    gap: var(--spacing-xs);
  }

  .msl-measure-number {
    font-size: 1rem;
  }

  .measure-fields {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-sm);
  }

  input[type="number"],
  input[type="text"],
  textarea {
    font-size: 16px !important; /* Prevents auto-zoom in mobile Safari */
    min-height: 44px;
  }

  .field-weight,
  .field-range,
  .field-actual {
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  /* Auto-Derived Ribbon on Mobile */
  .measure-auto-ribbon {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    margin-top: var(--spacing-xs);
  }

  .auto-ribbon-pill {
    width: 100%;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    flex-wrap: wrap;
    gap: 6px;
  }

  .auto-ribbon-subtext {
    margin-left: 0;
    width: 100%;
    font-size: 0.7rem;
  }

  .measure-range-bar-container {
    margin: 1.25rem 0 1.75rem;
  }

  .measure-range-label-min,
  .measure-range-label-max {
    font-size: 0.68rem;
    bottom: -18px;
  }

  .measure-feedback {
    font-size: 0.8rem;
    line-height: 1.35;
  }

  /* Weight Allocation Budget Meter on Mobile */
  .weight-meter-card {
    padding: var(--spacing-md) 0.75rem;
    margin-top: var(--spacing-md);
  }

  .weight-meter-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .weight-meter-title-wrap {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .weight-meter-title {
    font-size: 0.875rem;
  }

  .weight-meter-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
  }

  .weight-meter-status {
    font-size: 0.8rem;
    width: 100%;
  }

  .weight-meter-track {
    height: 9px;
  }

  /* Action Buttons on Mobile */
  .actions {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
    margin: var(--spacing-lg) 0;
    padding: 0;
  }

  .actions-primary-group {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  .actions-primary-group .btn,
  .actions-danger-group,
  .actions-danger-group .btn,
  #btn-add-measure {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 0.95rem;
  }

  .actions-danger-group {
    margin-left: 0;
    margin-top: 0.25rem;
  }

  /* Status & Print Mode Bar */
  .print-mode-bar {
    flex-direction: column;
    text-align: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
  }

  .print-mode-status {
    flex-direction: column;
    width: 100%;
    gap: var(--spacing-xs);
  }

  .print-mode-badge {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Modals on Mobile */
  .modal {
    padding: 0.5rem;
  }

  .modal-content {
    width: 100%;
    max-width: 100vw;
    max-height: 94vh;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .modal-header h2 {
    font-size: 1.15rem;
  }

  .modal-body {
    padding: var(--spacing-sm) var(--spacing-md);
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: var(--spacing-sm) 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
  }

  .calc-table {
    margin: 0;
    border: none;
    font-size: 0.75rem;
    min-width: 540px;
  }

  .calc-table th,
  .calc-table td {
    padding: 6px 8px;
  }

  .final-calc-box {
    padding: var(--spacing-md);
  }

  .calc-row {
    font-size: 0.85rem;
  }

  .calc-row.total {
    font-size: 1rem;
  }

  /* Toast for Mobile */
  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1.25rem;
    width: auto;
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
}

/* Print-Only Visibility */
.print-only {
  display: none !important;
}

/* ===================================
   Print Styles (High-Contrast Black & White)
   =================================== */
@media print {
  @page {
    margin: 1.2cm 1.5cm;
    size: portrait;
  }

  .print-only {
    display: block !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 10pt !important;
    line-height: 1.4 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Hide UI Elements & Interactive Panels */
  /* Hide UI Elements & Interactive Panels */
  .app-header,
  .quick-actions,
  .actions,
  .app-footer,
  .progress-steps,
  .sticky-footer,
  .tooltip-trigger,
  .tooltip,
  .overlay,
  .summary-card,
  .weight-meter-card,
  .print-mode-bar,
  .toast,
  #toast-notification,
  .modal,
  .modal-overlay,
  .header-links,
  #step-msl,
  #step1,
  #step2,
  #step3,
  #step4,
  button,
  .btn,
  .btn-remove,
  .validation-error,
  .validation-success,
  .validation-info,
  .step-description {
    display: none !important;
  }

  /* Header branding & metadata for print */
  .print-header {
    border-bottom: 2px solid #000000 !important;
    padding-bottom: 0.75rem !important;
    margin-bottom: 1.25rem !important;
  }

  .print-header-brand {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    margin-bottom: 10px !important;
  }

  .print-logo {
    width: 64px !important;
    height: 64px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
  }

  .print-header-titles {
    flex-grow: 1 !important;
  }

  .print-doc-title {
    font-size: 15pt !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    color: #000000 !important;
    margin-bottom: 2px !important;
  }

  .print-doc-subtitle {
    font-size: 9.5pt !important;
    font-weight: 600 !important;
    color: #333333 !important;
    margin-top: 1px !important;
  }

  .print-meta-grid {
    display: grid !important;
    grid-template-columns: 1.2fr 0.8fr !important;
    gap: 6px 20px !important;
    background: #fbfbfb !important;
    border: 1px solid #000000 !important;
    padding: 8px 12px !important;
    margin-top: 8px !important;
    font-size: 9.5pt !important;
  }

  .print-meta-item {
    color: #000000 !important;
    line-height: 1.35 !important;
  }

  .print-header-row {
    display: flex !important;
    justify-content: space-between !important;
    margin-bottom: 0.4rem !important;
  }

  .print-field {
    font-size: 10pt !important;
    color: #000000 !important;
  }

  /* High contrast B&W Cards */
  .card {
    box-shadow: none !important;
    border: 1px solid #000000 !important;
    border-radius: 0 !important;
    margin-bottom: 18px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    padding: 12px !important;
    background: #ffffff !important;
  }

  /* EOY Summary Box */
  .print-summary-box {
    border: 2px solid #000000 !important;
    padding: 10px 14px !important;
    margin-bottom: 18px !important;
    background: #ffffff !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-summary-item {
    text-align: center !important;
  }

  .print-summary-label {
    font-size: 8.5pt !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    color: #000000 !important;
  }

  .print-summary-value {
    font-size: 15pt !important;
    font-weight: 800 !important;
    color: #000000 !important;
    margin-top: 2px !important;
  }

  /* Print Tables (High Contrast B&W Grid) */
  .results-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 10px !important;
    margin-bottom: 12px !important;
    font-size: 9.5pt !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .results-table th,
  .results-table td {
    border: 1px solid #000000 !important;
    padding: 6px 8px !important;
    color: #000000 !important;
    background: #ffffff !important;
  }

  .results-table thead tr {
    background-color: #f0f0f0 !important;
    border-bottom: 2px solid #000000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .results-table th {
    font-weight: bold !important;
    text-align: center !important;
  }

  .results-table tfoot tr {
    border-top: 2px solid #000000 !important;
    font-weight: bold !important;
    background-color: #f9f9f9 !important;
  }

  /* Footnote & Notes */
  .print-footnote {
    font-size: 8.5pt !important;
    color: #222222 !important;
    margin-top: 6px !important;
    margin-bottom: 18px !important;
    line-height: 1.35 !important;
  }

  /* Professional Signatures */
  .print-signature-box {
    display: flex !important;
    gap: 30px !important;
    margin-top: 30px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .signature-line {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
  }

  .signature-line span {
    font-size: 9.5pt !important;
    font-weight: bold !important;
    color: #000000 !important;
  }

  .signature-line .line {
    border-bottom: 1px solid #000000 !important;
    height: 1.6rem !important;
  }
}



/* ===================================
   Progress Indicator
   =================================== */
.progress-steps {
  display: flex;
  margin: 0 auto var(--spacing-xl);
  /* Center the container itself */
  flex-wrap: wrap;
  padding-bottom: var(--spacing-sm);
  gap: var(--spacing-md);
  justify-content: center !important;
  width: -moz-fit-content;
  width: fit-content;
  /* Ensure container is only as wide as content */
  max-width: 100%;
}

.progress-step {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280;
  font-weight: 600;
  font-size: 0.875rem;
  transition: var(--transition);
  border: 2px solid transparent;
}

.progress-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #d1d5db;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

.progress-step.is-current {
  background: #dbeafe;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.progress-step.is-current .progress-step-number {
  background: var(--color-primary);
}

.progress-step.is-complete {
  background: var(--rating-green-bg);
  color: #065f46;
}

.progress-step.is-complete .progress-step-number {
  background: var(--rating-green);
  color: white;
}

.progress-step.is-complete .progress-step-number::after {
  content: '✓';
}

/* Hide number text when complete, show checkmark instead */
.progress-step.is-complete .progress-step-number {
  font-size: 0;
}

.progress-step.is-complete .progress-step-number::after {
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .progress-steps {
    gap: var(--spacing-xs);
    justify-content: center !important;
  }

  .progress-step {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75rem;
  }

  .progress-step-label {
    display: none;
  }

  .progress-step-number {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
  }
}

/* Quick action buttons */
.quick-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.btn-small {
  font-size: 0.875rem;
  padding: var(--spacing-xs) var(--spacing-md);
}

@media (max-width: 768px) {
  .summary-card {
    position: relative;
    top: 0;
  }

  .summary-value {
    font-size: 2rem;
  }

  .summary-range-segment {
    font-size: 0.65rem;
    padding: var(--spacing-xs) 2px;
  }

  .quick-actions {
    flex-direction: column;
  }

  /* Rating Badges */
  .rating-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    /* Pill shape */
    font-weight: 600;
    font-size: 0.9em;
    line-height: 1;
    text-transform: capitalize;
  }

  /* Badge specific colors */
  .rating-badge.rating-highly-effective,
  .rating-badge.rating-exemplary {
    background-color: var(--rating-green-bg);
    color: var(--rating-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
  }

  .rating-badge.rating-effective,
  .rating-badge.rating-accomplished,
  .rating-badge.rating-proficient {
    background-color: var(--rating-blue-bg);
    color: var(--rating-blue);
    border: 1px solid rgba(59, 130, 246, 0.2);
  }

  .rating-badge.rating-partially-effective,
  .rating-badge.rating-partially-proficient,
  .rating-badge.rating-expected {
    background-color: var(--rating-orange-bg);
    color: var(--rating-orange);
    border: 1px solid rgba(245, 158, 11, 0.2);
  }

  .rating-badge.rating-ineffective,
  .rating-badge.rating-basic,
  .rating-badge.rating-less-than-expected {
    background-color: var(--rating-red-bg);
    color: var(--rating-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
  }

  .btn-small {
    width: 100%;
  }
}

/* ===================================
   Rating Classes
   =================================== */
/* Background emphasis for larger blocks (rows, panels) */
.rating-highly-effective {
  background-color: var(--rating-green-bg);
}

.rating-effective {
  background-color: var(--rating-blue-bg);
}

.rating-partially-effective {
  background-color: var(--rating-orange-bg);
}

.rating-ineffective {
  background-color: var(--rating-red-bg);
}

.rating-expected {
  background-color: var(--rating-green-bg);
}

.rating-more-than-expected {
  background-color: var(--rating-blue-bg);
}

.rating-less-than-expected {
  background-color: var(--rating-orange-bg);
}

.rating-exemplary {
  background-color: var(--rating-blue-bg);
}

.rating-accomplished {
  background-color: var(--rating-green-bg);
}

.rating-proficient {
  background-color: var(--rating-green-bg);
}

.rating-partially-proficient {
  background-color: var(--rating-orange-bg);
}

.rating-basic {
  background-color: var(--rating-orange-bg);
}

/* Compact badge/chip variant for labels */
.rating-badge {
  display: inline-block;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1;
  padding: 0.375rem 0.625rem;
  vertical-align: middle;
}

.rating-badge.rating-highly-effective {
  color: #fff;
  background-color: var(--rating-blue);
}

.rating-badge.rating-effective {
  color: #fff;
  background-color: var(--rating-green);
}

.rating-badge.rating-partially-effective {
  color: #fff;
  background-color: var(--rating-orange);
}

.rating-badge.rating-ineffective {
  color: #fff;
  background-color: var(--rating-orange);
}

.rating-badge.rating-expected {
  color: #fff;
  background-color: var(--rating-green);
}

.rating-badge.rating-more-than-expected {
  color: #fff;
  background-color: var(--rating-blue);
}

.rating-badge.rating-less-than-expected {
  color: #fff;
  background-color: var(--rating-orange);
}

.rating-badge.rating-exemplary {
  color: #fff;
  background-color: var(--rating-green);
}

.rating-badge.rating-accomplished {
  color: #fff;
  background-color: var(--rating-blue);
}

.rating-badge.rating-proficient {
  color: #fff;
  background-color: var(--rating-blue);
}

.rating-badge.rating-partially-proficient {
  color: #fff;
  background-color: var(--rating-orange);
}

.rating-badge.rating-basic {
  color: #fff;
  background-color: var(--rating-red);
}

/* ===================================
   Modal
   =================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.modal-content {
  position: relative;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 800px;
  max-height: 85vh;
  width: 90%;
  display: flex;
  flex-direction: column;
  z-index: 1001;
}

.modal-header {
  padding: var(--spacing-lg);
  border-bottom: 2px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: var(--color-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  flex: 1;
  line-height: 1.6;
}

/* About Modal Content Formatting */
.modal-body h3 {
  color: var(--color-primary-dark);
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-xs);
  border-bottom: 2px solid var(--color-border);
}

.modal-body h3:first-child {
  margin-top: 0;
}

.modal-body h4 {
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-sm);
}

.modal-body p {
  margin-bottom: var(--spacing-md);
  color: var(--color-text);
}

.modal-body ul,
.modal-body ol {
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-xl);
}

.modal-body li {
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
}

.modal-body ul ul,
.modal-body ol ul,
.modal-body ul ol,
.modal-body ol ol {
  margin-top: var(--spacing-xs);
  margin-bottom: var(--spacing-xs);
}

.modal-body code {
  background-color: #f1f5f9;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--color-primary-dark);
}

.modal-body strong {
  font-weight: 600;
  color: var(--color-text);
}

.modal-empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--spacing-2xl);
}

.calc-section {
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
}

.calc-section:last-child {
  border-bottom: none;
}

.calc-section h3 {
  color: var(--color-primary-dark);
  margin-bottom: var(--spacing-md);
}

.calc-formula {
  background-color: #f0f9ff;
  border-left: 4px solid var(--color-primary);
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-primary-dark);
  margin: var(--spacing-sm) 0;
}

.calc-step {
  margin: var(--spacing-sm) 0;
  padding-left: var(--spacing-md);
}

.calc-result {
  background: var(--color-bg);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-top: var(--spacing-md);
  font-weight: 600;
}

/* ===================================
   Tooltips
   =================================== */
.tooltip-trigger {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: help;
  font-size: 1.25rem;
  padding: 0;
  margin-left: var(--spacing-xs);
  vertical-align: middle;
  transition: var(--transition);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.tooltip-trigger:hover,
.tooltip-trigger:focus {
  background: var(--color-bg);
  color: var(--color-primary-dark);
}

.tooltip {
  position: absolute;
  z-index: 100;
  background: var(--color-text);
  color: white;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
  font-size: 0.875rem;
  line-height: 1.5;
  left: 0;
  right: 0;
  margin: 0 auto;
  top: 60px;
}

.tooltip-content strong {
  display: block;
  margin-bottom: var(--spacing-xs);
  color: #fbbf24;
}

.tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--color-text);
}

@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .modal-header,
  .modal-body {
    padding: var(--spacing-md);
  }

  .tooltip {
    max-width: 280px;
  }
}

/* ===================================
   Accessibility
   =================================== */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Animations */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes celebrate {

  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }

  25% {
    transform: scale(1.1) rotate(-5deg);
  }

  75% {
    transform: scale(1.1) rotate(5deg);
  }
}

.summary-card {
  animation: slideInUp 0.3s ease-out;
}

.progress-step.is-complete {
  animation: pulse 0.5s ease-in-out;
}

.progress-step.is-highly-effective {
  animation: celebrate 0.6s ease-in-out;
  background: var(--rating-green-bg) !important;
  border-color: var(--rating-green) !important;
}

.score-marker {
  animation: slideInUp 0.4s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===================================
   Progress Bars (Recommendation 3)
   =================================== */
.progress-container {
  height: 8px;
  background-color: var(--color-border);
  border-radius: var(--radius-md);
  margin-top: var(--spacing-sm);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: var(--radius-md);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
  width: 0%;
}

/* Color code the progress bar based on rating */
.rating-exemplary .progress-fill,
.rating-highly-effective .progress-fill {
  background-color: var(--rating-green);
}

.rating-accomplished .progress-fill,
.rating-effective .progress-fill {
  background-color: var(--rating-blue);
}

.rating-proficient .progress-fill,
.rating-partially-effective .progress-fill {
  background-color: var(--rating-orange);
  /* Or yellow/orange mix */
}

.rating-partially-proficient .progress-fill,
.rating-basic .progress-fill {
  background-color: var(--rating-red);
  /* Or orange/red mix */
}

.standard-section .progress-container {
  max-width: 200px;
  /* Keep it compact in the summary */
}

/* ===================================
   Sticky Footer Summary (Recommendation 1)
   =================================== */
.sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
  padding: var(--spacing-sm) var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
}

.sticky-footer.visible {
  transform: translateY(0);
}

.footer-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-xl);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.footer-stat {
  display: flex;
  flex-direction: column;
}

.footer-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.footer-value {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-text);
}

.footer-rating-badge {
  margin-left: auto;
}

.footer-rating-badge .rating-badge {
  font-size: 1rem;
  padding: 6px 16px;
}

/* Add padding to body so footer doesn't cover content */
body:has(.sticky-footer) {
  padding-bottom: 80px;
}

/* Make footer visible by default but perhaps different content? */
/* Actually, let's keep it hidden until JS logic decides. */
/* ===================================
   Modal Cleanup (User Request)
   =================================== */

.calc-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-md) 0;
  font-size: 0.95rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  /* For border radius */
}

/* Ensure border radius works on table by wrapping or separate borders */
.calc-table th,
.calc-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.calc-table thead th {
  background-color: #f1f5f9;
  font-weight: 600;
  color: var(--color-text);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.calc-table tfoot th {
  background-color: #f8fafc;
  font-weight: 700;
  border-top: 2px solid var(--color-border);
}

.calc-table tbody tr:last-child td {
  border-bottom: none;
}

.calc-formula {
  background-color: #f0f9ff;
  /* Light blue tint */
  border-left: 4px solid var(--color-primary);
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-primary-dark);
}

.final-calc-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  margin-top: var(--spacing-md);
}

.calc-row {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

.calc-row:last-child {
  border-bottom: none;
}

.calc-row.total {
  font-weight: 700;
  font-size: 1.1rem;
  border-top: 2px solid var(--color-border);
  border-bottom: none;
  margin-top: var(--spacing-sm);
  padding-top: var(--spacing-md);
}

.calc-row.result {
  align-items: center;
  margin-top: var(--spacing-md);
}

.calc-row.randa {
  background: #fbf3d9;
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  margin: var(--spacing-xs) 0;
  border: 1px solid #b5872a;
  font-weight: 600;
}

.randa-value {
  color: var(--color-secondary);
  font-size: 1.2rem;
  font-weight: 700;
}

/* RANDA stat in MSL results section */
.randa-stat {
  background: #fbf3d9;
  border: 1px solid #b5872a;
}

.randa-entry {
  color: var(--color-secondary);
  font-size: 1.375rem;
}


/* ===================================
   Usability Enhancements
   =================================== */

/* Accordion */
.accordion-header {
  cursor: pointer;
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
  padding: var(--spacing-sm);
  margin: calc(var(--spacing-sm) * -1);
  margin-bottom: var(--spacing-sm) !important;
  border-radius: var(--radius-sm);
}

.accordion-header:hover {
  background: rgba(0, 0, 0, 0.03);
}

.accordion-header::after {
  content: '▼';
  font-size: 0.8em;
  transition: transform 0.3s ease;
  color: var(--color-text-light);
}

.standard-section.collapsed .accordion-header::after {
  transform: rotate(-90deg);
}

.standard-section.collapsed> :not(h3) {
  display: none !important;
}

.standard-section.collapsed {
  padding-bottom: var(--spacing-md);
}

/* Copy Button */
#btn-copy-summary {
  background: white;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

#btn-copy-summary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ===================================
   Print Mode Indicator & Toast Notifications
   =================================== */
.print-mode-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.print-mode-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.print-mode-instruction {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-align: center;
  font-weight: 500;
  line-height: 1.4;
}

.print-mode-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.print-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.print-mode-badge.badge-boy {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.print-mode-badge.badge-eoy {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.print-mode-badge.badge-incomplete {
  background: #fffbe6;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e293b;
  color: #ffffff;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.95rem;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transform: translateY(1rem);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Guided Summary Overlay */
.overlay.guided-overlay {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
}

.overlay.guided-overlay .overlay-content p {
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  margin: 0;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}