:root {
  --bg: #0b0e13;
  --panel: #0f1522;
  --card: #121a2a;
  --text: #e8eefc;
  --muted: #a8b3cc;
  --accent: #6aa6ff;
  --accent2: #8bffcf;
  --border: #22304a;
  --shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

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

.login-card {
  width: min(460px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.login-copy {
  display: grid;
  gap: 8px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-btn {
  justify-content: center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 21, 34, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: grid;
  gap: 8px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: .2px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 0 4px rgba(106, 166, 255, .15);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.crumb {
  color: var(--text);
}

.crumb-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
  transition: color .15s ease, opacity .15s ease;
}

.crumb-btn:hover {
  color: var(--accent);
}

.crumb-btn:disabled {
  cursor: default;
  opacity: .7;
}

.crumb.muted {
  color: var(--muted);
}

.crumb-sep {
  color: rgba(168, 179, 204, .35);
}

.main {
  padding: 18px;
}

h1 {
  margin: 0;
  font-size: 22px;
}

h2 {
  margin: 0;
  font-size: 16px;
}

p {
  margin: 6px 0 0 0;
}

.small {
  font-size: 12.5px;
}

.muted {
  color: var(--muted);
}

.page {
  display: grid;
  gap: 14px;
}

.hidden {
  display: none !important;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(106, 166, 255, .28);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(106, 166, 255, .12), rgba(139, 255, 207, .06));
  box-shadow: 0 10px 24px rgba(4, 10, 24, .26), inset 0 1px 0 rgba(255, 255, 255, .04);
}

.dashboard-actions {
  justify-content: flex-end;
}

.layout-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 980px) {
  .layout-2 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}

.card-head {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(34, 48, 74, .55);
  margin-bottom: 12px;
}

.filter-panel {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

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

.filter-field {
  display: grid;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
}

.filter-field input,
.filter-field select {
  border: 1px solid rgba(34, 48, 74, .85);
  border-radius: 10px;
  background: rgba(7, 10, 20, .35);
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  width: 100%;
  min-width: 0;
}

.text-area-input {
  border: 1px solid rgba(34, 48, 74, .85);
  border-radius: 10px;
  background: rgba(7, 10, 20, .35);
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.filter-field input::placeholder {
  color: rgba(159, 169, 195, .7);
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.card-foot {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(34, 48, 74, .55);
}

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

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

.dashboard-tests-card {
  display: flex;
  flex-direction: column;
}

#testsList {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 55vh;
  overflow: auto;
  padding-right: 4px;
}

.list-item {
  border: 1px solid rgba(34, 48, 74, .85);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  display: grid;
  gap: 8px;
  transition: border-color .15s ease, transform .05s ease;
}

.list-item:hover {
  border-color: rgba(106, 166, 255, .8);
}

.list-item:active {
  transform: translateY(1px);
}

.list-item.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(106, 166, 255, .10);
}

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

.title {
  font-weight: 700;
}

.pill {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(34, 48, 74, .9);
  color: var(--muted);
}

.actions {
  justify-content: flex-end;
  margin-top: 2px;
}

.hint {
  margin-top: 12px;
  border: 1px dashed rgba(34, 48, 74, .85);
  border-radius: 14px;
  padding: 12px;
}

.hint-title {
  font-weight: 700;
  margin-bottom: 4px;
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid rgba(106, 166, 255, .55);
  background: rgba(106, 166, 255, .12);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
  transition: filter .15s ease, transform .05s ease, border-color .15s ease;
}

.btn:hover {
  filter: brightness(1.05);
  border-color: rgba(106, 166, 255, .85);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .45;
  filter: none;
}

.btn-ghost {
  border: 1px solid rgba(34, 48, 74, .9);
  background: transparent;
  color: var(--text);
}

.btn-ghost:hover {
  border-color: rgba(106, 166, 255, .65);
}

.btn-danger {
  border-color: rgba(255, 107, 107, .65);
  background: rgba(255, 107, 107, .16);
}

.btn-danger:hover {
  border-color: rgba(255, 107, 107, .92);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(34, 48, 74, .9);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover {
  border-color: rgba(106, 166, 255, .65);
}

/* Upload chip */
.upload-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(34, 48, 74, .9);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

.upload-chip input {
  display: none;
}

.upload-chip:hover {
  border-color: rgba(106, 166, 255, .65);
}

/* Metrics */
.metrics {
  display: grid;
  gap: 10px;
}

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

@media (max-width: 720px) {
  .group-stats-grid {
    grid-template-columns: 1fr;
  }
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.metric {
  border: 1px solid rgba(34, 48, 74, .85);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 4px;
  background: rgba(255, 255, 255, .02);
}

.metric .k {
  color: var(--muted);
  font-size: 12.5px;
}

.metric .v {
  font-size: 16px;
  font-weight: 800;
}

.metric-full {
  grid-column: 1 / -1;
}

.metric-note-box {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.5;
  font-weight: 500;
  color: var(--text);
}

.empty {
  border: 1px dashed rgba(34, 48, 74, .85);
  border-radius: 14px;
  padding: 14px;
}

.empty-title {
  font-weight: 800;
  margin-bottom: 4px;
}

/* Placeholders */
.stack {
  display: grid;
  gap: 10px;
}

.placeholder-box {
  border: 1px dashed rgba(34, 48, 74, .85);
  border-radius: 16px;
  padding: 16px;
  color: var(--muted);
}

/* Modal */
.modal.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
}

.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 32px);
  background: var(--card);
  border: 1px solid rgba(34, 48, 74, .95);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px 14px;
  border-bottom: 1px solid rgba(34, 48, 74, .55);
  background: rgba(255, 255, 255, .02);
}

.modal-title {
  font-size: 16px;
  font-weight: 900;
}

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

.modal-foot {
  padding: 12px 14px 14px 14px;
  border-top: 1px solid rgba(34, 48, 74, .55);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-foot-session-map {
  flex-wrap: wrap;
}

.modal-foot-session-map .btn:last-child {
  margin-left: auto;
}

#sessionsList,
#groupEditSessionsList,
#tasksList,
#groupsList {
  max-height: 55vh;
  overflow: auto;
  padding-right: 4px;
}

.groups-compare-modal {
  align-items: center;
}

.compare-modal-card {
  max-height: min(86vh, 820px);
}

.tab-row {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(34, 48, 74, .65);
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab-btn {
  border: 1px solid transparent;
  border-bottom: 0;
  background: rgba(255, 255, 255, .02);
  color: var(--muted);
  border-radius: 10px 10px 0 0;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
  margin-bottom: -1px;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #d8e4ff;
  background: rgba(255, 255, 255, .04);
}

.tab-btn.is-active {
  color: #ffffff;
  background: var(--card);
  border-color: rgba(34, 48, 74, .85);
  border-bottom-color: var(--card);
}

.task-compare-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.compact-task-list {
  gap: 6px;
  max-height: min(56vh, 520px);
  overflow: auto;
  padding-right: 4px;
}

.compact-task-list .list-item {
  padding: 8px 10px;
  min-height: 38px;
  gap: 0;
  border-radius: 10px;
}

.compare-table-wrap {
  overflow: auto;
  border: 1px solid rgba(34, 48, 74, .85);
  border-radius: 12px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.compare-table th,
.compare-table td {
  border: 1px solid rgba(34, 48, 74, .8);
  padding: 9px 10px;
  text-align: left;
}

.compare-table th {
  background: rgba(24, 34, 54, .92);
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 800;
}

.sortable-th {
  cursor: pointer;
  user-select: none;
}

.sort-indicator {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

.compare-chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.compare-chart-group-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.compare-chart-series-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, .8);
  border-radius: 10px;
  padding: 6px 8px;
  background: #ffffff;
  color: #111827;
}

.compare-chart-series-control input[type="color"] {
  width: 32px;
  height: 24px;
  border: 0;
  background: transparent;
  padding: 0;
}

.compare-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.compare-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(148, 163, 184, .8);
  border-radius: 999px;
  background: #ffffff;
  color: #111827;
  padding: 5px 10px;
  cursor: default;
}

.compare-chart-legend-line {
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

#groupCompareBoxplotLegend .compare-chart-legend-item {
  border-color: rgba(106, 166, 255, .45);
  background: rgba(11, 20, 38, .72);
  color: #f3f7ff;
  font-weight: 700;
}

.compare-chart-canvas-wrap {
  position: relative;
  border: 1px solid rgba(203, 213, 225, .95);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  margin-bottom: 8px;
}

.compare-chart-svg {
  width: 100%;
  height: auto;
  min-height: 260px;
}

.compare-chart-grid {
  stroke: rgba(148, 163, 184, .45);
  stroke-width: 1;
}

.compare-chart-axis {
  stroke: rgba(51, 65, 85, .75);
  stroke-width: 1.3;
}

.compare-chart-title {
  fill: #111827;
  font-size: 16px;
  font-weight: 700;
  text-anchor: middle;
}

.compare-chart-y-label {
  fill: #374151;
  font-size: 11px;
  text-anchor: end;
}

.compare-chart-x-label {
  fill: #374151;
  font-size: 11px;
  text-anchor: middle;
}

.compare-chart-point {
  transition: r .12s ease;
}

.compare-chart-point:hover {
  r: 6;
}

.compare-chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 170px;
  max-width: 260px;
  pointer-events: none;
  border: 1px solid rgba(54, 78, 116, .85);
  border-radius: 10px;
  background: rgba(7, 12, 24, .96);
  padding: 8px 10px;
  font-size: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}

@media (max-width: 980px) {
  .compare-modal-card {
    width: min(96vw, 96vw) !important;
    max-height: 90vh;
  }

  .task-compare-layout {
    grid-template-columns: 1fr;
  }

  .compact-task-list {
    max-height: 180px;
  }

  .compare-chart-series-control {
    width: 100%;
    justify-content: space-between;
  }
}

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

.group-boxplot-card {
  border: 1px solid rgba(148, 163, 184, .45);
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
}

.group-boxplot-title {
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}

.boxplot-meaning-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  color: #e6eeff;
  font-size: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(106, 166, 255, .42);
  border-radius: 12px;
  background: rgba(11, 20, 38, .6);
}

