:root {
  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-muted: #fbfaf8;
  --surface-strong: #f1ede7;
  --line: #e7e1d7;
  --line-strong: #d6c8b8;
  --ink: #171717;
  --ink-soft: #5f5a53;
  --ink-faint: #8d867d;
  --accent: #a32121;
  --accent-soft: rgba(163, 33, 33, 0.08);
  --accent-line: rgba(163, 33, 33, 0.22);
  --button-primary: #9f2f2a;
  --button-primary-hover: #842520;
  --button-primary-shadow: rgba(159, 47, 42, 0.22);
  --shadow: 0 10px 30px rgba(19, 18, 16, 0.05);
  --radius: 18px;
  font-family: "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(163, 33, 33, 0.04), transparent 22%),
    linear-gradient(180deg, #faf8f5 0%, #f6f4f1 100%);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
}

.app-header {
  display: grid;
  gap: 1rem;
  padding: 1.15rem 1.35rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 248, 245, 0.88);
  backdrop-filter: blur(14px);
}

.brand-block {
  max-width: 70rem;
}

.eyebrow,
.section-kicker,
.sidebar-kicker,
.card-kicker {
  margin: 0 0 0.25rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
}

.brand-block h1,
.page-heading h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2.2rem);
  line-height: 1.05;
  font-weight: 700;
}

.brand-copy {
  margin: 0.3rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.14;
}

.section-copy {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.28;
}

.brand-copy a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
}

.brand-copy a:hover {
  color: #8d1b1d;
  border-bottom-color: rgba(159, 29, 32, 0.5);
}

.top-nav,
.sub-nav,
.toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar--end {
  justify-content: flex-end;
  width: 100%;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-header-row h3 {
  margin: 0;
}

.card-header-row .toolbar--end {
  width: auto;
  margin-left: auto;
}

.toolbar-meta {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.nav-link,
.sub-nav-link,
.primary-button,
.secondary-button {
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.nav-link,
.sub-nav-link {
  padding: 0.7rem 0.2rem 0.82rem;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 0;
  border-width: 0 0 2px 0;
  border-style: solid;
  border-color: transparent;
  font-weight: 500;
  text-decoration: none;
}

.nav-link:hover,
.sub-nav-link:hover {
  background: rgba(159, 29, 32, 0.07);
  border-color: rgba(159, 29, 32, 0.5);
  color: #8d1b1d;
}

.nav-link.is-active,
.sub-nav-link.is-active {
  background: transparent;
  color: var(--ink);
  border-color: #9f1d20;
}

.nav-menu {
  position: relative;
}

.nav-menu > summary {
  list-style: none;
}

.nav-menu > summary::-webkit-details-marker {
  display: none;
}

.nav-link--menu {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.nav-link--menu::after {
  content: "▾";
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.nav-menu[open] .nav-link--menu {
  color: var(--ink);
  border-color: #9f1d20;
}

.nav-menu-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  min-width: 15rem;
  display: grid;
  gap: 0.2rem;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  z-index: 20;
}

.nav-menu-item {
  display: block;
  padding: 0.68rem 0.85rem;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.2;
}

.nav-menu-item:hover,
.nav-menu-item:focus-visible {
  background: var(--accent-soft);
  color: #8d1b1d;
  outline: none;
}

.workspace {
  display: grid;
  grid-template-columns: 19rem minmax(0, 1fr);
  min-height: 0;
}

.sidebar,
.content {
  min-height: 0;
  overflow: auto;
}

.sidebar {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.content {
  padding: 1.25rem;
}

.sidebar-card,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.sidebar-card {
  padding: 1rem;
}

.sidebar-card h2,
.card h3 {
  margin: 0 0 0.85rem;
  font-size: 1.04rem;
  font-weight: 650;
}

.zipf-card-title {
  font-size: 0.9rem !important;
}

.panel,
.subpanel {
  display: none;
}

.panel.is-active,
.subpanel.is-active {
  display: block;
}

.page-heading,
.card-head,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.stack-grid {
  display: grid;
  gap: 1rem;
}

.section-stack {
  display: grid;
  gap: 1rem;
}

.stack-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.card {
  padding: 1.05rem;
}

.section-card {
  padding: 1.15rem;
}

.fields-grid,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.multimodal-extract-params-grid {
  grid-template-columns: 1fr;
}

.multimodal-time-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fields-grid--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 0.45rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
}

.field-inline {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.field label {
  display: block;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--ink);
}

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

.check-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  cursor: pointer;
}

.check-option input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.5rem;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.checkbox-field input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
}

.radio-option input {
  margin: 0;
}

[data-rst-fields][hidden] {
  display: none !important;
}

.field-help {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--accent);
}

.field-help--pvalue-note {
  margin-top: 0.45rem;
  max-width: 58rem;
  color: #9f1d20;
  font-weight: 400;
}

.suivi-help-note {
  max-width: 64rem;
}

.suivi-help-note p + p {
  margin-top: 0.38rem;
}

.suivi-help-note code {
  color: inherit;
}

.readonly-field {
  margin: 0;
  min-height: 2.6rem;
  display: flex;
  align-items: center;
  padding: 0.72rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.readonly-field.is-error {
  border-color: rgba(160, 33, 33, 0.35);
  color: #8d1b1d;
  background: rgba(160, 33, 33, 0.08);
}

.visually-hidden {
  display: none !important;
}

.multi-select {
  min-height: 10rem;
  resize: vertical;
}

.toolbar--compact {
  margin-top: 0.55rem;
  gap: 0.55rem;
}

.selected-terms-picker {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.55rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.selected-terms-meta {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.selected-terms-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.selected-term-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.52rem 0.7rem 0.52rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}

.selected-term-chip-label {
  font-size: 0.9rem;
}

.selected-term-chip-remove {
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1;
}

.selected-term-chip-remove:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.chip-picker {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.55rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.chip-picker-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.chip-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chip-item {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.52rem 0.7rem 0.52rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}

.chip-item-label {
  font-size: 0.9rem;
}

.chip-item-remove {
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1;
}

.chip-item-remove:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.mono-help {
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  word-break: break-all;
}

label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.72rem 0.82rem;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
}

.large-textarea {
  min-height: 14rem;
  margin: 1rem 0;
}

.annotation-preview {
  white-space: pre-wrap;
  max-height: 18rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  margin-bottom: 1rem;
  background: rgba(250, 248, 245, 0.98);
  color: var(--ink);
}

.annotation-preview .highlight {
  background: #fff2a8;
  color: inherit;
  font-weight: inherit;
  padding: 0;
  border-radius: 0;
}

.annotation-action-btn {
  min-width: 190px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.annotation-remove-field {
  min-width: 220px;
}

.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;
}

.primary-button,
.secondary-button {
  padding: 0.78rem 1rem;
}

.primary-button {
  background: var(--button-primary);
  border-color: var(--button-primary);
  color: #fff;
  box-shadow: 0 8px 20px var(--button-primary-shadow);
}

.primary-button:hover {
  background: var(--button-primary-hover);
  border-color: var(--button-primary-hover);
  transform: translateY(-1px);
}

.primary-button:focus,
.primary-button:focus-visible,
.secondary-button:focus,
.secondary-button:focus-visible {
  outline: none;
  box-shadow: none;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.secondary-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--line-strong);
}

.secondary-button--danger {
  background: #b62d2d;
  border-color: #b62d2d;
  color: #fff;
}

.secondary-button--danger:hover {
  background: #981f1f;
  border-color: #981f1f;
}

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

.sidebar-file-info {
  font-size: 0.76rem;
  line-height: 1.18;
}

.sidebar-import-help {
  margin: 0.55rem 0 0.5rem;
  font-size: 0.72rem;
  line-height: 1.24;
}

.sidebar-note {
  margin-top: 0.8rem;
  font-size: 0.74rem;
  line-height: 1.18;
}

.sidebar-history-block {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
}

.analysis-history {
  display: grid;
  gap: 0.55rem;
}

.analysis-history-empty {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.28;
}

.analysis-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.62rem 0.68rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
  transition: border-color 140ms ease, background 140ms ease;
}

.analysis-history-item:hover,
.analysis-history-item:focus-within {
  border-color: var(--line-strong);
  background: rgba(159, 29, 32, 0.05);
}

.analysis-history-item.is-active {
  border-color: rgba(159, 29, 32, 0.45);
  background: rgba(159, 29, 32, 0.08);
}

.analysis-history-item-main {
  width: 100%;
  display: grid;
  gap: 0.2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.analysis-history-item-main:hover,
.analysis-history-item-main:focus-visible {
  color: inherit;
}

.analysis-history-item-title {
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.2;
}

.analysis-history-item-meta {
  font-size: 0.74rem;
  line-height: 1.2;
  color: var(--ink-soft);
  word-break: break-word;
}

.analysis-history-download {
  padding: 0.52rem 0.78rem;
  font-size: 0.76rem;
  line-height: 1;
  white-space: nowrap;
}

.download-results-status {
  margin: 0.75rem 0 0;
  font-size: 0.86rem;
  line-height: 1.45;
  word-break: break-word;
}

.download-results-status.is-error {
  color: var(--accent);
}

.annotation-save-status {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
}

.annotation-save-status.is-error {
  color: var(--accent);
}

.progress-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

progress {
  width: 100%;
  height: 0.8rem;
  accent-color: var(--accent);
}

.logs,
.preview-box {
  min-height: 16rem;
  margin: 0;
  padding: 1rem;
  border-radius: 16px;
  overflow: auto;
  white-space: pre-wrap;
}

.logs {
  background: #171717;
  color: #f7f4ee;
}

.preview-box {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.plot-placeholder--tall {
  min-height: 26rem;
}

.result-list,
.tree-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--ink-soft);
}

.result-pane--spaced {
  margin-top: 1rem;
}

.steps-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink);
  display: grid;
  gap: 0.7rem;
}

