/* Chaint Afrique ESG Diagnostic Portal — Styles */
/* Colour palette: deep forest green, gold accent, traffic-light system */

:root {
  --ca-green: #14532d;
  --ca-green-light: #166534;
  --ca-green-bright: #22c55e;
  --ca-gold: #eab308;
  --ca-gold-light: #fde047;

  --rating-green: #16a34a;
  --rating-green-bg: #dcfce7;
  --rating-yellow: #ca8a04;
  --rating-yellow-bg: #fef9c3;
  --rating-red: #dc2626;
  --rating-red-bg: #fecaca;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1);

  --transition: 0.2s ease;
  --font:
    "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

/* === Reset & Base === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* === Typography === */
h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
h2 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}
h3 {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
}
h4 {
  font-size: 1rem;
  font-weight: 600;
}
p {
  margin-bottom: 0.5rem;
}
a {
  color: var(--ca-green-light);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* === Layout === */
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}

.screen {
  display: none;
  animation: fadeIn 0.35s ease;
}
.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Header === */
.app-header {
  background: var(--ca-green);
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}
.app-header img {
  height: 44px;
  width: auto;
  filter: brightness(0) invert(1);
}
.app-header-text h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}
.app-header-text p {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

/* === Cards === */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

/* === Welcome Screen === */
.welcome-hero {
  text-align: center;
  padding: 3rem 1.5rem;
  background: linear-gradient(
    135deg,
    var(--ca-green) 0%,
    var(--ca-green-light) 100%
  );
  color: #fff;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-xl);
}
.welcome-hero img {
  height: 56px;
  margin-bottom: 1rem;
}
.welcome-hero h1,
.welcome-hero h2,
.welcome-hero .welcome-hero-title {
  color: #fff;
  margin-bottom: 0.5rem;
  font-size: 2rem;
}
.welcome-hero p {
  color: rgba(255, 255, 255, 0.85);
  max-width: 600px;
  margin: 0 auto 2rem;
  font-size: 1.05rem;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.welcome-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.welcome-feature {
  text-align: center;
  padding: 1.5rem 1rem;
}
.welcome-feature-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.welcome-feature h3 {
  margin-bottom: 0.25rem;
}
.welcome-feature p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  text-decoration: none;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--ca-gold);
  color: var(--ca-green);
}
.btn-primary:hover {
  background: var(--ca-gold-light);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn-outline {
  background: transparent;
  color: var(--ca-green);
  border: 2px solid var(--ca-green);
}
.btn-outline:hover {
  background: var(--ca-green);
  color: #fff;
}

.btn-success {
  background: var(--rating-green);
  color: #fff;
}
.btn-success:hover {
  background: #15803d;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
}
.btn-ghost:hover {
  background: var(--border-light);
  color: var(--text);
}

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
}
.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* === Forms === */
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.form-label .required {
  color: var(--rating-red);
  margin-left: 2px;
}
.form-input,
.form-select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-card);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--ca-green-bright);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* === Tabs === */
.tab-nav {
  display: flex;
  gap: 0.25rem;
  background: var(--border-light);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab-btn {
  flex: 1;
  padding: 0.7rem 1rem;
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  white-space: nowrap;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
}
.tab-btn.active {
  background: var(--bg-card);
  color: var(--ca-green);
  box-shadow: var(--shadow);
}
.tab-btn .tab-count {
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  background: var(--border-light);
  border-radius: 99px;
  color: var(--text-muted);
}
.tab-btn.active .tab-count {
  background: var(--rating-green-bg);
  color: var(--rating-green);
}

/* === Progress Bar === */
.progress-container {
  margin-bottom: 1.5rem;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.progress-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.progress-pct {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ca-green);
}
.progress-bar {
  height: 8px;
  background: var(--border-light);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--ca-green-bright),
    var(--ca-green-light)
  );
  border-radius: 99px;
  transition: width 0.5s ease;
}