.boxplot-meaning-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.boxplot-legend-mark {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #334155;
  background: #e2e8f0;
}

.boxplot-legend-mark.median {
  width: 14px;
  height: 3px;
  border-radius: 999px;
  background: #334155;
}

.boxplot-legend-mark.whisker {
  width: 3px;
  height: 14px;
  border-radius: 999px;
  background: #334155;
}

.boxplot-legend-mark.average {
  width: 14px;
  height: 14px;
  border: 0;
  background: linear-gradient(45deg, transparent 45%, #111827 45%, #111827 55%, transparent 55%),
              linear-gradient(-45deg, transparent 45%, #111827 45%, #111827 55%, transparent 55%);
}

.boxplot-legend-mark.outlier {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #64748b;
}

@media (max-width: 980px) {
  .group-boxplot-grid {
    grid-template-columns: 1fr;
  }
}

.map-modal-card {
  width: min(1400px, 96vw);
  max-height: min(92vh, 980px);
}

.map-modal-body {
  padding: 0;
}

.map-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: min(72vh, 760px);
}

.map-sidebar {
  border-right: 1px solid rgba(34, 48, 74, .65);
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
  overflow: auto;
}

.map-panel-title {
  font-size: 13px;
  font-weight: 800;
  color: #d8e4ff;
}

.map-option-grid {
  display: grid;
  gap: 10px;
}

.map-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.map-option-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.map-sidebar input[type="color"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(34, 48, 74, .85);
  border-radius: 10px;
  background: rgba(7, 10, 20, .35);
  padding: 4px;
}

.map-legend {
  border: 1px solid rgba(34, 48, 74, .8);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 10px;
}

.map-legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.map-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .55);
  background: #4cc9f0;
  flex: 0 0 auto;
}

