body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
  margin: 0;
  padding: 0;
}

.stats-page {
  background: linear-gradient(180deg, #e0e7ff 0%, #f8fafc 55%, #fff 100%);
  min-height: 100vh;
}

.page {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 20px 40px;
}

.stats-page .page {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

.stats-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
  border-radius: 28px;
  background: linear-gradient(125deg, #1d4ed8, #3b82f6);
  color: #fff;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
  margin-bottom: 32px;
}

.stats-hero-info {
  flex: 1 1 320px;
}

.stats-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  margin: 0 0 6px;
}

.stats-hero h1 {
  margin: 0;
  font-size: 30px;
  color: #fff;
}

.stats-subtitle {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
}

.stats-hero-actions {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 1 1 260px;
}

.page h1 {
  font-size: 28px;
  margin-bottom: 8px;
  color: #0f172a;
}

.page > p {
  color: #475569;
  line-height: 1.6;
  margin-bottom: 24px;
}

.section-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  margin-bottom: 28px;
}

.stats-panel {
  padding: 24px 28px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
}

.section-card h2 {
  margin-top: 0;
  font-size: 22px;
  color: #0f172a;
}

.field-list {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-weight: 600;
  color: #0f172a;
}

.field input[type="text"],
.field input[type="date"],
.field select {
  border: 1px solid #d4d8e3;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  transition: border-color 0.2s ease;
}

.field input[type="text"]:focus,
.field select:focus {
  border-color: #2563eb;
  outline: none;
}

.options-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: 8px 0 0;
}

.options-list label {
  font-weight: 500;
  color: #1f2937;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

table,
.stats-table {
  width: 100%;
  border-spacing: 0;
  border-collapse: collapse;
  margin-top: 16px;
}

table thead th {
  background: #e0e7ff;
  color: #1e1b4b;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.05em;
}

table th,
table td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.stats-table.condensed th,
.stats-table.condensed td {
  padding: 12px 14px;
  font-size: 14px;
  border-right: 1px solid #cbd5f5;
}

.stats-table.condensed td details {
  margin-top: 0;
}

.stats-table.condensed th:last-child,
.stats-table.condensed td:last-child {
  border-right: none;
}

.stats-table.condensed {
  border: 1px solid #cbd5f5;
  border-radius: 10px;
  overflow: hidden;
}

.stats-table.condensed tbody td {
  min-width: 90px;
}

.table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.stats-summary {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  margin-bottom: 16px;
}

.stat-total {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: #cbd5f5;
}

.stat-total strong {
  font-size: 34px;
  color: #fff;
  line-height: 1;
}

.stats-page .stats-panel .stat-total {
  color: #475569;
}

.stats-page .stats-panel .stat-total strong {
  color: #0f172a;
  font-size: 30px;
}

.stats-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stats-panel-head {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 12px;
}

.stats-panel-head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-group-label {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
  color: #0f172a;
}

.stats-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #312e81;
  font-size: 13px;
  font-weight: 600;
}

.stats-empty {
  padding: 20px;
  border: 1px dashed #cbd5f5;
  border-radius: 14px;
  background: #f8fafc;
  color: #475569;
}

.respondent-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.respondent-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  padding: 16px 20px;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
}

.respondent-index {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #1d4ed8;
  font-size: 14px;
}

.respondent-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.respondent-name {
  margin: 0;
  font-size: 16px;
  color: #0f172a;
}

.respondent-position {
  margin: 0;
  font-size: 14px;
  color: #475569;
}

.respondent-time {
  text-align: right;
  font-size: 13px;
  color: #475569;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 130px;
  gap: 4px;
}

.respondent-time strong {
  font-size: 15px;
  color: #0f172a;
}

.view-details-btn {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #2563eb;
  background: #fff;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.view-details-btn:hover {
  background: #2563eb;
  color: #fff;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid #2563eb;
  text-decoration: none;
  font-weight: 600;
  background: #2563eb;
  color: #fff;
}

.export-btn:hover {
  background: #2563eb;
  color: #fff;
}

