/* ---------- Twins (SA-007) ---------- */

/* The line on a persona card, under its segment. */
.twins-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-gray);
    font-size: 0.84rem;
}

.twins-line__none { color: var(--text-gray); }

.twins-line__link {
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.twins-line__link:hover { color: var(--accent-dark); }
.twins-line .badge { min-width: 0; padding: 2px 8px; font-size: 0.68rem; }

.twins-acts { align-items: center; }
.twins-count .ac-select { min-width: 140px; }
.twins-acts .btn-primary { padding: 11px 18px; font-size: 0.9rem; }

.twins-note {
    margin-bottom: 20px;
    border-color: #F0D9A8;
    background: #FFFBF0;
    font-size: 0.9rem;
}

.tile__value .tip-icon { margin-left: 6px; vertical-align: middle; }
.twins-countries { margin-top: 16px; }

.data-table .row-group td {
    padding: 14px 16px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    background: none;
}

.data-table--static tbody tr.row-group:hover { background: none; }
.data-table .row-aimed td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.twins-facets td { padding-top: 8px; padding-bottom: 8px; }
.aim-word { color: var(--text-gray); font-size: 0.8rem; margin-right: 2px; }

/* A score on a strip from −1.5 to +1.5 standard deviations. */
.fstrip-cell { width: 42%; min-width: 220px; }

.fstrip {
    position: relative;
    height: 16px;
    border-radius: 999px;
    background: var(--light-gray);
}

.fstrip__zero {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-strong);
}

.fstrip__band {
    position: absolute;
    top: 4px;
    height: 8px;
    border-radius: 999px;
    background: rgba(10, 10, 10, 0.12);
}

.fstrip__aim,
.fstrip__mean {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.fstrip__aim {
    width: 14px;
    height: 14px;
    border: 2px solid var(--accent);
    background: var(--white);
}

.fstrip__mean {
    width: 8px;
    height: 8px;
    background: var(--primary);
}

.fstrip-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 4px 0 10px;
    font-size: 0.8rem;
    color: var(--text-gray);
}

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

.fstrip-key { display: inline-block; border-radius: 50%; }
.fstrip-key--mean { width: 8px; height: 8px; background: var(--primary); }
.fstrip-key--aim { width: 12px; height: 12px; border: 2px solid var(--accent); }
.fstrip-key--band { width: 22px; height: 8px; border-radius: 999px; background: rgba(10, 10, 10, 0.12); }

.twin-words {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    white-space: normal !important;
    min-width: 320px;
}

.twin-card .chips { margin: 10px 0 14px; }
.twin-facets td { padding-top: 6px; padding-bottom: 6px; }
.twins-how .badge + .badge { margin-left: 6px; }

/* ---------- Facet chips from the twins (SA-014) ---------- */

.seg__tilt-label {
    margin: 2px 0 6px;
    font-size: 0.76rem;
    color: var(--text-gray);
}

/* ---------- The persona's personality (SA-015) ---------- */

.psych {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-gray);
    font-size: 0.84rem;
}

.psych[hidden] { display: none; }
.psych__head { display: flex; align-items: center; }
.psych__none,
.psych__fits,
.psych__note { margin: 0; color: var(--text-gray); font-size: 0.8rem; }

.psych__clash {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.psych__clash-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--accent-dark);
}

.psych__clash-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 6px;
    padding: 4px 8px;
    border-left: 2px solid var(--accent);
    background: var(--light-gray);
    border-radius: 0 6px 6px 0;
    font-size: 0.8rem;
    color: var(--ink-soft);
}

.psych__clash-row b { font-weight: 600; color: var(--primary); }
.psych__clash-arrow { color: var(--text-faint); }
.psych__clash-row.has-tip:hover,
.psych__clash-row.has-tip--open { background: var(--accent-wash); }

.psych__stale {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    color: var(--text-gray);
    font-size: 0.8rem;
}

.psych__stale .badge { min-width: 0; padding: 2px 8px; font-size: 0.68rem; }
.psych__why { text-decoration: underline dotted; text-underline-offset: 3px; }
.psych__why:hover,
.psych__why.has-tip--open { color: var(--primary); }

.chat-profile__psych { margin: 4px 0 6px; padding-bottom: 14px; border-bottom: 1px dashed var(--border-gray); }