.map-legend-line {
  width: 24px;
  height: 0;
  border-top: 3px solid #f72585;
  flex: 0 0 auto;
}

.map-canvas-wrap {
  min-height: 320px;
}

.leaflet-map-canvas {
  width: 100%;
  height: 100%;
  min-height: min(72vh, 760px);
}

.leaflet-map-canvas .leaflet-control-container .leaflet-control {
  box-shadow: 0 2px 12px rgba(0, 0, 0, .28);
}

@media (max-width: 980px) {
  .map-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .map-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(34, 48, 74, .65);
    max-height: 34vh;
  }

  .leaflet-map-canvas {
    min-height: 52vh;
  }
}

.wordcloud-wrap {
  margin-top: 12px;
}

.wordcloud-shell {
  display: grid;
  gap: 14px;
}

.wordcloud-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wordcloud-chip,
.wordcloud-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(11, 14, 19, .45);
  color: #dce7ff;
  font-size: 12px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.wordcloud-surface {
  position: relative;
  overflow: hidden;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 24px;
  border: 1px solid rgba(210, 218, 235, .95);
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .95), 0 12px 30px rgba(0, 0, 0, .14);
}

.wordcloud {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  line-height: .94;
}

.wordcloud--default {
  min-height: 240px;
}

.wordcloud--comparison {
  min-height: 205px;
}