.steps-list li {
  line-height: 1.45;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-muted);
  padding: 0.95rem 1rem;
}

.summary-label {
  margin: 0 0 0.35rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.summary-value {
  font-size: 1.2rem;
  line-height: 1.15;
  color: var(--ink);
}

.zipf-svg {
  display: block;
  width: 100%;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

#zipfChart .zipf-svg {
  width: min(100%, 1000px);
  max-width: 1000px;
  min-height: 0;
  margin: 0 auto;
}

.local-tabs {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.multimodal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.multimodal-indicators {
  display: grid;
  gap: 0.55rem;
}

.local-tab-button {
  padding: 0.6rem 0.15rem 0.72rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
}

.local-tab-button.is-active {
  border-color: #9f1d20;
  background: transparent;
  color: var(--ink);
}

.local-tab-button:hover,
.local-tab-button:focus-visible {
  color: #8d1b1d;
  background: rgba(159, 29, 32, 0.07);
  border-color: rgba(159, 29, 32, 0.5);
}

.local-tab-button--multimodal {
  color: #b82126;
}

.local-tab-button--multimodal.is-active {
  color: #8f171b;
  border-color: #b82126;
  background: rgba(184, 33, 38, 0.07);
}

.local-tab-button--multimodal:hover,
.local-tab-button--multimodal:focus-visible {
  color: #8f171b;
  background: rgba(184, 33, 38, 0.07);
  border-color: rgba(184, 33, 38, 0.55);
}

.local-tab-button[data-motion-result-target] {
  color: #b82126;
}

.local-tab-button[data-motion-result-target].is-active {
  color: #8f171b;
  border-color: #b82126;
  background: rgba(184, 33, 38, 0.07);
}

.local-tab-button[data-motion-result-target]:hover,
.local-tab-button[data-motion-result-target]:focus-visible {
  color: #8f171b;
  background: rgba(184, 33, 38, 0.07);
  border-color: rgba(184, 33, 38, 0.55);
}

.local-tab-panel {
  display: none;
}

.local-tab-panel.is-active {
  display: block;
}

.result-pane:empty::before {
  content: "";
}

.empty-state,
.plot-placeholder,
.table-placeholder {
  display: grid;
  place-items: center;
  min-height: 18rem;
  border: 1px dashed var(--accent-line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 245, 240, 0.98)),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 14px,
      rgba(163, 33, 33, 0.03) 14px,
      rgba(163, 33, 33, 0.03) 28px
    );
  color: var(--ink-faint);
  text-align: center;
  padding: 1rem;
}

.result-image {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.multimodal-youtube-preview {
  max-width: 820px;
  margin-top: 0.5rem;
}

.multimodal-youtube-embed {
  width: 100%;
  max-width: 780px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #000;
  overflow: hidden;
}

.multimodal-youtube-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.multimodal-compare-video-preview-player {
  width: 100%;
  max-width: 780px;
  aspect-ratio: 16 / 9;
  display: block;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #000;
}

.multimodal-audio-results {
  display: grid;
  gap: 1rem;
}

.multimodal-audio-result-block {
  display: grid;
  gap: 0.45rem;
  padding-top: 0.15rem;
}

.multimodal-audio-result-block + .multimodal-audio-result-block {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1rem;
}

.multimodal-audio-result-block h4 {
  margin: 0;
}

.multimodal-audio-result-block .field-help {
  margin: 0;
}

#multimodalAudioAnomaliesPlot,
#multimodalAudioPausesPlot,
#multimodalAudioSpeechRatePlot,
#multimodalAudioAnomaliesConcordancier,
#multimodalAudioTable,
#multimodalMotionTimelinePlot,
#multimodalMotionMagnitudeGallery,
#multimodalMotionHsvGallery,
#multimodalMotionVectorsGallery,
#multimodalMotionOverlayGallery,
#multimodalMotionWindowsTable,
#multimodalMotionFramesTable,
#multimodalMotionSummary {
  max-width: 820px;
  margin-inline: auto;
}

#multimodalAudioPausesPlot,
#multimodalAudioSpeechRatePlot,
#multimodalAudioAnomaliesPlot,
#multimodalMotionTimelinePlot {
  display: flex;
  justify-content: center;
}

#multimodalAudioPausesPlot .result-image,
#multimodalAudioSpeechRatePlot .result-image,
#multimodalAudioAnomaliesPlot .result-image,
#multimodalMotionTimelinePlot .result-image {
  width: min(100%, 780px);
  max-width: 780px;
  height: auto;
  object-fit: contain;
}

#multimodalAudioTable .result-table-wrap,
#multimodalAudioAnomaliesConcordancier .result-table-wrap,
#multimodalMotionWindowsTable .result-table-wrap,
#multimodalMotionFramesTable .result-table-wrap {
  max-height: 420px;
}

#multimodalMotionSummary .readonly-field {
  max-height: 320px;
  overflow: auto;
  align-items: flex-start;
  white-space: pre-wrap;
}

#afcClassesPlot,
#afcTermsPlot,
#afcVarsPlot {
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#afcClassesPlot .result-image,
#afcTermsPlot .result-image,
#afcVarsPlot .result-image {
  width: min(100%, 980px);
  max-width: 980px;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  flex: 0 0 auto;
}

#ldaHeatmap .result-image {
  width: min(100%, 900px);
  max-width: 900px;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
}

#ldaNetwork {
  display: grid;
  gap: 0.8rem;
}

.lda-network-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
}

.lda-network-control {
  display: grid;
  gap: 0.35rem;
  min-width: 240px;
}