/* ---------- Twin ages (SA-013) ---------- */

.twins-ages {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 18px;
    max-width: 640px;
    font-size: 0.84rem;
}

.twins-ages__head { font-weight: 700; color: var(--primary); margin-bottom: 2px; }

.twins-ages__row {
    display: grid;
    grid-template-columns: 56px 1fr 72px 110px;
    align-items: center;
    gap: 10px;
}

.twins-ages__label { font-variant-numeric: tabular-nums; color: var(--ink-soft); }

.twins-ages__track {
    position: relative;
    height: 10px;
    background: var(--light-gray);
    border-radius: 5px;
}

.twins-ages__bar {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--primary);
    border-radius: 5px;
}

/* Where an even spread would end: a thin accent tick. */
.twins-ages__even {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 2px;
    margin-left: -1px;
    background: var(--accent);
}

.twins-ages__num { font-variant-numeric: tabular-nums; font-weight: 600; }
.twins-ages__note { color: var(--text-gray); font-size: 0.78rem; }

@media (max-width: 640px) {
    .twins-ages__row { grid-template-columns: 48px 1fr 64px; }
    .twins-ages__note { display: none; }
}

/* The twins' trait chips: their own block after the segment facts (owner, 2026-09-25). */
.seg-tilt { font-size: 0.84rem; margin-top: -6px; }
.seg-tilt:empty { display: none; }
.psych__clash-key { font-weight: 700; color: var(--primary); }

/* Persona attributes (differs_by): rectangles, not pills — they are facts, not traits (owner, 2026-09-25). */
.chip.chip--attr { border-radius: 6px; padding: 3px 9px; }

.seg__where { display: flex; align-items: center; font-size: 0.76rem; color: var(--text-gray); margin-bottom: 4px; }
.raw-score { font-variant-numeric: tabular-nums; }

/* ---------- Tests of a hypothesis on twins (SA-008) ---------- */

/* On the card: the latest test, as one link-line. */
.hyp__test {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 9px 11px;
    border-radius: 8px;
    background: var(--light-gray);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.82rem;
}

.hyp__test:hover { background: #EDEDED; }
.hyp__test .badge { min-width: 0; }
.hyp__test-headline { flex: 1 1 100%; color: var(--ink-soft); }
.hyp__test-link { margin-left: auto; font-weight: 600; color: var(--accent-dark); }
.hyp__acts .btn .icon { margin-right: 4px; }

/* The verdict, black and white plus the accent: confirmed is solid black,
   refuted the accent, unclear an outline. */
.verdict {
    display: inline-flex;
    align-items: center;
    padding: 3px 11px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1px solid transparent;
}

.verdict--confirmed { background: var(--primary); color: var(--white); }
.verdict--refuted { background: var(--accent); color: var(--white); }
.verdict--unclear { background: var(--white); color: var(--primary); border-color: var(--border-strong); }

/* The Validate dialog. */
.test-dlg__statement {
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 6px;
}

.test-dlg__groups {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 18px;
}

.test-dlg__group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 10px 12px;
    border: 1px solid var(--border-gray);
    border-radius: 10px;
}

.test-dlg__group.is-off { opacity: 0.55; }
.test-dlg__group .ac-check { flex: 0 0 auto; }
.test-dlg__tag { font-size: 0.75rem; color: var(--text-gray); }
.test-dlg__count { margin-left: auto; font-size: 0.8rem; color: var(--text-gray); }
.test-dlg__size { max-width: 320px; }
.test-dlg__size + .test-dlg__size { margin-top: 14px; }
.test-dlg__hint { margin-top: 6px; font-size: 0.8rem; }

.test-estimate {
    margin-top: 16px;
    padding: 14px 16px;
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    background: var(--light-gray);
    font-size: 0.86rem;
}

.test-estimate__main { font-size: 1rem; margin-bottom: 4px; }

/* The test page. */
.test-head { flex: 1 1 520px; min-width: 0; }
.test-head h2 { line-height: 1.35; }
.test-panel { margin-bottom: 20px; padding: 26px 32px; }
.test-panel .section-note .tip-icon { margin-left: 4px; }