.wordcloud .word {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .04em .06em;
  font-size: var(--size, 20px);
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--color, #d957a5);
  text-shadow: 0 2px 10px rgba(88, 98, 122, .12);
  transform: rotate(var(--rotate, 0deg));
  transform-origin: center;
  transition: transform .16s ease, opacity .16s ease, filter .16s ease;
  text-wrap: balance;
}

.wordcloud .word:hover {
  transform: translateY(-2px) rotate(var(--rotate, 0deg)) scale(1.04);
  filter: saturate(1.08) brightness(1.04);
}

.wordcloud .word.word-tier-5 {
  font-weight: 900;
}

.wordcloud .word.word-tier-4,
.wordcloud .word.word-tier-5 {
  text-shadow: 0 8px 18px rgba(88, 98, 122, .18);
}

.wordcloud-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
}

.wordcloud-compare-card {
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(18, 26, 42, .96), rgba(13, 18, 29, .96));
}

.wordcloud-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.wordcloud-card-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.wordcloud-empty {
  padding: 18px;
  border: 1px dashed rgba(210, 218, 235, .95);
  border-radius: 18px;
  background: #ffffff;
}

@media (max-width: 720px) {
  .wordcloud-card-head {
    flex-direction: column;
  }

  .wordcloud-card-badges {
    justify-content: flex-start;
  }

  .wordcloud--default {
    min-height: 200px;
  }

  .wordcloud--comparison {
    min-height: 180px;
  }
}

.chip-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid rgba(34, 48, 74, .9);
  background: rgba(7, 10, 20, .35);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.chip.is-selected {
  border-color: #8fc2ff;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(58, 130, 255, .42), rgba(87, 168, 255, .3));
  box-shadow: 0 0 0 3px rgba(106, 166, 255, .16);
}

.chip.is-selected::before {
  content: "✓ ";
}

#groupEditMetricsField,
#sessionMetricsField {
  margin-bottom: 12px;
}

.interval-ratios-controls {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.interval-ratios-controls--group {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}

.interval-ratios-toggle-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.interval-ratios-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(34, 48, 74, .85);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .02);
  color: var(--text);
}

.interval-ratios-toggle input {
  margin: 0;
}

.interval-ratios-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 10px;
}

.interval-ratios-panel {
  border: 1px solid rgba(34, 48, 74, .18);
  border-radius: 18px;
  background: #ffffff;
  color: #1f2937;
  padding: 18px;
}

.interval-ratios-title {
  font-size: 18px;
  font-weight: 800;
  color: #111827;
}

.interval-ratios-subtitle {
  color: #4b5563;
  margin-top: 4px;
  margin-bottom: 14px;
}

.interval-ratios-summary {
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.interval-ratios-summary-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
}

.interval-ratios-summary-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.interval-ratios-summary-sub {
  margin-top: 4px;
  color: #64748b;
  font-size: 14px;
}

.interval-ratios-chart-card {
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 16px;
  background: #f8fafc;
  padding: 16px;
  color: #111827;
}

.interval-ratios-chart {
  display: grid;
  gap: 14px;
}