/* === Accordion (Domain sections) === */
.accordion {
}
.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  overflow: hidden;
  background: var(--bg-card);
}
.accordion-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
.accordion-header:hover {
  background: var(--border-light);
}
.accordion-chevron {
  width: 20px;
  height: 20px;
  transition: transform var(--transition);
  color: var(--text-muted);
  flex-shrink: 0;
}
.accordion-item.open .accordion-chevron {
  transform: rotate(90deg);
}
.accordion-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}
.accordion-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.accordion-body {
  display: none;
  padding: 0.5rem 1rem 1rem;
  border-top: 1px solid var(--border-light);
}
.accordion-item.open .accordion-body {
  display: block;
}

/* NA toggle */
.na-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  background: var(--border-light);
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.na-toggle input[type="checkbox"] {
  accent-color: var(--ca-green);
}
.na-toggle.is-na {
  background: #f1f5f9;
  color: var(--text-light);
}

/* === Questions === */
.question-card {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-light);
}
.question-card:last-child {
  border-bottom: none;
}
.question-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.question-text {
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.answer-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.answer-option {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
  line-height: 1.4;
}
.answer-option:hover {
  border-color: var(--text-light);
  background: var(--border-light);
}
.answer-option input[type="radio"] {
  margin-top: 2px;
  accent-color: var(--ca-green);
  flex-shrink: 0;
}
.answer-option-content {
  flex: 1;
}
.answer-option-label {
  font-weight: 600;
  margin-right: 0.4rem;
}

/* Selected state — neutral (no traffic-light bias during assessment) */
.answer-option.selected-neutral {
  border-color: var(--ca-green);
  background: #f0fdf4;
}
.answer-option.selected-neutral .answer-option-label {
  color: var(--ca-green);
}

/* Disabled when domain is N/A */
.domain-disabled .question-card {
  opacity: 0.35;
  pointer-events: none;
}

/* === Results Dashboard === */
.results-overall {
  text-align: center;
  padding: 2rem;
  background: linear-gradient(
    135deg,
    var(--ca-green) 0%,
    var(--ca-green-light) 100%
  );
  border-radius: var(--radius);
  color: #fff;
  margin-bottom: 1.5rem;
}
.results-overall .gauge-chart {
  margin: 0 auto;
}
.results-overall .gauge-value {
  fill: #fff !important;
}
.results-overall .gauge-label {
  fill: rgba(255, 255, 255, 0.85) !important;
}
.results-overall .gauge-sublabel {
  fill: rgba(255, 255, 255, 0.6) !important;
}

.maturity-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1.25rem;
  border-radius: 99px;
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 1rem;
}
.maturity-badge--green {
  background: var(--rating-green-bg);
  color: var(--rating-green);
}
.maturity-badge--yellow {
  background: var(--rating-yellow-bg);
  color: var(--rating-yellow);
}
.maturity-badge--red {
  background: var(--rating-red-bg);
  color: var(--rating-red);
}