.test-progress { margin: 6px 0 10px; height: 8px; }
.test-progress__text { font-size: 0.9rem; margin-bottom: 10px; }
.test-progress__groups { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.test-recent { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.test-error { color: #B42318; font-size: 0.86rem; margin-top: 8px; }

.test-quote {
    margin: 8px 0 0;
    padding-left: 10px;
    border-left: 3px solid var(--accent);
    font-style: italic;
    color: var(--ink-soft);
    font-size: 0.86rem;
}

.test-quote cite {
    font-style: normal;
    font-size: 0.78rem;
    color: var(--text-gray);
}

.test-verdict__head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.test-verdict__head .verdict { font-size: 0.85rem; padding: 5px 14px; }
.test-verdict__headline { font-size: 1.1rem; font-weight: 700; line-height: 1.4; margin-bottom: 8px; }
.test-verdict__text { line-height: 1.6; margin-bottom: 14px; }
.test-verdict__expected { margin: 12px 0 16px; }

.test-checks { display: flex; flex-direction: column; gap: 8px; }
.test-check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.88rem; }
.test-check__mark {
    flex: 0 0 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    border: 1px solid var(--border-strong);
}
.test-check--met .test-check__mark { background: var(--primary); color: var(--white); border-color: var(--primary); }
.test-check--not_met .test-check__mark { background: var(--accent); color: var(--white); border-color: var(--accent); }
.test-check__claim { font-weight: 600; }
.test-check__numbers { color: var(--text-gray); font-size: 0.82rem; }

.test-tiles { margin-top: 4px; }

.test-warn { border-left: 3px solid var(--accent); }
.test-warn__list { padding-left: 20px; font-size: 0.88rem; }
.test-warn__list li + li { margin-top: 4px; }

.test-table { font-size: 0.86rem; }
.test-table td { vertical-align: top; }
.test-row--base td { background: #FAFAFA; }
.test-grouphead { min-width: 170px; }
.data-table th.test-grouphead { white-space: normal; }
.test-grouphead__sub { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.72rem; color: var(--text-faint); }

.data-table td.test-stim { width: 38%; min-width: 260px; white-space: normal; }
.test-stim .stimulus__label { display: inline-block; min-width: 0; margin-right: 8px; }
.test-stim__text { color: var(--ink-soft); }

.test-cell { min-width: 170px; }
.test-cell__main { display: flex; align-items: baseline; gap: 8px; }
.test-cell__main b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.test-cell__range { font-size: 0.76rem; color: var(--text-gray); font-variant-numeric: tabular-nums; }
.test-cell__sub { font-size: 0.74rem; color: var(--text-gray); margin-top: 3px; }

/* The 95% range as a whisker on a 0–100% track. */
.whisker { position: relative; height: 10px; margin: 6px 0 2px; background: var(--light-gray); border-radius: 5px; }
.whisker__range { position: absolute; top: 3px; height: 4px; background: var(--border-strong); border-radius: 2px; }
.whisker__dot { position: absolute; top: 1px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--primary); }
.whisker__zero { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--text-faint); }

/* Answers 1 → 5 as one stacked bar: greys for 1–3, the accent for 4 and 5. */
.dist { display: flex; height: 6px; margin-top: 6px; border-radius: 3px; overflow: hidden; background: var(--light-gray); }
.dist__part { display: block; height: 100%; }
.dist__part--1 { background: #D4D4D4; }
.dist__part--2 { background: #A3A3A3; }
.dist__part--3 { background: #737373; }
.dist__part--4 { background: #FF9A6B; }
.dist__part--5 { background: var(--accent); }

.diff { font-variant-numeric: tabular-nums; }
.diff--up { color: var(--primary); }
.diff--down { color: var(--accent-dark); }

.test-drivers { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.test-drivers__col { display: flex; flex-direction: column; gap: 10px; }
.test-driver { display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; }
.test-driver__facet { align-self: flex-start; color: var(--primary); font-weight: 600; }
.test-driver--weak { opacity: 0.6; }
/* SA-018: lines left out of the twins' prompts; links between a test and its repeat */
.test-removed { display: flex; flex-direction: column; gap: 3px; font-size: 0.86rem; padding: 8px 10px; border: 1px solid var(--border-gray); border-radius: 6px; }
.test-removed__text { color: var(--text, #111); }
.test-removed__label { font-weight: 600; }
.test-link { font-weight: 600; color: var(--accent-dark); text-decoration: none; }
.test-link:hover { text-decoration: underline; }

.test-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.test-theme { padding: 16px; border: 1px solid var(--border-gray); border-radius: var(--radius); font-size: 0.86rem; }
.test-theme--for { border-top: 3px solid var(--primary); }
.test-theme--against { border-top: 3px solid var(--accent); }
.test-theme__head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.test-theme__stance { font-size: 0.72rem; color: var(--text-gray); white-space: nowrap; }
.test-theme__text { color: var(--ink-soft); margin-bottom: 8px; }
.test-theme .chips { margin-bottom: 4px; }

.test-answers { font-size: 0.84rem; }
.data-table.test-answers td { vertical-align: top; white-space: normal; }
.test-answers__quote { font-style: italic; color: var(--ink-soft); min-width: 280px; }

.test-prompt { margin-top: 10px; }
.test-prompt > .fold-details__head { cursor: pointer; font-weight: 600; font-size: 0.88rem; }
.test-prompt .prompt-box { margin: 8px 0 12px; font-size: 0.76rem; }
.test-prompt .persona-card__label { margin-top: 6px; }

/* Trait tables (twins page, twin window): numeric headers wrap by words and
   the column stays as narrow as its numbers — a long header no longer sets
   the width (owner, 2026-09-25). */
.data-table th.th-wrap {
    white-space: normal;
    width: 1%;
    min-width: 76px;
    max-width: 118px;
    line-height: 1.3;
    vertical-align: bottom;
}
.data-table th.th-wrap.num { text-align: right; }
.data-table th.th-wrap:not(.num) { max-width: none; width: auto; }
.th-tail { white-space: nowrap; }
.th-tail .tip-icon { margin-left: 4px; }
.twins-facets th, .twins-facets td,
.twin-facets th, .twin-facets td { padding-left: 10px; padding-right: 10px; }
.twins-facets .fstrip-cell, .twin-facets .fstrip-cell { width: auto; min-width: 150px; }

/* A popover row's key column grows with its word ("Approximated" is wider
   than 76px and ran into the text beside it) — never narrower than before. */
.tip-pop__row { grid-template-columns: minmax(76px, max-content) 1fr; }
.tip-pop__key { white-space: nowrap; }

/* Badges in table cells stay on one line inside their cell: the cell grows. */
.data-table td .badge { flex-shrink: 0; }
.twins-how { white-space: normal; min-width: 150px; }
.twins-how .badge { margin: 2px 0; }
.twin-words { min-width: 240px; }

/* At narrower widths the strip gives way first. */
.twins-facets .fstrip-cell, .twin-facets .fstrip-cell { min-width: 120px; }

/* ---------- SA-021: what twins will not be told, before the survey ---------- */

.prime { display: flex; flex-direction: column; gap: 14px; }
.prime__basis { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px dashed var(--border-gray); border-radius: 6px; }
.prime__group { display: flex; flex-direction: column; gap: 6px; }
.prime__line { display: flex; align-items: flex-start; gap: 10px; font-size: 0.86rem; padding: 7px 10px; border: 1px solid var(--border-gray); border-radius: 6px; }
.prime__line.is-out .prime__words { text-decoration: line-through; color: var(--text-gray); }
.prime__text { flex: 1 1 auto; min-width: 0; }
.prime__act { flex: 0 0 auto; }
.prime__fixed { flex: 0 0 auto; font-size: 0.75rem; color: var(--text-gray); padding: 4px 6px; }
.prime__rest { display: flex; flex-direction: column; gap: 6px; }
.prime__rest > .fold-details__head { cursor: pointer; font-size: 0.85rem; color: var(--text-gray); margin: 2px 0 6px; }
.prime__rest > .prime__line + .prime__line { margin-top: 6px; }
.test-removed--back { border-style: dashed; }

/* ---------- SA-019: local prices on a hypothesis card ---------- */

.prices { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.prices > p { margin: 0; }
.prices__head { font-size: 0.86rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.prices__warn { font-size: 0.82rem; color: #8A5A00; }
.prices__table { width: 100%; }
.prices__table > .fold-details__head { cursor: pointer; font-size: 0.85rem; margin-bottom: 6px; }
.prices__template { font-size: 0.8rem; margin: 2px 0; }
.prices__grid td { vertical-align: top; }
.prices__row--main .prices__country > div:first-child { font-weight: 600; }
.prices__country { min-width: 150px; }
.prices__grid th, .prices__grid td { padding: 8px; white-space: normal; }
.prices__cell { min-width: 100px; }
.prices__input { width: 100%; min-width: 80px; }
.prices__why { font-size: 0.78rem; color: var(--text-gray); margin-top: 4px; line-height: 1.35; }
.seg__spread { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* ---------- SA-026: the reference database ---------- */

.ref-sub { font-size: 0.78rem; line-height: 1.35; }
.ref-licence { font-size: 0.84rem; line-height: 1.35; margin-bottom: 4px; }
.ref-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.ref-narrow { font-size: 0.84rem; line-height: 1.4; white-space: normal; }
.ref-notes { font-size: 0.8rem; line-height: 1.4; color: var(--text-gray); white-space: normal; }
#view-ref .data-table td { vertical-align: top; }
#view-ref .data-table .row-nolink { cursor: default; }
#view-ref .data-table tbody tr.is-picked td { background: var(--accent-wash); }
#view-ref .data-table .badge { cursor: pointer; }
#view-ref .data-table--static .badge { cursor: default; }

.ref-facts,
.ref-glossary {
    display: grid;
    grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
    gap: 10px 20px;
    font-size: 0.9rem;
}
.ref-facts dt,
.ref-glossary dt { color: var(--text-gray); font-weight: 600; }
.ref-facts dd,
.ref-glossary dd { margin: 0; min-width: 0; }
.ref-facts dd .badge { margin-left: 4px; }
.ref-request {
    display: block;
    font-size: 0.78rem;
    line-height: 1.45;
    padding: 8px 10px;
    background: var(--light-gray);
    border-radius: 6px;
    overflow-wrap: anywhere;
}
.ref-link { color: var(--primary); overflow-wrap: anywhere; }
.ref-link:hover { color: var(--accent-dark); }

@media (max-width: 720px) {
    .ref-facts,
    .ref-glossary { grid-template-columns: 1fr; gap: 2px 0; }
    .ref-facts dd,
    .ref-glossary dd { margin-bottom: 10px; }
}

/* ---------- SA-029: data pages grow with the window; tables fit without scrolling ---------- */

/* The block grows with the window up to a comfortable reading width. */
.form-wrap--wide { max-width: 1560px; }

/* Fixed layout: the header row sets the widths, text wraps inside its cell by
   words (a long code breaks only when it must), nothing runs into the next
   column and there is no sideways scroll. Numbers and dates stay narrow;
   names and descriptions (no width set) take the rest. */
.ref-table { table-layout: fixed; }
.ref-table th,
.ref-table td {
    white-space: normal;
    overflow-wrap: break-word;
    padding: 12px 12px;
    vertical-align: top;
}
.ref-table th { line-height: 1.3; vertical-align: bottom; }
.ref-table td { overflow-wrap: break-word; }
/* Narrow text columns may hyphenate long words; codes break anywhere, never hyphenated. */
.ref-table td.ref-narrow { hyphens: auto; -webkit-hyphens: auto; }
.ref-table .ref-sub { overflow-wrap: anywhere; hyphens: manual; }
.ref-table td .badge { white-space: nowrap; }
.ref-table .col-num { width: 100px; }
.ref-table .col-tiny { width: 76px; }
.ref-table .col-year { width: 96px; }
.ref-table .col-date { width: 120px; }
.ref-table .col-badge { width: 140px; }
.ref-table .col-mid { width: 15%; }
.ref-table--dense .col-mid { width: 12%; }
.ref-table td.num,
.ref-table th.num { white-space: nowrap; overflow-wrap: normal; }
@media (max-width: 1280px) {
    #view-ref .panel { padding: 24px; }
    .ref-table { font-size: 0.86rem; }
    .ref-table th { font-size: 0.68rem; letter-spacing: 0; }
    .ref-table th,
    .ref-table td { padding: 10px 8px; }
    .ref-table .col-num { width: 74px; }
    .ref-table .col-tiny { width: 60px; }
    .ref-table .col-year { width: 78px; }
    .ref-table .col-date { width: 90px; }
    .ref-table .col-badge { width: 130px; }
    .ref-table--dense .col-mid { width: 13%; }
}