.lda-network-control span {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.lda-network-control select {
  min-height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.55rem 0.75rem;
  color: var(--ink);
}

.lda-network-metrics {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.lda-network-canvas {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 0.5rem;
}

.lda-network-svg {
  display: block;
  width: 100%;
  min-width: 980px;
  height: auto;
}

.lda-network-background {
  fill: #fffdfa;
}

.lda-network-grid {
  stroke: rgba(26, 32, 44, 0.09);
  stroke-width: 1;
  stroke-dasharray: 3 7;
}

.lda-network-topic-label,
.lda-network-word-label {
  fill: var(--ink);
  font-size: 15px;
}

.lda-network-topic-label {
  font-weight: 700;
}

.lda-network-word-label {
  font-size: 14px;
}

#chdDendrogramme .result-image {
  width: min(100%, var(--dendrogram-display-width, 1200px));
  height: auto;
  max-width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: contain;
  margin: 0 auto;
}

#suiviEntropyPlot,
#suiviRedundancyPlot,
#suiviJsdSuccessivePlot,
#suiviJsdReferencePlot,
#suiviMatrixPlot {
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#suiviEntropyPlot .result-image,
#suiviRedundancyPlot .result-image,
#suiviJsdSuccessivePlot .result-image,
#suiviJsdReferencePlot .result-image,
#suiviMatrixPlot .result-image {
  width: min(100%, 980px);
  max-width: 980px;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  flex: 0 0 auto;
}

#suiviMatrixPlot .result-image {
  width: auto;
  max-width: none;
  min-width: 980px;
}

#suiviMatrixPlot {
  justify-content: flex-start;
}

#suiviMeta .result-table-wrap,
#suiviIndicatorsTable .result-table-wrap,
#suiviJsdSuccessiveTable .result-table-wrap,
#suiviJsdReferenceTable .result-table-wrap,
#suiviTermsTable .result-table-wrap,
#suiviContributionsTable .result-table-wrap,
#suiviMatrixTable .result-table-wrap {
  width: 100%;
  overflow: auto;
}

#suiviMeta .result-table,
#suiviIndicatorsTable .result-table,
#suiviJsdSuccessiveTable .result-table,
#suiviJsdReferenceTable .result-table,
#suiviTermsTable .result-table,
#suiviContributionsTable .result-table,
#suiviMatrixTable .result-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  font-size: 0.78rem;
}

#suiviMeta .result-table th,
#suiviMeta .result-table td,
#suiviIndicatorsTable .result-table th,
#suiviIndicatorsTable .result-table td,
#suiviJsdSuccessiveTable .result-table th,
#suiviJsdSuccessiveTable .result-table td,
#suiviJsdReferenceTable .result-table th,
#suiviJsdReferenceTable .result-table td,
#suiviTermsTable .result-table th,
#suiviTermsTable .result-table td,
#suiviContributionsTable .result-table th,
#suiviContributionsTable .result-table td,
#suiviMatrixTable .result-table th,
#suiviMatrixTable .result-table td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 5.8rem;
  line-height: 1.28;
  padding: 0.46rem 0.52rem;
}

#suiviMeta .result-table th:first-child,
#suiviMeta .result-table td:first-child,
#suiviIndicatorsTable .result-table th:first-child,
#suiviIndicatorsTable .result-table td:first-child,
#suiviJsdSuccessiveTable .result-table th:first-child,
#suiviJsdSuccessiveTable .result-table td:first-child,
#suiviJsdReferenceTable .result-table th:first-child,
#suiviJsdReferenceTable .result-table td:first-child,
#suiviTermsTable .result-table th:first-child,
#suiviTermsTable .result-table td:first-child,
#suiviContributionsTable .result-table th:first-child,
#suiviContributionsTable .result-table td:first-child,
#suiviMatrixTable .result-table th:first-child,
#suiviMatrixTable .result-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
}

#suiviMeta .result-table th:first-child,
#suiviIndicatorsTable .result-table th:first-child,
#suiviJsdSuccessiveTable .result-table th:first-child,
#suiviJsdReferenceTable .result-table th:first-child,
#suiviTermsTable .result-table th:first-child,
#suiviContributionsTable .result-table th:first-child,
#suiviMatrixTable .result-table th:first-child {
  background: var(--surface-strong);
}

#suiviMeta .result-table td,
#suiviIndicatorsTable .result-table td,
#suiviJsdSuccessiveTable .result-table td,
#suiviJsdReferenceTable .result-table td,
#suiviTermsTable .result-table td,
#suiviContributionsTable .result-table td,
#suiviMatrixTable .result-table td {
  vertical-align: top;
}

#suiviMatrixTable .result-table th,
#suiviMatrixTable .result-table td {
  min-width: 4.8rem;
}

#suiviTermsTable .result-table th:nth-child(6),
#suiviTermsTable .result-table td:nth-child(6),
#suiviTermsTable .result-table th:nth-child(7),
#suiviTermsTable .result-table td:nth-child(7),
#suiviTermsTable .result-table th:nth-child(8),
#suiviTermsTable .result-table td:nth-child(8) {
  min-width: 13rem;
  max-width: 13rem;
}

#suiviContributionsTable .result-table th:nth-child(5),
#suiviContributionsTable .result-table td:nth-child(5),
#suiviContributionsTable .result-table th:nth-child(6),
#suiviContributionsTable .result-table td:nth-child(6),
#suiviContributionsTable .result-table th:nth-child(7),
#suiviContributionsTable .result-table td:nth-child(7),
#suiviContributionsTable .result-table th:nth-child(8),
#suiviContributionsTable .result-table td:nth-child(8) {
  min-width: 12rem;
  max-width: 12rem;
}

#afcTermsTable .result-table-wrap,
#afcVarsTable .result-table-wrap,
#afcEigTable .result-table-wrap {
  width: 100%;
  overflow: auto;
}

#afcTermsTable .result-table,
#afcVarsTable .result-table,
#afcEigTable .result-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  font-size: 0.78rem;
}

#afcTermsTable .result-table th,
#afcTermsTable .result-table td,
#afcVarsTable .result-table th,
#afcVarsTable .result-table td,
#afcEigTable .result-table th,
#afcEigTable .result-table td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 5.8rem;
  line-height: 1.28;
  padding: 0.46rem 0.52rem;
  vertical-align: top;
}

#afcTermsTable .result-table th:first-child,
#afcTermsTable .result-table td:first-child,
#afcVarsTable .result-table th:first-child,
#afcVarsTable .result-table td:first-child,
#afcEigTable .result-table th:first-child,
#afcEigTable .result-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
}

#afcTermsTable .result-table th:first-child,
#afcVarsTable .result-table th:first-child,
#afcEigTable .result-table th:first-child {
  background: var(--surface-strong);
}

#afcEigTable .result-table th,
#afcEigTable .result-table td {
  min-width: 4.8rem;
}

.result-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.85rem;
}

.result-gallery-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}