.pillar-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.pillar-card {
  text-align: center;
  padding: 1.5rem;
  border-left: 4px solid var(--border);
}
.pillar-card--green {
  border-left-color: var(--rating-green);
}
.pillar-card--yellow {
  border-left-color: var(--rating-yellow);
}
.pillar-card--red {
  border-left-color: var(--rating-red);
}
.pillar-card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.pillar-card-gauge {
  display: flex;
  justify-content: center;
}
.pillar-card-meta {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Domain heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.6rem;
}
.heatmap-cell {
  padding: 0.85rem 0.65rem;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: transform var(--transition);
}
.heatmap-cell:hover {
  transform: scale(1.03);
}
.heatmap-cell-name {
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}
.heatmap-cell-score {
  font-size: 1.3rem;
  font-weight: 800;
}
.heatmap-cell-rating {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

/* Weakness / strength list */
.domain-insight-list {
  list-style: none;
}
.domain-insight-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}
.domain-insight-item:last-child {
  border-bottom: none;
}
.domain-insight-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.domain-insight-rank.red {
  background: var(--rating-red-bg);
  color: var(--rating-red);
}
.domain-insight-rank.green {
  background: var(--rating-green-bg);
  color: var(--rating-green);
}
.domain-insight-info {
  flex: 1;
}
.domain-insight-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.domain-insight-pillar {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.domain-insight-score {
  font-weight: 700;
  font-size: 1rem;
  min-width: 48px;
  text-align: right;
}

/* Intervention card */
.intervention-card {
  padding: 1.5rem;
  border-radius: var(--radius);
}
.intervention-card--green {
  background: var(--rating-green-bg);
  border: 1px solid var(--rating-green);
}
.intervention-card--yellow {
  background: var(--rating-yellow-bg);
  border: 1px solid var(--rating-yellow);
}
.intervention-card--red {
  background: var(--rating-red-bg);
  border: 1px solid var(--rating-red);
}
.intervention-card h3 {
  margin-bottom: 0.5rem;
}
.intervention-card p {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.intervention-actions {
  list-style: none;
  padding: 0;
}
.intervention-actions li {
  padding: 0.35rem 0;
  padding-left: 1.25rem;
  position: relative;
  font-size: 0.9rem;
}
.intervention-actions li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: inherit;
  font-weight: 700;
}

/* Results actions bar */
.results-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* === Report (print-optimised screen) === */
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1.5rem;
  border-bottom: 3px solid var(--ca-green);
  margin-bottom: 1.5rem;
}
.report-logo h1 {
  font-size: 1.3rem;
  color: var(--ca-green);
}
.report-logo p {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.report-logo-img {
  height: 48px;
  margin-bottom: 0.5rem;
}
.report-meta-table {
  font-size: 0.85rem;
  border-collapse: collapse;
}
.report-meta-table th {
  text-align: left;
  padding: 0.25rem 1rem 0.25rem 0;
  color: var(--text-muted);
  font-weight: 500;
}
.report-meta-table td {
  padding: 0.25rem 0;
  font-weight: 600;
}

.report-section {
  margin-bottom: 2rem;
  page-break-inside: avoid;
}
.report-section h2 {
  font-size: 1.15rem;
  color: var(--ca-green);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.report-domain-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.report-domain-table th,
.report-domain-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
.report-domain-table th {
  font-weight: 600;
  background: var(--border-light);
  color: var(--text);
}
.report-domain-table .score-cell {
  font-weight: 700;
  text-align: center;
  width: 80px;
}
.report-domain-table .rating-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
.rating-dot--green {
  background: var(--rating-green);
}
.rating-dot--yellow {
  background: var(--rating-yellow);
}
.rating-dot--red {
  background: var(--rating-red);
}

.report-footer {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 2px solid var(--ca-green);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2rem;
}
.report-footer strong {
  color: var(--ca-green);
}

/* === History === */
.history-list {
  list-style: none;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all var(--transition);
}
.history-item:hover {
  border-color: var(--ca-green-bright);
  background: var(--border-light);
}
.history-score {
  font-size: 1.3rem;
  font-weight: 800;
  min-width: 60px;
  text-align: center;
}
.history-info {
  flex: 1;
}
.history-org {
  font-weight: 600;
}
.history-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.history-badge {
  padding: 0.2rem 0.65rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}
.history-badge--green {
  background: var(--rating-green-bg);
  color: var(--rating-green);
}
.history-badge--yellow {
  background: var(--rating-yellow-bg);
  color: var(--rating-yellow);
}
.history-badge--red {
  background: var(--rating-red-bg);
  color: var(--rating-red);
}

.history-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* === Notification Toast === */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ca-green);
  color: #fff;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.error {
  background-color: rgb(158, 0, 0);
}

