:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
  --bg: #141b25;
  --surface: #1b2531;
  --surface-strong: #223040;
  --text: #f4f8fc;
  --muted: #a9b8c7;
  --line: #314154;
  --accent: #0099ff;
  --accent-strong: #5bbdff;
  --danger: #ff8a80;
  --shadow: 0 20px 58px rgba(3, 8, 14, 0.34);
  --soft-shadow: 0 10px 28px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef5fb;
  --surface: #ffffff;
  --surface-strong: #e8f1f8;
  --text: #15212c;
  --muted: #627184;
  --line: #cddceb;
  --accent: #0099ff;
  --accent-strong: #0074c2;
  --danger: #b5362f;
  --shadow: 0 20px 58px rgba(20, 47, 70, 0.13);
  --soft-shadow: 0 10px 24px rgba(20, 47, 70, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(0, 153, 255, 0.15), transparent 34rem),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 88px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  overflow: hidden;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand.large {
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0099ff, #66c5ff);
  color: #000000;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(0, 153, 255, 0.3);
}

.brand-mark .ico {
  display: grid;
  place-items: center;
  color: #000000;
}

.brand-mark .ico svg {
  width: 24px;
  height: 24px;
  stroke: #000000;
}

.brand-text {
  min-width: 0;
}

.brand strong {
  display: block;
  line-height: 1.2;
  white-space: nowrap;
}

.brand span,
.muted {
  color: var(--muted);
}

.collapse-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: var(--soft-shadow);
}

.collapse-button .ico svg {
  width: 18px;
  height: 18px;
}

.sidebar-collapsed .sidebar {
  padding-inline: 16px;
}

.sidebar-collapsed .brand-row {
  justify-content: center;
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-text {
  display: none;
}

.sidebar-collapsed .brand {
  justify-content: center;
}

.sidebar-collapsed .collapse-button {
  position: absolute;
  top: 74px;
  left: 25px;
}

.sidebar-collapsed .nav-list {
  margin-top: 44px;
}

.sidebar-collapsed .nav-list button,
.sidebar-collapsed .icon-button {
  justify-content: center;
  padding-inline: 0;
}

.nav-list,
.sidebar-footer,
.form-stack {
  display: grid;
  gap: 12px;
}

.nav-list button,
.icon-button,
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.nav-list button {
  justify-content: flex-start;
  padding: 0 14px;
}

.nav-list .ico,
.icon-button .ico {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  color: #06131f;
  background: var(--accent);
  font-weight: 900;
}

.ico svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-list button.active {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, var(--surface)), var(--surface));
}

.sidebar-footer {
  margin-top: auto;
}

.language-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.language-switch button {
  display: grid;
  place-items: center;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.language-switch button.active {
  color: #06131f;
  background: var(--accent);
}

.sidebar-collapsed .language-switch {
  grid-template-columns: 1fr;
}

.flag-icon {
  display: block;
  width: 30px;
  height: 20px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.wide {
  width: 100%;
}

.main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.topbar,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-head.compact {
  margin-bottom: 14px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.5rem;
}

h3 {
  font-size: 1.13rem;
  line-height: 1.45;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.login-page {
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel,
.panel,
.question-card,
.test-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, white 4%), var(--surface));
  box-shadow: var(--soft-shadow);
}

.login-panel {
  width: min(440px, 100%);
  padding: 28px;
}

.login-tools {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.theme-float {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
}

.login-language {
  min-width: 126px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-strong);
}

.primary-button {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--line));
  background: var(--accent);
  color: #07130f;
  font-weight: 800;
}

.secondary-button {
  padding: 0 14px;
  background: var(--surface-strong);
}

.alert {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 60%, var(--line));
  border-radius: 8px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.hidden {
  display: none;
}

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

.test-card {
  display: grid;
  gap: 12px;
  min-height: 230px;
  padding: 24px;
  text-align: left;
  color: var(--text);
}

.test-card .ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #06131f;
  background: var(--accent);
  font-size: 1.25rem;
  font-weight: 900;
}

.test-card .ico svg {
  width: 22px;
  height: 22px;
}

.test-card span {
  font-size: 1.25rem;
  font-weight: 800;
}

.test-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.assessment,
.result-layout {
  display: grid;
  gap: 18px;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

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

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

.question-card,
.panel {
  padding: 20px;
}

.question-card h3 {
  margin-bottom: 16px;
}

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

.answer {
  position: relative;
  min-height: 72px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 88%, white 4%), var(--surface-strong));
  font-weight: 600;
  box-shadow: var(--soft-shadow);
}

.answer input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.answer.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 16px 0;
  background: linear-gradient(transparent, var(--bg) 22%);
}

.chart-panel {
  min-height: 360px;
}

.css-chart {
  display: grid;
  align-content: center;
  gap: 18px;
}

.bar-line {
  display: grid;
  grid-template-columns: minmax(118px, 190px) minmax(90px, 1fr) 40px;
  gap: 12px;
  align-items: center;
}