.result-gallery-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.result-gallery-item > h4 {
  margin: 0;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.96rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-gallery-item-header h4 {
  margin: 0;
  font-size: 0.96rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-gallery-remove-button {
  flex: 0 0 auto;
  width: 1.9rem;
  height: 1.9rem;
  border: 0;
  border-radius: 999px;
  background: #b82126;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.result-gallery-remove-button:hover,
.result-gallery-remove-button:focus-visible {
  background: #8f171b;
  outline: none;
}

.result-gallery-item img {
  width: 100%;
  display: block;
}

.result-gallery-link {
  display: block;
}

.result-gallery-caption {
  margin: 0;
  padding: 0.7rem 0.9rem 0.9rem;
  color: var(--ink-faint);
  font-size: 0.8rem;
  line-height: 1.45;
}

.result-gallery-subtitle {
  margin: 0;
  padding: 0.65rem 0.9rem 0.35rem;
  color: var(--ink-faint);
  font-size: 0.8rem;
  line-height: 1.35;
}

.result-gallery-analysis-image {
  width: 100%;
  display: block;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.multimodal-timeline {
  display: grid;
  gap: 0.75rem;
}

.multimodal-timeline-shell {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 93%, #f4eee5 7%), color-mix(in srgb, var(--surface) 97%, #eef4f8 3%));
  overflow: hidden;
}

.multimodal-timeline-labels {
  display: grid;
  grid-auto-rows: auto;
  background: color-mix(in srgb, var(--surface) 88%, #f2f5f8 12%);
  border-right: 1px solid var(--line);
}

.multimodal-timeline-label {
  padding: 0.56rem 0.7rem;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.14rem;
  align-content: center;
  box-sizing: border-box;
}

.multimodal-timeline-label strong {
  font-size: 0.84rem;
  line-height: 1.2;
  color: var(--ink);
}

.multimodal-timeline-label span,
.multimodal-timeline-label--ruler {
  font-size: 0.74rem;
  line-height: 1.25;
  color: var(--ink-faint);
}

.multimodal-timeline-label--ruler {
  font-weight: 700;
}

.multimodal-timeline-label--track {
  justify-content: center;
}

.multimodal-timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

.multimodal-timeline-surfaces {
  min-width: 0;
  width: max-content;
}

.multimodal-timeline-ruler {
  position: relative;
  height: 34px;
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
  background:
    linear-gradient(90deg, rgba(171, 84, 35, 0.07), rgba(39, 110, 164, 0.08)),
    linear-gradient(to right, rgba(128, 102, 80, 0.08) 1px, transparent 1px) 0 0 / 130px 100%;
}

.multimodal-timeline-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px solid color-mix(in srgb, var(--line-strong) 54%, transparent 46%);
}

.multimodal-timeline-tick span {
  position: absolute;
  top: 0.18rem;
  left: 0.34rem;
  font-size: 0.72rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.multimodal-timeline-lane {
  position: relative;
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
  background:
    linear-gradient(to right, rgba(128, 102, 80, 0.08) 1px, transparent 1px) 0 0 / 130px 100%;
}

.multimodal-timeline-lane[class*="multimodal-timeline-lane--images__"] {
  background-color: color-mix(in srgb, #f6f8fb 88%, white 12%);
}

.multimodal-timeline-lane--text {
  background-color: color-mix(in srgb, #fff7e2 78%, white 22%);
}

.multimodal-timeline-lane--pauses {
  background-color: color-mix(in srgb, #eef2f5 82%, white 18%);
}

.multimodal-timeline-lane--audio {
  background-color: color-mix(in srgb, #fdeeed 84%, white 16%);
}

.multimodal-timeline-lane--speech_rate {
  background-color: color-mix(in srgb, #eef8ee 84%, white 16%);
}

.multimodal-timeline-lane--audio_curve {
  background-color: color-mix(in srgb, #f9ecec 84%, white 16%);
}

.multimodal-timeline-lane--motion {
  background-color: color-mix(in srgb, #edf5ff 84%, white 16%);
}

.multimodal-timeline-lane--entropy {
  background-color: color-mix(in srgb, #fbf1e5 84%, white 16%);
}

.multimodal-timeline-lane:last-child {
  border-bottom: 0;
}

.multimodal-timeline-image-item {
  position: absolute;
  top: 0.34rem;
  width: 60px;
  margin: 0;
  display: grid;
  gap: 0.16rem;
}

.multimodal-timeline-image-item img {
  width: 60px;
  height: 60px;
  border-radius: 9px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #fff;
}

.multimodal-timeline-image-item figcaption {
  font-size: 0.64rem;
  line-height: 1.2;
  color: var(--ink-faint);
  text-align: center;
}

.multimodal-timeline-text-block {
  position: absolute;
  top: 0;
  min-height: 46px;
  padding: 0.34rem 0.46rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 30%, transparent 70%);
  background: color-mix(in srgb, #fff7dc 86%, white 14%);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.12rem;
  align-content: start;
  overflow: hidden;
}

.multimodal-timeline-text-group {
  position: absolute;
  top: 0.42rem;
  min-height: 46px;
  border-radius: 12px;
  background: color-mix(in srgb, #fff7dc 46%, white 54%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line-strong) 18%, transparent 82%);
  overflow: hidden;
}

.multimodal-timeline-text-block--speech {
  background: color-mix(in srgb, #fff7dc 92%, white 8%);
}

.multimodal-timeline-text-block.is-anomaly {
  border-color: color-mix(in srgb, #b83838 38%, transparent 62%);
  background: color-mix(in srgb, #fdeaea 88%, white 12%);
}

.multimodal-timeline-text-block--pause {
  min-height: 46px;
  padding: 0.28rem 0.36rem;
  border-style: dashed;
  border-color: color-mix(in srgb, #8391a0 46%, transparent 54%);
  background: color-mix(in srgb, #eef3f7 88%, white 12%);
  justify-content: center;
}

.multimodal-timeline-text-block--pause strong {
  color: #526171;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.multimodal-timeline-text-block--pause span {
  color: #697887;
}

.multimodal-timeline-text-block strong {
  font-size: 0.7rem;
  line-height: 1.15;
  color: var(--ink);
}

.multimodal-timeline-text-block span {
  font-size: 0.66rem;
  line-height: 1.22;
  color: var(--ink-soft);
}

.multimodal-timeline-readable-text {
  display: block;
  min-height: 48px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #5a4221;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  white-space: normal;
}

.multimodal-timeline-text-slots {
  position: relative;
  display: block;
  min-height: 58px;
}

.multimodal-timeline-text-slot {
  position: absolute;
  top: 0;
  bottom: 0;
  padding: 0.14rem 0.22rem;
  border-left: 1px solid color-mix(in srgb, var(--line-strong) 18%, transparent 82%);
  overflow: hidden;
  font-size: 0.68rem;
  line-height: 1.28;
  color: #5a4221;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.multimodal-timeline-text-slot:first-child {
  border-left: 0;
}

.multimodal-timeline-text-slot-empty {
  color: var(--ink-faint);
}

.multimodal-timeline-readable-token {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: #5a4221;
}

.multimodal-timeline-readable-token.is-current {
  background: color-mix(in srgb, #fff1a8 86%, white 14%);
  font-weight: 700;
}

.multimodal-timeline-readable-token--pause {
  display: inline-flex;
  align-items: center;
  padding: 0.06rem 0.34rem;
  border-radius: 999px;
  background: color-mix(in srgb, #eef3f7 92%, white 8%);
  border: 1px dashed color-mix(in srgb, #647382 42%, transparent 58%);
  border-style: dashed;
  color: #536270;
  font-weight: 600;
}

.multimodal-nodes-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.95fr);
  gap: 1rem;
  align-items: start;
}

.multimodal-nodes-graph-wrap {
  overflow-x: auto;
}

.multimodal-nodes-graph {
  display: block;
  width: 100%;
  min-width: 980px;
  height: 560px;
  background:
    radial-gradient(circle at 18% 28%, rgba(198, 119, 51, 0.08), transparent 32%),
    radial-gradient(circle at 82% 68%, rgba(62, 111, 167, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(255, 251, 240, 0.94), rgba(248, 245, 239, 0.96));
  border-radius: 16px;
}

.multimodal-nodes-edge {
  fill: none;
  stroke-width: 2;
  opacity: 0.82;
}

.multimodal-nodes-edge--temporal {
  stroke: #847568;
}

.multimodal-nodes-edge--visual {
  stroke: #b7662a;
}

.multimodal-nodes-edge--lexical {
  stroke: #3e6fa7;
}

.multimodal-nodes-node {
  stroke-width: 1.5;
}

.multimodal-nodes-node--event {
  fill: #c97733;
  stroke: #7f4315;
}

.multimodal-nodes-node--text {
  fill: #fdf4d9;
  stroke: #b9a87f;
}

.multimodal-nodes-node-label {
  fill: #ffffff;
  font-size: 10px;
  font-weight: 700;
}

.multimodal-nodes-node-caption {
  fill: #594f47;
  font-size: 10px;
  font-weight: 600;
}

.multimodal-nodes-zone-label {
  fill: #705d50;
  font-size: 13px;
  font-weight: 700;
}

.multimodal-timeline-audio-block {
  position: absolute;
  top: 0.32rem;
  bottom: 0.32rem;
  min-width: 48px;
  border-radius: 9px;
  background: linear-gradient(90deg, #b43131, #db7171);
  box-shadow: 0 0 0 1px color-mix(in srgb, #8e2020 30%, transparent 70%);
  display: grid;
  gap: 0.08rem;
  align-content: center;
  padding: 0.2rem 0.34rem;
  overflow: hidden;
}

.multimodal-timeline-audio-block strong {
  font-size: 0.64rem;
  line-height: 1.1;
  color: #fff8f8;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.multimodal-timeline-audio-block span {
  font-size: 0.6rem;
  line-height: 1.15;
  color: rgba(255, 248, 248, 0.9);
}

.multimodal-timeline-emotion-block {
  position: absolute;
  top: 0.6rem;
  min-height: 42px;
  padding: 0.34rem 0.46rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, #8a8f45 30%, transparent 70%);
  background: color-mix(in srgb, #f6f0ce 88%, white 12%);
  display: grid;
  gap: 0.12rem;
  align-content: start;
  overflow: hidden;
}

.multimodal-timeline-emotion-block.is-positive {
  border-color: color-mix(in srgb, #2b7f52 32%, transparent 68%);
  background: color-mix(in srgb, #e7f6ec 88%, white 12%);
}

.multimodal-timeline-emotion-block.is-negative {
  border-color: color-mix(in srgb, #b2572d 36%, transparent 64%);
  background: color-mix(in srgb, #fbe9df 88%, white 12%);
}

.multimodal-timeline-emotion-block strong {
  font-size: 0.72rem;
  line-height: 1.1;
  color: var(--ink);
}

.multimodal-timeline-emotion-block span {
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--ink-soft);
}

.multimodal-timeline-chart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.multimodal-timeline-chart-guide {
  stroke: color-mix(in srgb, var(--line-strong) 22%, transparent 78%);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.multimodal-timeline-chart-path {
  fill: none;
  stroke: #1f5fae;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.multimodal-timeline-chart-point {
  fill: #ffffff;
  stroke: #1f5fae;
  stroke-width: 1.5;
}

.multimodal-timeline-chart-svg--entropy .multimodal-timeline-chart-path {
  stroke: #9b5d11;
}

.multimodal-timeline-chart-svg--entropy .multimodal-timeline-chart-point {
  stroke: #9b5d11;
}

.multimodal-timeline-chart-svg--speech-rate .multimodal-timeline-chart-path {
  stroke: #2d8a4d;
}

.multimodal-timeline-chart-svg--speech-rate .multimodal-timeline-chart-point {
  stroke: #2d8a4d;
}

.multimodal-timeline-chart-svg--audio-curve .multimodal-timeline-chart-path {
  stroke: #b83838;
}

.multimodal-timeline-chart-svg--audio-curve .multimodal-timeline-chart-point {
  stroke: #b83838;
}

.multimodal-segment-sync-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

#multimodalAlignPreview,
#multimodalSegmentsSyncGallery,
#multimodalAlignTable {
  max-width: 1080px;
  width: 100%;
  margin-inline: auto;
}

.multimodal-segment-sync-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
}

.multimodal-segment-sync-header {
  padding: 0.72rem 0.8rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

.multimodal-segment-sync-header h4 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.multimodal-segment-sync-meta {
  margin: 0.28rem 0 0;
  color: var(--ink-faint);
  font-size: 0.78rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.multimodal-segment-sync-body {
  display: block;
  padding: 0.72rem 0.8rem 0.82rem;
}

.multimodal-segment-sync-text p {
  margin: 0;
  line-height: 1.55;
}

.multimodal-segment-sync-image {
  display: grid;
  gap: 0.55rem;
}

.multimodal-alignment-segment-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.multimodal-alignment-segment-gallery-item {
  margin: 0;
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.multimodal-segment-sync-image img {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.multimodal-segment-sync-text-caption {
  margin: 0;
  line-height: 1.42;
  font-size: 0.88rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.multimodal-segment-sync-highlight {
  background: color-mix(in srgb, #ffe766 82%, white 18%);
  color: #351f00;
  padding: 0.04rem 0.18rem;
  border-radius: 0.22rem;
  font-weight: 700;
}

.multimodal-segment-sync-emotion {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, #f0f5fa 12%);
  padding: 0.7rem 0.8rem;
}

.multimodal-segment-sync-emotion-title {
  margin: 0 0 0.2rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.multimodal-segment-sync-emotion-meta {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.multimodal-segment-sync-text-list {
  display: grid;
  gap: 0.7rem;
}

.multimodal-segment-sync-text-entry {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 92%, #f7f2eb 8%);
  padding: 0.58rem 0.68rem;
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.comparison-ab-moment-list {
  display: grid;
  gap: 0.9rem;
}

.comparison-ab-moment-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 94%, #f8f4ef 6%);
  padding: 0.95rem 1rem;
  display: grid;
  gap: 0.85rem;
}

.comparison-ab-moment-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.55rem 1rem;
}

.comparison-ab-moment-header h4 {
  margin: 0;
  font-size: 1rem;
}

.comparison-ab-moment-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.comparison-ab-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem;
}

.comparison-ab-column {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 0.85rem;
  display: grid;
  gap: 0.55rem;
  min-width: 0;
}

.comparison-ab-column h5 {
  margin: 0;
  font-size: 0.96rem;
}

.comparison-ab-column img {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.comparison-ab-text {
  margin: 0;
  line-height: 1.45;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.comparison-ab-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.comparison-ab-hidden-source {
  display: none;
}

.comparison-ab-results-card {
  position: relative;
}

.comparison-ab-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-bottom: 0.4rem;
}

.comparison-ab-results-header h3 {
  margin: 0;
}

.comparison-ab-results-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.comparison-ab-results-main {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.comparison-ab-timeline-tables {
  display: grid;
  gap: 1rem;
}

.comparison-ab-timeline-card {
  display: grid;
  gap: 0.8rem;
  padding: 0.95rem 1rem;
}

.comparison-ab-timeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.comparison-ab-timeline-title {
  margin: 0;
  font-size: 1rem;
}

.comparison-ab-timeline-source {
  margin: 0.18rem 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.comparison-ab-timeline-table {
  min-width: 0;
}

.comparison-ab-settings-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 95%, #f2f6fa 5%);
  padding: 0.95rem 1rem;
  display: grid;
  gap: 0.8rem;
  align-content: start;
  min-width: 0;
}

.comparison-ab-settings-panel h4 {
  margin: 0;
  font-size: 0.98rem;
}

.comparison-ab-settings-sections {
  display: grid;
  gap: 0.85rem;
}

.comparison-ab-settings-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 0.8rem 0.9rem;
  display: grid;
  gap: 0.45rem;
}

.comparison-ab-settings-block h5 {
  margin: 0;
  font-size: 0.9rem;
}

.comparison-ab-settings-block .readonly-field {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comparison-ab-results-card.is-fullscreen {
  position: fixed;
  inset: 0.85rem;
  z-index: 1200;
  margin: 0;
  max-width: none;
  width: auto;
  overflow: auto;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

body.comparison-ab-fullscreen-open {
  overflow: hidden;
}

.comparison-ab-results-card.is-fullscreen .comparison-ab-results-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.comparison-ab-results-card.is-fullscreen .comparison-ab-settings-panel {
  position: sticky;
  top: 0;
}

#multimodalAlignTable .result-table-wrap {
  width: 100%;
  overflow-x: hidden;
}

#multimodalAlignTable .result-table {
  width: 100%;
  table-layout: fixed;
  font-size: 0.74rem;
}

#multimodalAlignTable .result-table th,
#multimodalAlignTable .result-table td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
  line-height: 1.22;
  padding: 0.42rem 0.46rem;
}

#multimodalAlignTable .result-table th {
  position: static;
}

@media (max-width: 1100px) {
  .multimodal-timeline-shell {
    grid-template-columns: 126px minmax(0, 1fr);
  }

  .multimodal-timeline-label {
    padding-inline: 0.62rem;
  }

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

  .multimodal-alignment-segment-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .comparison-ab-results-card.is-fullscreen .comparison-ab-results-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .multimodal-timeline-shell {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .multimodal-timeline-label strong {
    font-size: 0.78rem;
  }

  .multimodal-timeline-label span,
  .multimodal-timeline-label--ruler,
  .multimodal-timeline-tick span,
  .multimodal-timeline-image-item figcaption,
  .multimodal-timeline-text-block strong,
  .multimodal-timeline-text-block span {
    font-size: 0.66rem;
  }

  .multimodal-segment-sync-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .multimodal-alignment-segment-gallery {
    grid-template-columns: minmax(0, 1fr);
  }

  .comparison-ab-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .comparison-ab-results-header {
    align-items: stretch;
    flex-direction: column;
  }
}

.motion-metrics-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 0.55rem;
  margin: 0;
  padding: 0.8rem 0.9rem 0.95rem;
  font-size: 0.82rem;
  line-height: 1.35;
}

.motion-metrics-list dt {
  color: var(--ink-faint);
  margin: 0;
}

.motion-metrics-list dd {
  margin: 0;
  text-align: right;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

#multimodalImagesGallery {
  max-height: 68vh;
  overflow: auto;
}

.motion-result-panel {
  max-width: 820px;
  margin-inline: auto;
}

.motion-result-panel[data-motion-result-panel="anatomie"] {
  max-width: 1280px;
}

#multimodalMotionAnatomyGallery {
  max-width: 1280px;
  margin-inline: auto;
}

#multimodalMotionAnatomyGallery .result-gallery {
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 1rem;
}

#multimodalMotionAnatomyGallery .result-gallery-item img {
  min-height: 300px;
  object-fit: contain;
  background: #fff;
}

@media (max-width: 1100px) {
  .motion-result-panel[data-motion-result-panel="anatomie"] {
    max-width: 980px;
  }

  #multimodalMotionAnatomyGallery {
    max-width: 980px;
  }

  #multimodalMotionAnatomyGallery .result-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  #multimodalMotionAnatomyGallery .result-gallery {
    grid-template-columns: minmax(0, 1fr);
  }

}

#multimodalVideoPreview {
  max-width: 820px;
  margin-inline: auto;
}

.result-video {
  display: block;
  width: min(100%, 780px);
  max-width: 780px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #000;
}

.result-gallery-item img.is-clickable {
  cursor: zoom-in;
}

#suiviFrisesEmergences .result-gallery {
  grid-template-columns: 1fr;
}

#suiviFrisesEmergences .result-gallery-item h4 {
  font-size: 1.04rem;
  line-height: 1.35;
}

#suiviFrisesEmergences .result-gallery-item img {
  max-height: none;
}

.result-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.result-table th,
.result-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.result-table th {
  position: sticky;
  top: 0;
  background: var(--surface-strong);
  z-index: 1;
}

.result-table tr.is-chd-non-significant td {
  color: #842029;
}

.result-table tr.is-chd-non-significant .cell-button {
  color: #842029;
}

.result-table td.is-chd-non-significant-cell {
  color: #842029;
  font-weight: 600;
}

.result-table td.is-chd-non-significant-cell .cell-button,
.result-table .cell-button.is-chd-non-significant-cell {
  color: #842029;
  font-weight: 600;
}

.result-table-caption {
  margin: 0 0 0.65rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.annotation-import-help {
  margin-bottom: 1rem;
}

.annotation-danger-actions + .annotation-danger-actions {
  margin-top: 0.9rem;
}

.annotation-add-actions {
  margin-bottom: 0.9rem;
}

.form-grid + .toolbar {
  margin-top: 0.9rem;
}

.cell-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #9f1d20;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cell-button:hover,
.cell-button:focus-visible {
  text-decoration: underline;
}

.result-table-section-title {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  color: var(--ink);
}

.lda-matrix-term-cell {
  font-weight: 600;
  color: var(--ink);
}

.lda-topic-inline-prob {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 500;
}

.lda-matrix-max-cell {
  background: linear-gradient(180deg, rgba(159, 47, 42, 0.16), rgba(159, 47, 42, 0.06));
  color: #7d1d18;
  font-weight: 700;
}

.lda-topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.lda-topic-sections {
  display: grid;
  gap: 1rem;
}

.lda-topic-section {
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
}

.lda-topic-section-title {
  margin: 0 0 0.7rem;
  font-size: 0.98rem;
  color: var(--ink);
}

.lda-segment-panels {
  margin-top: 0.9rem;
}

.lda-segment-panel {
  padding-top: 0.2rem;
}

.lda-segment-caption {
  margin-bottom: 0.7rem;
}

.lda-segment-text-cell {
  min-width: 34rem;
}

.lda-segment-text {
  white-space: normal;
  line-height: 1.42;
  color: var(--ink);
}

.lda-segment-mark {
  background: #ffe56b;
  color: #3b2f06;
  padding: 0 0.08rem;
  border-radius: 0.18rem;
}

.lda-segment-prob-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: #7d1d18;
  font-weight: 700;
}

.lda-segment-id-cell {
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.lda-topic-card {
  border: 1px solid color-mix(in srgb, var(--lda-topic-color) 26%, var(--line));
  border-radius: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--lda-topic-color) 7%, white), #fff 26%);
  overflow: hidden;
}

.lda-topic-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--lda-topic-color) 18%, var(--line));
}

.lda-topic-card-head h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
}

.lda-topic-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--lda-topic-color);
  background: color-mix(in srgb, var(--lda-topic-color) 12%, white);
  border: 1px solid color-mix(in srgb, var(--lda-topic-color) 22%, var(--line));
}

.lda-topic-table-wrap {
  overflow: auto;
}

.lda-topic-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.89rem;
}

.lda-topic-table th,
.lda-topic-table td {
  padding: 0.68rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.lda-topic-table th {
  font-size: 0.77rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: transparent;
}

.lda-topic-table tbody tr:last-child td {
  border-bottom: 0;
}

.lda-topic-table tr.is-lda-term-strong {
  background: color-mix(in srgb, var(--lda-topic-color) 10%, white);
}

.lda-topic-table tr.is-lda-term-medium {
  background: color-mix(in srgb, var(--lda-topic-color) 4%, white);
}

.lda-topic-table tr.is-lda-term-soft {
  background: color-mix(in srgb, var(--lda-topic-color) 2%, white);
}

.lda-term-cell {
  font-weight: 600;
  color: var(--ink);
}

.lda-topic-table tr.is-lda-term-strong .lda-term-cell {
  color: var(--lda-topic-color);
}

.lda-topic-table tr.is-lda-term-medium .lda-term-cell {
  color: color-mix(in srgb, var(--lda-topic-color) 74%, var(--ink));
}

.lda-topic-table tr.is-lda-term-soft .lda-term-cell {
  color: color-mix(in srgb, var(--lda-topic-color) 52%, var(--ink));
}

.lda-probability-cell {
  min-width: 9.5rem;
}

.lda-relative-score-cell {
  min-width: 10.5rem;
}

.lda-probability-meter {
  position: relative;
  height: 1.5rem;
  border-radius: 999px;
  background: #f3efe8;
  overflow: hidden;
}

.lda-probability-bar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--lda-topic-color), color-mix(in srgb, var(--lda-topic-color) 58%, white));
  opacity: 0.92;
}

.lda-relative-meter {
  position: relative;
  height: 1.5rem;
  border-radius: 999px;
  background: #eef4f6;
  overflow: hidden;
}

.lda-relative-bar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2c7a7b, #8ecfd1);
  opacity: 0.94;
}

.lda-probability-value {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  height: 100%;
  padding: 0 0.6rem;
  font-size: 0.83rem;
  color: #1b1b1b;
}

.lda-topic-table tr.is-lda-term-strong .lda-probability-meter {
  background: color-mix(in srgb, var(--lda-topic-color) 12%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lda-topic-color) 30%, var(--line));
}

.lda-topic-table tr.is-lda-term-medium .lda-probability-meter {
  background: color-mix(in srgb, var(--lda-topic-color) 8%, white);
}

.lda-topic-table tr.is-lda-term-soft .lda-probability-meter {
  background: color-mix(in srgb, var(--lda-topic-color) 5%, white);
}

.lda-topic-table tr.is-lda-term-strong .lda-probability-value {
  color: color-mix(in srgb, var(--lda-topic-color) 82%, #111);
  font-weight: 800;
}

.lda-topic-table tr.is-lda-term-medium .lda-probability-value {
  color: color-mix(in srgb, var(--lda-topic-color) 66%, #111);
  font-weight: 700;
}

.lda-topic-table tr.is-lda-term-soft .lda-probability-value {
  color: color-mix(in srgb, var(--lda-topic-color) 52%, #111);
  font-weight: 700;
}

.lda-summary-row--0 td {
  background: rgba(159, 47, 42, 0.05);
}

.lda-summary-row--1 td {
  background: rgba(44, 122, 123, 0.05);
}

.lda-summary-row--2 td {
  background: rgba(183, 121, 31, 0.05);
}

.lda-summary-row--3 td {
  background: rgba(107, 70, 193, 0.05);
}

.afc-segment-cell {
  white-space: normal;
  min-width: 26rem;
  line-height: 1.45;
}

.afc-highlight {
  background-color: yellow;
  color: inherit;
  font-weight: inherit;
  padding: 0;
  border-radius: 0;
}

.embedded-frame {
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.embedded-frame--concordancier {
  min-height: 64vh;
}

.concordancier-class-tabs {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.concordancier-class-tab {
  padding-inline: 0.9rem;
}

.concordancier-class-tab.is-active {
  background: var(--button-primary);
  border-color: var(--button-primary);
  color: #fff;
  box-shadow: 0 8px 20px var(--button-primary-shadow);
}

.concordancier-class-panels {
  display: grid;
  gap: 0.8rem;
}

.concordancier-class-panel[hidden] {
  display: none !important;
}

#simiGraph {
  overflow: auto;
}

.prose-card p {
  margin: 0;
  max-width: 60rem;
  color: var(--ink-soft);
  line-height: 1.7;
}

.markdown-content {
  color: var(--ink-soft);
  line-height: 1.7;
}

.markdown-content > :first-child {
  margin-top: 0;
}

.markdown-content h1,
.markdown-content h4 {
  color: var(--ink);
  margin: 1.2rem 0 0.6rem;
}

.markdown-content h2 {
  color: #9f1d20;
  margin: 1.2rem 0 0.6rem;
}

.markdown-content h3 {
  color: #2f2a27;
  margin: 1.2rem 0 0.6rem;
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content blockquote,
.markdown-content figure {
  margin: 0 0 0.95rem;
}

.markdown-content ul,
.markdown-content ol {
  padding-left: 1.3rem;
}

.markdown-content blockquote {
  padding-left: 1rem;
  border-left: 3px solid var(--accent-line);
  color: var(--ink);
}

.markdown-content code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.35rem;
  background: rgba(159, 29, 32, 0.08);
  font-size: 0.92em;
}

.markdown-content a {
  color: #9f1d20;
}

.markdown-figure img {
  display: block;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.markdown-figure figcaption,
.markdown-image-error {
  margin-top: 0.45rem;
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.app-dialog {
  width: min(1100px, calc(100vw - 3rem));
  max-height: calc(100vh - 3rem);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  box-shadow: 0 30px 70px rgba(19, 18, 16, 0.24);
}

.app-dialog::backdrop {
  background: rgba(18, 18, 18, 0.42);
  backdrop-filter: blur(4px);
}

.dialog-panel {
  width: min(1100px, calc(100vw - 3rem));
  max-height: calc(100vh - 3rem);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  box-shadow: none;
}

.dialog-panel::backdrop {
  background: rgba(18, 18, 18, 0.42);
  backdrop-filter: blur(4px);
}

.dialog-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100vh - 3rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(250, 248, 245, 0.98);
}

.dialog-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100vh - 3rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background: rgba(250, 248, 245, 0.98);
  box-shadow: 0 30px 70px rgba(19, 18, 16, 0.24);
}

.dialog-head,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.dialog-header,
.dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.dialog-actions {
  border-bottom: 0;
  border-top: 1px solid var(--line);
}

.dialog-footer {
  border-bottom: 0;
  border-top: 1px solid var(--line);
}

.dialog-body {
  overflow: auto;
  padding: 1.2rem;
  display: grid;
  gap: 1rem;
}

.dialog-body .card {
  box-shadow: none;
  border: 1px solid var(--line);
  background: transparent;
}

.dialog-body .fields-grid,
.dialog-body .fields-grid--compact,
.dialog-body .form-grid,
.dialog-body .field-inline,
.dialog-body .stack-grid,
.dialog-body .stack-grid--two,
.dialog-body .section-stack {
  grid-template-columns: 1fr;
  gap: 0;
}

.dialog-body .field {
  width: 100%;
  padding: 0.95rem 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.dialog-body .field:first-child {
  padding-top: 0.15rem;
}

.dialog-body .field:last-child {
  border-bottom: 0;
  padding-bottom: 0.15rem;
}

.dialog-body .field-inline > .field:last-child,
.dialog-body .fields-grid > .field:last-child,
.dialog-body .fields-grid--compact > .field:last-child,
.dialog-body .form-grid > .field:last-child {
  border-bottom: 0;
}

.dialog-body .field--full {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.dialog-body .section-head {
  margin-bottom: 0.4rem;
}

.dialog-body .card h3 {
  margin-bottom: 0.25rem;
}

.dialog-body .section-copy {
  margin-bottom: 0.55rem;
}

.segments-popup-list {
  display: grid;
  gap: 0.75rem;
}

.segment-popup-item {
  margin: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  line-height: 1.65;
  white-space: normal;
}

.segment-popup-item mark {
  padding: 0.05rem 0.2rem;
  border-radius: 0.2rem;
  background: rgba(159, 29, 32, 0.14);
  color: #7e1719;
}

.term-segments-list {
  display: grid;
  gap: 0.8rem;
  padding: 1rem 1.1rem 1.15rem;
  overflow: auto;
}

.term-segments-status {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.25;
  flex: 1;
}

.dialog-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
}

.term-segments-status.is-error {
  color: #a02222;
}

.term-action-group {
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
}

.term-action-group h3 {
  margin: 0;
  font-size: 0.98rem;
  color: var(--ink);
}

.term-action-group-meta {
  margin: -0.25rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.term-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
}

.chi2-comparison-chart-wrap {
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.chi2-comparison-chart {
  display: block;
  width: 100%;
  min-width: 740px;
  height: auto;
}

.term-stat-card {
  display: grid;
  gap: 0.2rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(250, 248, 245, 0.92);
}

.term-stat-card dt {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.term-stat-card dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 600;
}

.context-menu {
  position: fixed;
  z-index: 1900;
  display: grid;
  gap: 0.2rem;
  min-width: 260px;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 45px rgba(19, 18, 16, 0.16);
}

.context-menu[hidden] {
  display: none;
}

.context-menu-item {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.context-menu-item:hover,
.context-menu-item:focus-visible {
  background: rgba(159, 29, 32, 0.08);
  color: #7e1719;
  outline: none;
}

.progress-dialog {
  position: fixed;
  inset: auto 1.25rem 1.25rem auto;
  width: min(420px, calc(100vw - 2rem));
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.progress-dialog:not([open]) {
  display: none;
}

.progress-dialog[open] {
  display: block;
  z-index: 1600;
  width: min(520px, calc(100vw - 2rem));
  margin: auto;
}

.progress-dialog::backdrop {
  background: rgba(18, 16, 13, 0.28);
  backdrop-filter: blur(6px);
}

.progress-dialog-shell {
  display: grid;
  gap: 0.8rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 22px 50px rgba(19, 18, 16, 0.18);
}

.progress-dialog-shell h3 {
  margin: 0;
  font-size: 1rem;
}

.progress-dialog-shell .muted {
  margin: 0;
}

.progress-dialog-card {
  display: grid;
  gap: 0.8rem;
  padding: 1.15rem 1.15rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 22px 50px rgba(19, 18, 16, 0.18);
}

.progress-dialog-card h2,
.progress-dialog-card h3 {
  margin: 0;
  font-size: 1rem;
}

.progress-dialog-card .muted,
.progress-dialog-card .progress-value {
  margin: 0;
}

.progress-dialog-card progress {
  width: 100%;
  height: 14px;
}

.progress-dialog-card .progress-value {
  font-weight: 700;
  text-align: right;
}

.progress-wrap--dialog {
  margin-bottom: 0;
}

.startup-dialog {
  width: min(520px, calc(100vw - 2rem));
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.startup-dialog:not([open]) {
  display: none;
}

.startup-dialog[open] {
  display: block;
  z-index: 1800;
}

.startup-dialog::backdrop {
  background: rgba(18, 16, 13, 0.26);
  backdrop-filter: blur(6px);
}

.startup-dialog-shell {
  display: grid;
  gap: 0.9rem;
  padding: 1.2rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 60px rgba(19, 18, 16, 0.22);
}

.startup-dialog-shell h3 {
  margin: 0;
  font-size: 1.08rem;
}

.startup-dialog-shell .muted {
  margin: 0;
}

.image-preview-dialog {
  width: min(1680px, calc(100vw - 1.5rem));
  max-width: calc(100vw - 1.5rem);
  max-height: calc(100vh - 1.5rem);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  box-shadow: 0 30px 70px rgba(19, 18, 16, 0.24);
}

.image-preview-dialog::backdrop {
  background: rgba(18, 18, 18, 0.46);
  backdrop-filter: blur(4px);
}

.image-preview-shell {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(250, 248, 245, 0.99);
  max-height: calc(100vh - 1.5rem);
  overflow: hidden;
}

.image-preview-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.image-preview-counter {
  margin: 0;
  min-width: 6.5rem;
  text-align: right;
}

.image-preview-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem 0.75rem;
}

.image-preview-body,
.image-preview-content {
  display: grid;
  place-items: center;
  padding: 0.75rem;
  max-height: calc(100vh - 7rem);
  overflow: auto;
}

.image-preview-body img,
.image-preview-content img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 3rem);
  max-height: calc(100vh - 8rem);
  object-fit: contain;
}

.image-preview-nav {
  align-self: center;
  min-width: 3rem;
  min-height: 3rem;
  border-radius: 999px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.image-preview-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.multimodal-face-selection-stage {
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
}

.multimodal-face-selection-surface {
  position: relative;
  display: inline-block;
  max-width: 100%;
  cursor: crosshair;
  user-select: none;
}

.multimodal-face-selection-surface img {
  display: block;
  max-width: min(900px, calc(100vw - 8rem));
  max-height: min(70vh, 780px);
  object-fit: contain;
  border-radius: 12px;
}

.multimodal-face-selection-overlay {
  position: absolute;
  inset: 0;
}

.multimodal-face-selection-box {
  position: absolute;
  border: 2px solid #b71c1c;
  background: rgba(183, 28, 28, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9) inset;
  pointer-events: none;
}

code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.35rem;
  background: rgba(23, 23, 23, 0.06);
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .multimodal-segment-sync-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .stack-grid--two,
  .fields-grid,
  .fields-grid--compact,
  .form-grid,
  .field-inline {
    grid-template-columns: 1fr;
  }

  .page-heading,
  .card-head,
  .section-head {
    flex-direction: column;
  }

  .result-gallery {
    grid-template-columns: 1fr;
  }

  #suiviEntropyPlot .result-image,
  #suiviRedundancyPlot .result-image,
  #suiviJsdSuccessivePlot .result-image,
  #suiviJsdReferencePlot .result-image {
    width: 100%;
    max-width: none;
  }

  #suiviMatrixPlot .result-image {
    width: auto;
    max-width: none;
    min-width: 900px;
  }

  #afcClassesPlot .result-image,
  #afcTermsPlot .result-image,
  #afcVarsPlot .result-image {
    width: 100%;
    max-width: none;
  }

  #suiviMeta .result-table,
  #suiviIndicatorsTable .result-table,
  #suiviJsdSuccessiveTable .result-table,
  #suiviJsdReferenceTable .result-table,
  #suiviTermsTable .result-table,
#suiviContributionsTable .result-table,
  #suiviMatrixTable .result-table {
    font-size: 0.74rem;
  }

  #suiviMeta .result-table th,
  #suiviMeta .result-table td,
  #suiviIndicatorsTable .result-table th,
  #suiviIndicatorsTable .result-table td,
  #suiviJsdSuccessiveTable .result-table th,
  #suiviJsdSuccessiveTable .result-table td,
  #suiviJsdReferenceTable .result-table th,
  #suiviJsdReferenceTable .result-table td,
  #suiviTermsTable .result-table th,
  #suiviTermsTable .result-table td,
#suiviContributionsTable .result-table th,
#suiviContributionsTable .result-table td,
  #suiviMatrixTable .result-table th,
  #suiviMatrixTable .result-table td {
    min-width: 5rem;
    padding: 0.42rem 0.46rem;
  }

  #suiviTermsTable .result-table th:nth-child(6),
  #suiviTermsTable .result-table td:nth-child(6),
  #suiviTermsTable .result-table th:nth-child(7),
  #suiviTermsTable .result-table td:nth-child(7),
  #suiviTermsTable .result-table th:nth-child(8),
  #suiviTermsTable .result-table td:nth-child(8) {
    min-width: 10rem;
    max-width: 10rem;
  }

  #suiviContributionsTable .result-table th:nth-child(5),
  #suiviContributionsTable .result-table td:nth-child(5),
  #suiviContributionsTable .result-table th:nth-child(6),
  #suiviContributionsTable .result-table td:nth-child(6),
  #suiviContributionsTable .result-table th:nth-child(7),
  #suiviContributionsTable .result-table td:nth-child(7),
  #suiviContributionsTable .result-table th:nth-child(8),
  #suiviContributionsTable .result-table td:nth-child(8) {
    min-width: 9rem;
    max-width: 9rem;
  }

  #afcTermsTable .result-table,
  #afcVarsTable .result-table,
  #afcEigTable .result-table {
    font-size: 0.74rem;
  }

  #afcTermsTable .result-table th,
  #afcTermsTable .result-table td,
  #afcVarsTable .result-table th,
  #afcVarsTable .result-table td,
  #afcEigTable .result-table th,
  #afcEigTable .result-table td {
    min-width: 5rem;
    padding: 0.42rem 0.46rem;
  }
}