/* === Responsive === */
@media (max-width: 768px) {
  .app-container {
    padding: 0.5rem;
  }
  .welcome-hero {
    padding: 2rem 1rem;
  }
  .welcome-hero h1,
  .welcome-hero h2,
  .welcome-hero .welcome-hero-title {
    font-size: 1.5rem;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .pillar-cards {
    grid-template-columns: 1fr;
  }
  .heatmap-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .tab-btn {
    font-size: 0.8rem;
    padding: 0.6rem 0.5rem;
  }
  .report-header {
    flex-direction: column;
    gap: 1rem;
  }
  .results-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .results-actions .btn {
    width: 100%;
  }
  .insights-grid {
    grid-template-columns: 1fr;
  }
  .exec-summary-score-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .exec-summary-pillars {
    margin-left: 0;
  }
  h1 {
    font-size: 1.5rem;
  }
  h2 {
    font-size: 1.25rem;
  }
  .answer-options {
    gap: 0.4rem;
  }
  .answer-option {
    padding: 0.5rem 0.7rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .heatmap-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
  }
  .heatmap-cell {
    padding: 0.65rem 0.5rem;
  }
  .heatmap-cell-name {
    font-size: 0.68rem;
  }
  .heatmap-cell-score {
    font-size: 1.1rem;
  }
  .tab-nav {
    flex-wrap: nowrap;
  }
  .accordion-meta {
    display: none;
  }
  .exec-pillar-chip {
    min-width: 80px;
    padding: 0.35rem 0.5rem;
  }
  .exec-pillar-score {
    font-size: 1rem;
  }
}

/* === Print Styles === */
@media print {
  body {
    background: #fff;
    font-size: 11pt;
  }
  .app-header,
  .tab-nav,
  .progress-container,
  .results-actions,
  .btn,
  .toast,
  .na-toggle,
  .screen:not(.active),
  #screen-welcome,
  #screen-org-details,
  #screen-questionnaire {
    display: none !important;
  }

  /* Keep buttons hidden in report view too */
  #screen-report .btn {
    display: none !important;
  }
  #screen-report > .card:first-child {
    display: none !important;
  }

  .screen.active {
    display: block !important;
  }
  .app-container {
    max-width: 100%;
    padding: 0;
  }
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }

  .results-overall {
    background: none !important;
    color: var(--text) !important;
    border: 2px solid var(--ca-green);
    padding: 1.5rem;
  }
  .results-overall .gauge-value {
    fill: var(--text) !important;
  }

  /* Report visual dashboard elements */
  .report-overall-score {
    page-break-after: avoid;
  }
  .report-section {
    page-break-inside: avoid;
    margin-bottom: 1rem;
  }
  .report-insights-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }

  /* Ensure SVG gauges print with colors */
  .gauge-chart circle,
  .gauge-progress {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .gauge-value {
    fill: currentColor !important;
  }

  /* Heatmap cells keep background colors */
  .heatmap-cell {
    border: 1px solid rgba(0, 0, 0, 0.1);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Pillar cards print with colors */
  .pillar-card {
    border: 1px solid var(--border);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .pillar-cards {
    display: flex !important;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Intervention card keeps border color */
  .intervention-card {
    border-width: 2px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Maturity badge prints with color */
  .maturity-badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Domain insight items */
  .domain-insight-list {
    list-style: none;
    padding: 0;
  }
  .domain-insight-rank {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Rating dots in tables */
  .rating-dot {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .exec-summary-banner {
    display: none !important;
  }
  .confirm-overlay {
    display: none !important;
  }
  .report-footer {
    position: fixed;
    bottom: 0;
    width: 100%;
  }

  a {
    color: var(--text) !important;
  }
}

/* === Executive Summary === */
.exec-summary-banner {
  margin-bottom: 1.5rem;
}
.exec-summary-card {
  background: var(--bg-card);
  border: 2px solid var(--ca-green);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}
.exec-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.exec-summary-header h2 {
  font-size: 1.15rem;
  color: var(--ca-green);
  margin: 0;
}
.exec-summary-org {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.exec-summary-score-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.exec-summary-score {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
}
.exec-summary-label {
  display: flex;
  flex-direction: column;
}
.exec-summary-rating {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.exec-summary-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.exec-summary-pillars {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.exec-pillar-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 90px;
}
.exec-pillar-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.exec-pillar-score {
  font-size: 1.2rem;
  font-weight: 800;
}
.exec-takeaways {
  list-style: none;
  padding: 0;
  margin: 0;
}
.exec-takeaways li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
  border-bottom: 1px solid var(--border-light);
}
.exec-takeaways li:last-child {
  border-bottom: none;
}
.exec-takeaways li::before {
  content: "→";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--ca-green);
}

/* === Insights Grid === */
.insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* === Confirm Dialog === */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.confirm-dialog {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  padding: 1.5rem;
  max-width: 420px;
  width: 90%;
}
.confirm-dialog p {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* === History Delete Button === */
.btn-delete-history {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  flex-shrink: 0;
  line-height: 1;
}
.btn-delete-history:hover {
  color: var(--rating-red);
  background: var(--rating-red-bg);
}

/* === Question Highlight Pulse === */
.highlight-pulse {
  animation: highlightPulse 2s ease;
}
@keyframes highlightPulse {
  0% {
    background: transparent;
  }
  15% {
    background: #fef9c3;
  }
  100% {
    background: transparent;
  }
}

/* === Accessibility === */
:focus-visible {
  outline: 2px solid var(--ca-green-bright);
  outline-offset: 2px;
}

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

/* =========================================
   Disclosure Framework Coverage Cards
   ========================================= */
.framework-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.framework-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--fw-color, var(--ca-green));
  border-radius: var(--radius);
  padding: 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.framework-card--green {
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.15) inset;
}
.framework-card--yellow {
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.18) inset;
}
.framework-card--red {
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.18) inset;
}

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

.framework-card-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.framework-card-publisher {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.2;
}

.framework-card-pct {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--fw-color, var(--ca-green));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.framework-card-pct span {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.framework-card-bar {
  height: 10px;
  border-radius: 999px;
  background: #f3f4f6;
  overflow: hidden;
  display: flex;
}
.framework-card-bar-seg {
  display: block;
  height: 100%;
}

.framework-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.framework-card-stats .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.dot-green {
  background: var(--rating-green);
}
.dot-yellow {
  background: var(--rating-yellow);
}
.dot-red {
  background: var(--rating-red);
}
.dot-na {
  background: #d1d5db;
}

.framework-card-verdict {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  text-align: center;
}
.framework-card-verdict--green {
  background: #dcfce7;
  color: #166534;
}
.framework-card-verdict--yellow {
  background: #fef9c3;
  color: #854d0e;
}
.framework-card-verdict--red {
  background: #fee2e2;
  color: #991b1b;
}

/* Small "what is this?" pill */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: help;
}
.pill-muted {
  background: #f3f4f6;
  color: var(--text-muted);
}
.pill-green {
  background: var(--rating-green-bg);
  color: var(--rating-green);
}
.pill-yellow {
  background: var(--rating-yellow-bg);
  color: var(--rating-yellow);
}
.pill-red {
  background: var(--rating-red-bg);
  color: var(--rating-red);
}
.pill-draft {
  background: #e0e7ff;
  color: #4338ca;
}

/* === Form textarea (used by per-domain notes) === */
.form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  background: #fff;
  resize: vertical;
  min-height: 90px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.form-textarea:focus {
  outline: none;
  border-color: var(--ca-green-light);
  box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.12);
}

/* === Portfolio screen === */
.portfolio-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.consultant-switcher {
  flex: 1 1 260px;
  min-width: 240px;
}
.consultant-switcher .form-label {
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.consultant-switcher-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.consultant-switcher-row .form-select {
  flex: 1 1 auto;
  min-width: 0;
}
.consultant-switcher-row .btn {
  white-space: nowrap;
}
.portfolio-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.portfolio-grid:empty {
  margin-bottom: 0;
}

.client-tile {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.15rem 1.25rem;
  cursor: pointer;
  border: 1px solid var(--border);
  border-left: 4px solid var(--ca-green);
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    border-color var(--transition);
  outline: none;
}
.client-tile:hover,
.client-tile:focus {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-left-color: var(--ca-gold);
}
.client-tile:focus-visible {
  box-shadow:
    0 0 0 3px rgba(234, 179, 8, 0.35),
    var(--shadow-lg);
}
.client-tile-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}
.client-tile-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin: 0;
}
.client-tile-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
}
.client-tile-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  background: var(--border-light);
  color: var(--text-muted);
  text-align: center;
}
.client-tile-pct {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.client-tile-maturity {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.15rem;
  opacity: 0.85;
}
.client-tile-score--green {
  background: var(--rating-green-bg);
  color: var(--rating-green);
}
.client-tile-score--yellow {
  background: var(--rating-yellow-bg);
  color: var(--rating-yellow);
}
.client-tile-score--red {
  background: var(--rating-red-bg);
  color: var(--rating-red);
}
.client-tile-score--draft {
  background: #e0e7ff;
  color: #4338ca;
}
.client-tile-score--empty {
  background: var(--border-light);
  color: var(--text-light);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 1.25rem 0.5rem;
}
.client-tile-score--empty .client-tile-pct,
.client-tile-score--empty .client-tile-maturity {
  display: none;
}
.client-tile-foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 0.6rem;
}

