:root {
  --ink: #000000;
  --muted: #65717d;
  --line: #e7e6e6;
  --soft: #f6f8f8;
  --surface: #ffffff;
  --deep-blue: #006a91;
  --blue: #0086ac;
  --teal: #51c3ca;
  --mint: #d9f4f5;
  --lime: #83c94b;
  --yellow: #f9b401;
  --orange: #ff9f1c;
  --red: #e53921;
  --green: #06b65f;
  --warm-white: #fffdf5;
  --gray: #a6a6a6;
  --shadow: 0 18px 44px rgba(0, 106, 145, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(81, 195, 202, 0.09), rgba(255, 255, 255, 0) 260px),
    var(--soft);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid rgba(231, 230, 230, 0.9);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
}

.brand-lockup,
.client-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-lockup img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand-lockup strong,
.client-brand span:last-child {
  display: block;
  font-size: 18px;
  font-weight: 900;
}

.brand-lockup small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.top-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.session-actions {
  display: flex;
  justify-content: end;
  gap: 8px;
}

.nav-button,
.ghost-button,
.secondary-button,
.primary-button,
.dark-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 800;
}

.nav-button {
  background: transparent;
  color: var(--muted);
}

.nav-button.is-active {
  background: var(--deep-blue);
  color: #fff;
}

.primary-button {
  background: var(--deep-blue);
  color: #fff;
}

.secondary-button {
  background: var(--yellow);
  color: var(--ink);
}

.ghost-button {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

.dark-button {
  background: var(--deep-blue);
  color: #fff;
}

.toast {
  position: fixed;
  right: clamp(16px, 4vw, 44px);
  top: 78px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-weight: 700;
  line-height: 1.35;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(120deg, rgba(0, 106, 145, 0.94), rgba(81, 195, 202, 0.74)),
    var(--deep-blue);
}

.login-panel {
  display: grid;
  gap: 18px;
  width: min(480px, 100%);
  padding: clamp(26px, 5vw, 44px);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.24);
}

.login-panel img {
  width: min(240px, 70%);
  height: auto;
}

.login-panel h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 5vw, 44px);
}

.login-error {
  margin: 0;
  color: #b00020;
  font-weight: 800;
}

.public-report-mode .app-header {
  display: none;
}

.public-report-mode main {
  padding-top: 0;
}