.interval-ratios-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 120px;
  gap: 12px;
  align-items: center;
}

.interval-ratios-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #111827;
}

.interval-ratios-bar-track {
  position: relative;
  height: 30px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.interval-ratios-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
}

.interval-ratios-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-weight: 700;
  color: #0f172a;
}

.interval-ratios-value {
  text-align: right;
  font-weight: 700;
  color: #111827;
}

.interval-ratios-footnote {
  margin-top: 14px;
  color: #4b5563;
}

.group-compare-movement-chart-card {
  display: grid;
  gap: 16px;
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 16px;
  background: #f8fafc;
  padding: 16px;
}

.group-compare-movement-section {
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 16px;
  background: #ffffff;
  padding: 14px;
}

.group-compare-movement-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: #111827;
  margin-bottom: 10px;
}

.group-compare-movement-bars {
  display: grid;
  gap: 10px;
}

.group-compare-movement-bar-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.group-compare-movement-bar-label {
  font-weight: 700;
  color: #374151;
}

.group-compare-movement-bar-track {
  position: relative;
  min-height: 24px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.group-compare-movement-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
}

.group-compare-movement-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

@media (max-width: 720px) {
  .interval-ratios-row {
    grid-template-columns: 1fr;
  }

  .interval-ratios-value {
    text-align: left;
  }

  .group-compare-movement-bar-row {
    grid-template-columns: 1fr;
  }
}

.group-edit-metric-chip.is-selected {
  border-color: rgba(98, 220, 145, .85);
  background: rgba(71, 189, 120, .3);
  box-shadow: 0 0 0 3px rgba(71, 189, 120, .18);
}

.group-edit-metric-chip.is-unselected {
  border-color: rgba(240, 98, 98, .72);
  color: #ffd6d6;
  background: rgba(240, 98, 98, .18);
}

.group-edit-flag {
  min-width: 38px;
  font-weight: 900;
  color: #ffb8b8;
}

.group-edit-flag.is-flagged,
.group-edit-flag.is-flagged:hover {
  border-color: #ff6b6b;
  color: #ffffff;
  background: rgba(255, 107, 107, .32);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, .2);
}

#deleteGroupBtn {
  border-color: rgba(255, 107, 107, .8);
  background: rgba(255, 107, 107, .24);
}

#deleteGroupBtn:hover {
  border-color: rgba(255, 107, 107, .96);
  background: rgba(255, 107, 107, .34);
}

#groupEditMetricsPicker .group-edit-metric-chip,
#sessionMetricsPicker .group-edit-metric-chip {
  appearance: none;
}

#groupEditMetricsPicker .group-edit-metric-chip.is-selected,
#sessionMetricsPicker .group-edit-metric-chip.is-selected {
  border-color: rgba(98, 220, 145, .9) !important;
  color: #eafff1 !important;
  background: rgba(71, 189, 120, .34) !important;
  box-shadow: 0 0 0 3px rgba(71, 189, 120, .2) !important;
}

#groupEditMetricsPicker .group-edit-metric-chip.is-unselected,
#sessionMetricsPicker .group-edit-metric-chip.is-unselected {
  border-color: rgba(240, 98, 98, .82) !important;
  color: #ffdcdc !important;
  background: rgba(240, 98, 98, .22) !important;
  box-shadow: none !important;
}

#groupEditSessionsList .group-edit-flag.is-flagged,
#groupEditSessionsList .group-edit-flag.is-flagged:hover,
#groupEditSessionsList .group-edit-flag.is-flagged:focus-visible {
  border-color: #ff6b6b !important;
  color: #ffffff !important;
  background: rgba(255, 107, 107, .36) !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, .22) !important;
}
.app-footer {
  margin-top: 10px;
  padding: 30px 16px 30px;
  border-top: 1px solid rgba(34, 48, 74, .6);
  background: rgba(10, 14, 24, .86);
}

.app-footer-content {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  color: var(--muted);
}

.app-footer-content p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.app-footer-logo {
  margin-top: 18px;
  margin-bottom: 10px;
  width: min(300px, 70vw);
  height: auto;
  display: block;
  opacity: .95;
}