/* === Assessment list (client detail) === */
.assessment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.assessment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  transition:
    border-color var(--transition),
    background var(--transition);
  flex-wrap: wrap;
}
.assessment-row:hover {
  border-color: var(--ca-green-bright);
  background: var(--border-light);
}
.assessment-row-main {
  flex: 1 1 260px;
  min-width: 0;
}
.assessment-row-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.assessment-row-title em {
  color: var(--text-light);
  font-weight: 500;
}
.assessment-row-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.assessment-row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

/* === Per-domain field notes === */
.domain-notes {
  margin-top: 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  background: #fafbfc;
  transition:
    background var(--transition),
    border-color var(--transition);
}
.domain-notes[open] {
  background: #fdfcf5;
  border-color: var(--ca-gold);
  border-style: solid;
}
.domain-notes > summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
  user-select: none;
}
.domain-notes > summary::-webkit-details-marker {
  display: none;
}
.domain-notes > summary::before {
  content: "▸";
  font-size: 0.75rem;
  transition: transform var(--transition);
  color: var(--ca-green);
}
.domain-notes[open] > summary::before {
  transform: rotate(90deg);
}
.domain-notes[open] > summary {
  color: var(--ca-green);
}
.domain-notes-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  background: var(--ca-gold-light);
  color: var(--ca-green);
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
}
.domain-notes-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-light);
  background: #fff;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.domain-notes-badge:empty {
  display: none;
}
.domain-notes-input {
  margin-top: 0.65rem;
  background: #fff;
}
.domain-notes-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-light);
}
.char-count {
  font-variant-numeric: tabular-nums;
}
.char-count.near-limit {
  color: var(--rating-yellow);
  font-weight: 600;
}
.char-count.at-limit {
  color: var(--rating-red);
  font-weight: 700;
}
.saved-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 1em;
  font-weight: 500;
  transition: opacity 0.2s ease;
}
.saved-indicator--saving {
  color: var(--text-muted);
}
.saved-indicator--saved {
  color: var(--rating-green);
}
.saved-indicator--saved::before {
  content: "✓";
  font-weight: 700;
}