.public-report-mode .view:not(#clientView) {
  display: none !important;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

main {
  padding: 24px clamp(16px, 4vw, 44px) 56px;
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
  gap: 20px;
}

.workspace-band,
.client-report {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.intro-band,
.library-layout,
.country-filter,
.detection-panel,
.participant-layout,
.client-insight,
.client-general,
.client-topics,
.method-note {
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: clamp(28px, 5vw, 54px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 21px;
  line-height: 1.18;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.library-layout,
.country-filter,
.detection-panel,
.participant-layout,
.client-insight,
.client-general,
.client-topics,
.method-note {
  padding: 28px;
}

.section-heading {
  margin-bottom: 18px;
}

.country-filter {
  display: grid;
  grid-template-columns: minmax(220px, 320px);
}

.report-list {
  display: grid;
  gap: 14px;
}

.report-card,
.empty-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-card h3,
.report-card p {
  margin-bottom: 4px;
}

.report-card-metrics {
  display: grid;
  gap: 4px;
  text-align: right;
}

.report-card-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-card-metrics strong {
  font-size: 26px;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.import-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
  gap: 20px;
}

.file-drop,
.metadata-panel {
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.file-drop {
  display: grid;
  min-height: 290px;
  align-content: center;
  gap: 8px;
  padding: 28px;
  border: 1px dashed #aab6c0;
  cursor: pointer;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.file-title {
  font-size: 28px;
  font-weight: 900;
}

.file-help {
  color: var(--muted);
  line-height: 1.45;
}

.metadata-panel {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-row label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

.participant-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.45fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.users-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.45fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.users-list {
  display: grid;
  gap: 12px;
}

.user-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-card h3,
.user-card p {
  margin-bottom: 4px;
}

.user-card > strong {
  color: var(--deep-blue);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-weight: 800;
}

.participant-tools {
  display: grid;
  gap: 14px;
}

.participant-list {
  display: grid;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.participant-button {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  text-align: left;
  font-weight: 800;
}

.participant-button:hover {
  border-color: var(--teal);
  background: rgba(81, 195, 202, 0.09);
}

.participant-empty {
  padding: 12px;
  border-radius: 8px;
  background: rgba(81, 195, 202, 0.1);
}

.participant-detail {
  display: grid;
  gap: 14px;
}

.participant-profile,
.participant-answer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.participant-profile {
  padding: 20px;
}

.participant-profile h2,
.participant-profile p {
  margin-bottom: 4px;
}

.participant-answers {
  display: grid;
  gap: 12px;
}

.participant-answer {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.participant-answer h3 {
  margin-bottom: 0;
  color: var(--deep-blue);
}

.participant-scores {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 10px;
}

.participant-scores span {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(81, 195, 202, 0.1);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.participant-scores strong {
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
}

.question-list {
  display: grid;
  gap: 12px;
}

.question-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.question-item span {
  color: var(--muted);
  line-height: 1.45;
}

.client-report {
  display: grid;
  gap: 18px;
}

.client-cover {
  position: relative;
  overflow: hidden;
  min-height: 470px;
  padding: clamp(32px, 6vw, 72px);
  border-radius: 8px;
  background:
    linear-gradient(110deg, rgba(0, 106, 145, 0.96) 0%, rgba(0, 134, 172, 0.9) 44%, rgba(81, 195, 202, 0.82) 100%),
    var(--deep-blue);
  color: #fff;
}

.client-cover::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -120px;
  width: 360px;
  height: 360px;
  border: 46px solid rgba(249, 180, 1, 0.72);
  border-radius: 50%;
}

.client-cover::before {
  content: "";
  position: absolute;
  left: -120px;
  top: -160px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: rgba(255, 253, 245, 0.14);
}

.client-cover .eyebrow,
.client-cover p,
.client-cover h1 {
  position: relative;
  z-index: 1;
  color: #fff;
}

.client-cover-label {
  display: none;
}

.client-cover h1 {
  margin-top: 92px;
  max-width: 780px;
  font-size: clamp(40px, 6vw, 74px);
}

.client-brand {
  position: relative;
  z-index: 1;
  color: #fff;
}

.client-brand img {
  width: min(360px, 66vw);
  height: auto;
  object-fit: contain;
}

.client-summary,
.history-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.client-summary article,
.kpi-card {
  min-height: 116px;
  padding: 20px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.client-summary span,
.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.client-summary strong,
.kpi-card strong {
  display: block;
  margin-top: 12px;
  font-size: 38px;
}

.client-insight {
  border-left: 8px solid var(--yellow);
}

.client-general {
  background:
    linear-gradient(90deg, rgba(81, 195, 202, 0.14), rgba(255, 255, 255, 0) 56%),
    #fff;
}

.general-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
}

.general-meter {
  display: grid;
  min-height: 180px;
  place-items: center;
  align-content: center;
  border-radius: 8px;
  background: var(--deep-blue);
  color: #fff;
  text-align: center;
}

.general-meter span {
  display: block;
  font-size: 58px;
  font-weight: 900;
  line-height: 1;
}

.general-meter small {
  max-width: 150px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
  line-height: 1.25;
}

.general-copy h3 {
  font-size: clamp(24px, 3vw, 36px);
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.method-note {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.25fr);
  gap: 26px;
  align-items: start;
  border-top: 8px solid var(--teal);
}

.topic-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.topic-card h3 {
  margin-bottom: 0;
}

.topic-change {
  margin: 8px 0 0;
  color: var(--deep-blue);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}

.topic-summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}

.topic-summary strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.legend span,
.composition-row span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.level-dot,
.legend i {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.level-5 {
  background: var(--deep-blue);
}

.level-4 {
  background: var(--teal);
}

.level-3 {
  background: var(--yellow);
}

.level-2 {
  background: var(--gray);
}

.level-1 {
  background: #000000;
}

.composition-chart {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) 30px minmax(96px, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 276px;
}

.stacked-bar-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.stacked-bar-wrap strong {
  font-size: 14px;
}

.stacked-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: min(118px, 100%);
  height: 230px;
  overflow: hidden;
  border: 1px solid rgba(23, 33, 43, 0.12);
  border-radius: 8px 8px 4px 4px;
  background: #f5f8f9;
}

.stack-segment {
  display: grid;
  min-height: 0;
  place-items: center;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.stack-segment.level-1,
.stack-segment.level-5,
.stack-segment.level-2 {
  color: #fff;
}

.shift-arrow {
  display: grid;
  width: 36px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: var(--deep-blue);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.composition-table {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.composition-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px 52px;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.composition-row span:first-child {
  overflow-wrap: anywhere;
}

.composition-row strong {
  color: var(--ink);
  text-align: right;
}

.composition-head {
  background: #f7fafb;
  font-weight: 900;
  text-transform: uppercase;
}

.instrument-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(81, 195, 202, 0.1);
}

.instrument-box .eyebrow {
  margin-bottom: 0;
}

.instrument-box div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.instrument-box strong {
  color: var(--deep-blue);
  font-size: 12px;
  text-transform: uppercase;
}

.instrument-box span {
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 980px) {
  .app-header,
  .intro-band,
  .import-grid,
  .participant-layout,
  .users-layout {
    grid-template-columns: 1fr;
  }

  .top-nav {
    justify-content: start;
    overflow-x: auto;
  }

  .session-actions {
    justify-content: start;
  }

  .report-card {
    grid-template-columns: 1fr;
  }

  .report-card-metrics {
    text-align: left;
  }

  .client-summary,
  .history-grid,
  .topic-grid,
  .general-layout,
  .method-note {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  main {
    padding-inline: 12px;
  }

  .client-summary,
  .history-grid,
  .topic-grid,
  .general-layout,
  .method-note {
    grid-template-columns: 1fr;
  }

  .client-cover {
    min-height: 360px;
  }

  .client-cover h1 {
    margin-top: 58px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-header,
  .view:not(#clientView) {
    display: none !important;
  }

  main {
    padding: 0;
  }

  #clientView {
    display: block !important;
  }

  .client-report {
    width: 100%;
  }

  .client-cover,
  .client-summary article,
  .client-insight,
  .client-general,
  .client-topics,
  .method-note,
  .topic-card {
    box-shadow: none;
    break-inside: avoid;
  }

  .client-cover {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .topic-grid {
    grid-template-columns: 1fr;
  }
}