.criteria-radio {
  display: grid;
  grid-template-columns: repeat(5, minmax(46px, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.criteria-radio label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid #dbe2f1;
  border-radius: 10px;
  background: #f8fafc;
  font-weight: 500;
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 35px rgba(37, 99, 235, 0.45);
}

.stats-table small {
  display: block;
  color: #475569;
  font-weight: 400;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: 13px;
  margin-left: 6px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.summary-card {
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
}

.summary-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #0f172a;
}

.summary-card p {
  margin: 0 0 12px;
  color: #475569;
  min-height: 44px;
}

.summary-metrics {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 12px;
}

.summary-metrics span:last-child {
  font-weight: 600;
}

.progress-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-expected,
.progress-current {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: inherit;
}

.progress-expected {
  background: rgba(59, 130, 246, 0.5);
  z-index: 1;
}

.progress-current {
  background: #2563eb;
  z-index: 2;
  opacity: 0.85;
}

.gap-indicator {
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.gap-positive {
  color: #dc2626;
}

.gap-negative {
  color: #16a34a;
}

.respondent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.respondent-card {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.respondent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.respondent-header h3 {
  margin: 0;
  font-size: 18px;
  color: #0f172a;
}

.respondent-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: #475569;
}

details {
  margin-top: 12px;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  color: #2563eb;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.modal-hidden {
  display: none;
}

.modal-card {
  background: #fff;
  border-radius: 18px;
  width: min(960px, 100%);
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.3);
  position: relative;
  display: flex;
  flex-direction: column;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #475569;
  padding: 6px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 8px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
  margin: 4px 0;
  color: #0f172a;
}

.modal-subtitle {
  margin: 4px 0 0;
  color: #475569;
}

.modal-meta {
  display: grid;
  gap: 6px;
  align-content: center;
  color: #475569;
}

.modal-meta-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.modal-body {
  padding: 16px 24px 24px;
  overflow: auto;
}

.respondent-table-wrapper {
  margin-top: 12px;
  max-height: 280px;
  overflow: auto;
}

.answer-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.answer-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  display: grid;
  gap: 10px;
}

.answer-title {
  color: #0f172a;
  font-size: 14px;
}

.answer-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.answer-pill {
  border: 1px solid #cbd5f5;
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #475569;
}

.answer-pill strong {
  color: #0f172a;
  font-size: 16px;
}

.answer-pill-current {
  background: #e0f2fe;
  border-color: #bae6fd;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
}

.mini-table th,
.mini-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 8px;
  font-size: 13px;
}

.mini-table th {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #475569;
}

@media (max-width: 768px) {
  .stats-hero {
    padding: 24px;
  }

  .stats-hero h1 {
    font-size: 24px;
  }

  .stats-hero-actions {
    width: 100%;
    justify-content: space-between;
  }

  .options-list {
    flex-direction: column;
  }

  table thead {
    display: none;
  }

  table tr {
    display: block;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
  }

  table td {
    display: flex;
    justify-content: space-between;
    border: none;
    padding: 8px 0;
  }

  table td::before {
    content: attr(data-label);
    font-weight: 600;
    margin-right: 12px;
    color: #475569;
  }

  .respondent-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .respondent-index {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .respondent-time {
    text-align: left;
    min-width: auto;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .page {
    margin: 12px auto 28px;
    padding: 0 16px 32px;
  }

  .stats-page .page {
    padding: 32px 16px 40px;
  }

  .stats-hero {
    padding: 20px;
    border-radius: 22px;
  }

  .stats-hero-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page h1 {
    font-size: 22px;
    line-height: 1.35;
    margin-bottom: 6px;
  }

  .page > p {
    font-size: 14px;
    margin-bottom: 18px;
    line-height: 1.5;
  }

  .section-card {
    padding: 18px 16px;
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  }

  .section-card h2 {
    font-size: 18px;
    margin-bottom: 12px;
  }

  .field-list {
    gap: 12px;
  }

  .field {
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
  }

  .field label {
    font-size: 14px;
  }

  .field input[type="text"],
  .field input[type="date"],
  .field select {
    font-size: 14px;
    padding: 8px 10px;
  }

  .options-list {
    gap: 8px;
    margin-top: 4px;
  }

  .options-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dce3f3;
    border-radius: 10px;
    background: #fff;
  }

  .options-list input[type="radio"] {
    margin: 0;
  }

  .options-list label input[type="text"] {
    flex: 1 1 140px;
    min-width: 140px;
  }

  table tr {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    margin-bottom: 14px;
    padding: 12px 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  }

  table td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 6px 0;
  }

  table td::before {
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.03em;
    color: #94a3b8;
  }

  .criteria-radio {
    grid-template-columns: repeat(5, minmax(40px, 1fr));
  }

  .criteria-radio label {
    font-size: 14px;
    padding: 6px;
  }

  .submit-btn {
    width: 100%;
    margin-top: 8px;
  }
}