/* ✎ chip on the accordion summary when notes exist */
.notes-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  background: var(--ca-gold-light);
  color: var(--ca-green);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

/* === Takeover banner (device-sharing attribution) === */
.takeover-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #fef9c3, #fde68a);
  border: 1px solid var(--ca-gold);
  color: #78350f;
  font-size: 0.9rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.takeover-banner-text {
  flex: 1 1 260px;
}
.takeover-banner-text strong {
  color: #713f12;
}
.takeover-banner-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* === Confirm-dialog text-input mode (used by consultant prompts) === */
.confirm-input {
  margin-top: 1rem;
  width: 100%;
}

/* === Responsive overrides for new layouts === */
@media (max-width: 768px) {
  .portfolio-topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .portfolio-actions {
    justify-content: flex-start;
  }
  .portfolio-grid {
    grid-template-columns: 1fr;
  }
  .assessment-row {
    flex-direction: column;
    align-items: stretch;
  }
  .assessment-row-actions {
    justify-content: flex-start;
  }
  .takeover-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* === Print overrides for notes + takeover === */
@media print {
  .portfolio-topbar,
  .portfolio-actions,
  .portfolio-grid,
  #portfolio-feature-strip,
  .takeover-banner,
  .assessment-row-actions,
  .domain-notes > summary,
  .domain-notes-meta {
    display: none !important;
  }

  .domain-notes {
    border: none;
    background: transparent;
    padding: 0;
    margin-top: 0.25rem;
  }
  .domain-notes[open] {
    background: transparent;
    border: none;
  }
  .domain-notes-input {
    border: 1px solid #ddd;
    padding: 0.5rem;
    font-family: var(--font);
    font-size: 10pt;
    resize: none;
  }
  .domain-note-row td {
    background: #fafafa !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-size: 9.5pt;
    padding: 0.35rem 0.5rem;
  }
  .domain-note-row em {
    color: var(--ca-green) !important;
    font-weight: 600;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


/* ============================================================
   ADMIN PORTAL STYLES
   ============================================================ */

/* Body override for admin */
.admin-body {
  background: var(--bg);
  padding: 0;
  margin: 0;
}

/* ── Login ── */
.admin-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ca-green) 0%, var(--ca-green-light) 100%);
  padding: 1rem;
}
.admin-login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}
.admin-login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.admin-login-logo img {
  height: 52px;
  margin-bottom: .75rem;
}
.admin-login-logo h1 {
  font-size: 1.4rem;
  color: var(--ca-green);
}
.admin-login-logo p {
  font-size: .85rem;
  color: var(--text-muted);
  margin: 0;
}
.admin-login-error {
  color: var(--rating-red);
  font-size: .875rem;
  background: var(--rating-red-bg);
  padding: .5rem .75rem;
  border-radius: var(--radius-xs);
  margin-bottom: .5rem;
}