.bar-line span {
  color: var(--muted);
  font-weight: 800;
}

.bar-track {
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.summary-panel p {
  margin: 0;
  max-width: 78ch;
  color: var(--text);
  line-height: 1.8;
  font-size: 1.03rem;
}

.summary-panel p:last-child {
  margin-bottom: 0;
}

.summary-panel strong {
  color: var(--accent-strong);
  font-weight: 900;
}

.recommendations {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.recommendation-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.recommendation-item p {
  margin: 6px 0 0;
  color: var(--text);
  line-height: 1.55;
}

.inline-select {
  min-width: 240px;
}

.team-member-list {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.member-detail {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.member-detail summary {
  cursor: pointer;
  font-weight: 900;
}

.comparison-form {
  display: grid;
  gap: 10px;
}

.check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.check-row input {
  width: auto;
  min-height: auto;
}

.csv-textarea {
  width: 100%;
  min-height: 520px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-strong);
  font: 0.92rem Consolas, "Courier New", monospace;
  line-height: 1.45;
  resize: vertical;
}

.team-dashboard,
.comparison-page,
.csv-editor {
  display: grid;
  gap: 18px;
}

.summary-section {
  padding-block: 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.summary-section:first-of-type {
  padding-top: 8px;
}

.summary-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.summary-section h3 {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 1rem;
}

.trait-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  color: var(--muted);
  font-weight: 900;
  outline: none;
}

.trait-label::after {
  content: "i";
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  color: #06131f;
  background: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
}

.trait-tip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 10;
  display: none;
  width: min(320px, 78vw);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  line-height: 1.45;
  font-weight: 600;
}

.trait-tip strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-strong);
}

.trait-label:hover .trait-tip,
.trait-label:focus .trait-tip {
  display: block;
}

.framework-page {
  display: grid;
  gap: 18px;
}

.framework-copy {
  display: grid;
  gap: 14px;
}

.framework-copy p,
.trait-card p {
  margin: 0;
  line-height: 1.7;
  color: var(--text);
}

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

.trait-card {
  display: grid;
  gap: 8px;
}

.trait-card h3 {
  margin: 0;
}

.trait-code {
  display: inline-flex;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  color: #06131f;
  background: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: auto;
  padding: 32px 12px 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer i::before {
  content: "🧠";
}

.site-footer img {
  display: block;
  width: 96px;
  max-height: 28px;
  object-fit: contain;
}

.history-layout,
.admin-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.user-results-layout {
  grid-template-columns: 320px minmax(0, 1fr);
}

.user-result-detail {
  display: grid;
  gap: 18px;
}

.framework-average-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.aggregate-card {
  display: grid;
  gap: 18px;
}

.aggregate-card h3 {
  margin: 0;
}

.mini-chart {
  display: grid;
  gap: 12px;
}

.compact-bar {
  grid-template-columns: minmax(112px, 150px) minmax(90px, 1fr) 48px;
}

.aggregate-summary {
  padding-top: 4px;
}

.test-history-panel {
  display: grid;
  gap: 12px;
}

.test-entry-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.test-entry {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-align: left;
  background: var(--surface-strong);
  box-shadow: var(--soft-shadow);
}

.test-entry span {
  color: var(--muted);
  font-size: 0.9rem;
}

.test-entry.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-strong));
}

.list-panel {
  display: grid;
  gap: 10px;
}

.result-row {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  color: var(--text);
  background: var(--surface-strong);
}

.result-row span,
.result-row small,
.user-row span {
  color: var(--muted);
}

.result-row.active {
  border-color: var(--accent);
}

.user-table {
  display: grid;
  gap: 12px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(280px, 1.4fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.user-row strong,
.user-row span {
  display: block;
}

.user-actions {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 10px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.segmented button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.segmented button.active {
  color: #07130f;
  background: var(--accent);
}

.admin-answer-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-answer {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.admin-answer strong {
  color: var(--accent-strong);
}

.admin-answer span {
  color: var(--text);
  line-height: 1.45;
}

@media (max-width: 860px) {
  .app-shell,
  .history-layout,
  .admin-grid,
  .framework-average-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    z-index: 5;
    gap: 14px;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .brand-row {
    align-items: flex-start;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-footer {
    grid-template-columns: repeat(2, 1fr);
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar-collapsed .brand-text,
  .sidebar-collapsed .nav-text {
    display: block;
  }

  .sidebar-collapsed .collapse-button {
    position: static;
  }

  .sidebar-collapsed .nav-list,
  .sidebar-collapsed .sidebar-footer {
    display: none;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .content-grid.two,
  .answer-grid,
  .admin-answer-list,
  .trait-grid,
  .test-entry-list {
    grid-template-columns: 1fr;
  }

  .nav-list,
  .sidebar-footer,
  .user-row,
  .user-actions,
  .bar-line,
  .admin-answer {
    grid-template-columns: 1fr;
  }
}