/* ── Top Nav ── */
.admin-nav {
  background: var(--ca-green);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}
.admin-nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.admin-nav-brand img {
  height: 30px;
  filter: brightness(0) invert(1);
}
.admin-nav-links {
  display: flex;
  gap: .25rem;
  flex: 1;
  justify-content: center;
}
.admin-nav-link {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.7);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 500;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.admin-nav-link:hover,
.admin-nav-link.active {
  background: rgba(255,255,255,.15);
  color: #fff;
}
#admin-logout {
  color: rgba(255,255,255,.8);
  flex-shrink: 0;
}
#admin-logout:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}

/* ── Content area ── */
.admin-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
.admin-page {
  display: none;
  animation: fadeIn .3s ease;
}
.admin-page.active {
  display: block;
}
.admin-page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
}
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-page-header .admin-page-title {
  margin-bottom: 0;
}

/* ── Stat cards ── */
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.admin-stat-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.admin-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ca-green);
  line-height: 1;
}
.admin-stat-sub {
  font-size: .8rem;
  color: var(--text-muted);
}

/* ── Dashboard row ── */
.admin-dash-row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

/* ── Tables ── */
.admin-table-wrap {
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.admin-table thead tr {
  background: var(--border-light);
}
.admin-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text);
}
.admin-table tbody tr:last-child td {
  border-bottom: none;
}
.admin-table tbody tr:hover td {
  background: var(--border-light);
}
.admin-table-actions {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.admin-table-actions .btn {
  padding: .3rem .7rem;
  font-size: .78rem;
}
.admin-table-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: .9rem;
}

/* ── Latest assessments list ── */
.admin-latest-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border-light);
}
.admin-latest-item:last-child { border-bottom: none; }
.admin-latest-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ca-green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.admin-latest-info { flex: 1; min-width: 0; }
.admin-latest-name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-latest-meta { font-size: .78rem; color: var(--text-muted); }

/* ── Modals ── */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn .2s ease;
}
.admin-modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.admin-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}
.admin-modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: .25rem .5rem;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}
.admin-modal-close:hover { background: var(--border-light); color: var(--text); }
.admin-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

/* ── Results modal content ── */
.admin-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.admin-results-pill {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem;
  text-align: center;
}
.admin-results-pill-label {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.admin-results-pill-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ca-green);
}
.admin-results-domain-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: .85rem;
}
.admin-results-domain-row:last-child { border-bottom: none; }
.admin-results-domain-name { flex: 1; }
.admin-results-domain-bar-wrap { width: 80px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.admin-results-domain-bar { height: 100%; border-radius: 3px; background: var(--ca-green-bright); }

/* ── Access list (user modal) ── */
.admin-access-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.admin-access-list label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  cursor: pointer;
  padding: .25rem .4rem;
  border-radius: var(--radius-xs);
}
.admin-access-list label:hover { background: var(--border-light); }

/* ── Role badge ── */
.admin-role-badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.admin-role-admin { background: #dcfce7; color: #166534; }
.admin-role-viewer { background: #e0f2fe; color: #075985; }

/* Responsive */
@media (max-width: 768px) {
  /* Nav */
  .admin-nav { padding: .6rem 1rem; gap: .5rem; flex-wrap: wrap; }
  .admin-nav-brand span { display: none; }
  .admin-nav-links { order: 3; width: 100%; justify-content: center; gap: 0; border-top: 1px solid rgba(255,255,255,.15); padding-top: .5rem; margin-top: .25rem; }
  .admin-nav-link { padding: .45rem .7rem; font-size: .82rem; flex: 1; text-align: center; }
  #admin-logout { margin-left: auto; }

  /* Content */
  .admin-content { padding: 1rem .75rem; }
  .admin-page-title { font-size: 1.2rem; }
  .admin-page-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .admin-page-header input[type="search"] { max-width: 100% !important; width: 100%; }

  /* Stat cards — 2 columns on tablet */
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* Dashboard row stack */
  .admin-dash-row { flex-direction: column; }

  /* Tables — hide less critical columns, allow horizontal scroll */
  .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table { min-width: 540px; }

  /* Modals */
  .admin-modal { max-width: 100%; margin: 0; border-radius: var(--radius) var(--radius) 0 0; align-self: flex-end; max-height: 92vh; }
  .admin-modal-overlay { align-items: flex-end; padding: 0; }

  /* Login */
  .admin-login-card { padding: 2rem 1.25rem; }
}

@media (max-width: 480px) {
  /* Stat cards — single column on small phones */
  .admin-stat-grid { grid-template-columns: 1fr 1fr; }
  .admin-stat-value { font-size: 1.6rem; }

  /* Nav links — icon-size */
  .admin-nav-link { font-size: .78rem; padding: .4rem .5rem; }

  /* Table action buttons stack */
  .admin-table-actions { flex-direction: column; gap: .25rem; }
  .admin-table-actions .btn { width: 100%; justify-content: center; }

  /* Results grid 2-col */
  .admin-results-grid { grid-template-columns: repeat(2, 1fr); }
}
