#loadingSpinner {
    height: 200px;
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 100000;
    transform: translate(-50%, -50%);
}

#loadingSpinner .spinner-border {
    filter: drop-shadow(2px 2px 4px white) drop-shadow(-2px -2px 4px white);
}

#loadingSpinner .spinner-label {
    font-size: 1.1rem;
    color: var(--bs-primary);
    text-shadow: 2px 2px 4px white, -2px -2px 4px white;
    margin-left: 0.75rem;
}

.popover-filter {
    min-width: 500px;
}

.popover-filter ul {
    list-style-type: none;
    padding-left: 0;
}

.content-hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in, visibility 0s 0.8s; /* 0s delay for visibility when hiding */
}

.content-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s ease-in, visibility 0s 0s; /* No delay for visibility when showing */
}

h1 {
    /* UnifrakturMaguntia in place of UnifrakturCook: Cook is a heavy 19th-century
       Fraktur revival, and German. Maguntia is lighter and closer to the textura
       an English press of the period would have used. It ships one weight, so the
       h1 default bold has to be turned off or the browser synthesises it and the
       letterforms smear. */
    font-family: 'UnifrakturMaguntia', serif;
    font-weight: 400;
}

/* The date range in a roman of the same century. Blackletter figures are the one
   part of this title nobody can read at a glance, and the dates are what the
   title is chiefly telling you. */
h1 .date-range {
    font-family: 'IM Fell English SC', serif;
    font-size: 1.12em;
}

#textFilter, #personSearchWrap {
    max-width: 16rem;
}

#textFilter button, #searchInput {
    background-color: var(--bs-light);
    border: var(--bs-border-width) solid var(--bs-border-color);
    /* Match the small radius used by the other filter-row controls (year
       selects, customs toggles, commodities & clear-all buttons). */
    border-radius: var(--bs-border-radius-sm);
}

#searchInput {
    /* Vertical padding matches Bootstrap's .form-control-sm so the text filter
       is the same height (31px) as the person filter and other controls. */
    padding: 0.25rem 0.75rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;

    font-size: small;
    line-height: 1.5;

    color: #495057; /* Standard text color */
    background-clip: padding-box;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#textFilter button {
    padding: 0.25rem 0.5rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;

    color: var(--bs-secondary); /* A default muted text color for the icon */
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-hover-border-color: var(--bs-border-color);
    --bs-btn-active-border-color: var(--bs-border-color);
    --bs-btn-focus-shadow-rgb: var(--bs-border-color-rgb);
}

#textFilter button:hover {
    background-color: var(--bs-gray-300);
}

/* The person-filter results dropdown (#personSearchResults, position:fixed)
   is the input-group's last child, so Bootstrap strips the clear button's
   right radius. Restore it to match the group's small corner radius. */
#clearPersonSearchBtn {
    border-top-right-radius: var(--bs-border-radius-sm);
    border-bottom-right-radius: var(--bs-border-radius-sm);
}

#resultCount {
    font-size: 0.7rem;
}

#dateSelectors button {
    padding: 0.1rem 2rem 0.1rem 0.2rem;
    font-size: 0.8rem;
    line-height: 1.5;
    background-color: white;
    border-color: #ced4da;
    color: #495057;
}

#dateSelectors button:hover, #dateSelectors button:focus {
    background-color: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

#dateSelectors select {
    padding-right: 1.2rem !important;
    padding-left: 0.3rem;
    padding-top: 0.1rem;
    padding-bottom: 0.1rem;
    font-size: 0.8rem;
    line-height: 1.5;
    background-position: right 0.1rem center;
    min-width: auto;
    width: auto;
}

#directionControls, #customsTypes {
    background-color: white;
}

.form-check-input, .form-check-label {
    cursor: pointer;
}

.fa-clipboard, .fa-file-pdf {
    width: 0.7rem;
    font-size: medium;
}

.fa-clipboard {
    cursor: copy;
}

.fa-file-pdf {
    cursor: alias;
}

.double-underline {
    text-decoration-line: underline;
    text-decoration-style: double;
    text-decoration-color: red;
    text-underline-offset: 2px;
    text-decoration-thickness: 1.5px;
}

/* Style for the cargos list */
.cargos-list {
    display: none; /* Hidden by default */
    margin-top: 10px;
    padding-left: 20px; /* Add some space from the left */
    list-style-type: none; /* Remove default bullet points */
    font-size: 14px;
}

.cargos-list li {
    margin-bottom: 5px;
    padding: 3px 0 3px 7px;
    background-color: #f8f9fa; /* Light background for the items */
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); /* Subtle shadow */
}

.cargos-list li.no-cargo {
    font-style: italic;
    color: #6c757d; /* Grey color for "No cargos found" */
}

/* Commodity-group filter active: mark the cargos carrying a selected group
   (narrow red border) and fade the irrelevant ones. */
.cargos-list li.cargo-group-match {
    border: 1px solid #c0392b;
    border-radius: 4px;
}

.cargos-list li.cargo-group-dim {
    opacity: 0.45;
}

.toggleCargosBtn {
    font-size: 0.8rem;
    padding: 0px 4px;
    border-radius: 4px;
}

/* Button colours */
.btn-success {
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.export {
    cursor: pointer;
}

.export i {
    color: var(--bs-success) !important;
    transition: color 0.15s ease-in-out;
    margin: 0 0.5rem;
}

.export:hover i {
    color: var(--bs-danger) !important;
}

.btn-check:checked + .btn-outline-secondary {
    background-color: rgba(108, 117, 125, 0.5);
    color: rgba(0, 0, 0, 0.7);
}

/* Custom smaller button size */
.btn-group-sm label.btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
}

/* Align button groups horizontally and vertically center */
.btn-groups-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem; /* spacing between groups */
    width: 100%;
}

#tableScrollContainer, #chartPane, #mapPane {
    max-height: 80vh;
    overflow-y: auto;
}

#ladingTable {
    border-collapse: collapse;
    width: 100%;
    border: 1px solid #dee2e6;
}

#ladingTable thead tr:nth-child(2) {
    background-color: #eaeb2e2e;
}

#ladingTable thead tr:nth-child(2) th {
    background-color: inherit;
}

/* The filter row stood 104px tall to hold 31px of controls. It stacked into
   three bands -- the controls, the result count on a line of its own, the
   clear-filters button on a third -- because the wrapper holding the controls
   carries flex-grow-1 and so took the full 990px, leaving its siblings nowhere
   to sit but underneath. Let it shrink instead, and the row is one band. */
#ladingTable thead tr:nth-child(2) th > .d-flex {
    gap: .4rem;
    row-gap: .25rem;
}

#ladingTable thead tr:nth-child(2) th > .d-flex > .flex-grow-1 {
    flex: 1 1 auto;
    min-width: 0;   /* a flex item will not shrink below its content without this */
}

/* Room to shrink before anything wraps, and a ceiling so two search boxes do
   not eat a wide screen between them. */
#personSearchWrap,
#textFilter {
    flex: 1 1 10rem;
    min-width: 7rem;
    max-width: 20rem;
}

/* The count sits in the header row now, between "Ladings" and the mode toggle,
   which had an empty middle -- rather than taking a line of its own below.
   The row is centre-aligned for the sake of the button group, which left the
   smaller count text centred in the taller line and so riding 4.6px above the
   baseline of "Ladings". The two text items are aligned to each other's
   baseline instead; the buttons stay centred. */
/* "Dates" and "Categories" are text in a cell aligned middle; "Ladings" is a
   span inside a flex line made taller by the button group beside it. Centring
   each against a different box left them 0.4px apart -- sub-pixel, but enough
   on a fractional boundary to read as misaligned. Baseline alignment lines the
   three headings up with each other by definition. */
#ladingTable thead tr:nth-child(1) th {
    vertical-align: baseline;
}

#ladingTable thead tr:nth-child(1) th > div > span {
    align-self: baseline;
}

#resultCount {
    font-weight: 400;
    font-size: .8rem;
    margin-right: auto;
    padding-left: .75rem;
}

/* The header cells are padded for table rows, which is generous for controls. */
#ladingTable thead tr:nth-child(2) th {
    padding-top: 3px;
    padding-bottom: 3px;
    vertical-align: middle;
}

#ladingTable th,
#ladingTable td {
    border: 1px solid #dee2e6;
    padding: 4px 8px;
    vertical-align: top;
}

#ladingTable th {
    vertical-align: middle;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #dee2e6 !important;
}

#ladingTable td:first-child {
    white-space: nowrap;
}

#ladingTable td:nth-child(2) > div {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    margin-left: auto;
}

#ladingTable td:nth-child(2) > div > span, #ladingTable td:nth-child(2) > div > i {
    cursor: help;
}

.truncation-message-cell {
    background-color: #e0f2f7; /* A soft, light blue */
    color: #495057; /* Slightly darker text for contrast */
    font-style: italic;
    font-weight: 500; /* Medium font weight */
    font-size: 1em;
    padding: 1.25rem 1rem;
    border-top: 3px solid #add8e6; /* A more distinct border */
    border-bottom: 3px solid #add8e6; /* Add a bottom border too */
    text-align: center;
    /* text-shadow for readability on lighter backgrounds */
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
}

.type-badge {
    color: white;
    font-size: 0.75rem;
    width: 1.3rem;
}

.tooltip-inner {
    text-align: left;
}

[data-toggle="tooltip"] {
    cursor: pointer;
}

.anno {
    border-radius: 0.25rem;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.1);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

/* Merchant / shipper names — red-pink */
.anno.forename, .anno.surname, .anno.status {
    background-color: #fce8e6; /* light red-pink */
    color: #d93025; /* Google red */
}

/* Shipmaster names — distinct blue, so the master is not mistaken for the
   merchant/shipper (e.g. "De Marten de Lazera … de nave Servas Williamson"). */
.anno.master-forename, .anno.master-surname, .anno.master-status {
    background-color: #e6eefc; /* light blue */
    color: #1a56c4; /* blue */
}

/* Clickable name annotations: people resolved to a canonical cluster */
.anno.clickable-name {
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}

.anno.clickable-name:hover {
    background-color: #f7c7c2;
}

/* Annotations whose name didn't resolve to a cluster — visually muted, no click */
.anno.unmatched-name {
    cursor: help;
    opacity: 0.7;
    text-decoration: line-through;
    text-decoration-style: dotted;
    text-decoration-color: rgba(217, 48, 37, 0.4);
}

/* All status annotations in italics */
.anno.status, .anno.master-status {
    font-style: italic;
}

/* Active person filters shown as chips below the search row */
#personFilterRow th {
    background: #fff8f6;
    border-top: 1px solid #f1d3cf;
}

.person-filter-chip {
    background-color: #d93025;
    color: white;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    display: inline-flex;
    align-items: center;
}

.person-filter-chip .btn-close {
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
    background-size: 0.5rem;
    opacity: 0.85;
}

.person-filter-chip .btn-close:hover {
    opacity: 1;
}

/* --- Commodity-group filter --- */
.commodity-filter-menu {
    min-width: 20rem;
    max-height: 60vh;
    overflow-y: auto;
}

.commodity-group-tree .cg-super-row {
    padding: 0.15rem 0;
}

.commodity-group-tree .cg-super-label {
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0;
}

.commodity-group-tree .cg-caret {
    display: inline-block;
    width: 1rem;
    text-align: center;
    cursor: pointer;
    color: #6c757d;
    user-select: none;
}

.commodity-group-tree .cg-caret-spacer {
    display: inline-block;
    width: 1rem;
}

.commodity-group-tree .cg-fine {
    padding-left: 0.5rem;
    margin-bottom: 0.25rem;
}

.commodity-group-tree .cg-fine-item {
    margin-bottom: 0.1rem;
}

.commodity-group-tree .cg-fine-item .form-check-label {
    font-size: 0.85rem;
}

#commodityFilterBtn.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

/* Active commodity filters shown as chips below the search row */
#commodityFilterRow th {
    background: #f4f8f4;
    border-top: 1px solid #cfe0d1;
}

.commodity-filter-chip {
    background-color: #2f7d45;
    color: white;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    display: inline-flex;
    align-items: center;
}

.commodity-filter-chip.cg-chip-super {
    background-color: #1f5c33;
}

.commodity-filter-chip .btn-close {
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
    background-size: 0.5rem;
    opacity: 0.85;
}

.commodity-filter-chip .btn-close:hover {
    opacity: 1;
}

/* Name-picker modal rows.
   Bootstrap's .form-check sets padding-left:1.5em to reserve space for the
   negatively-margined .form-check-input — overriding it via the `padding`
   shorthand would clip the checkbox to the left of the row. So we set
   each side longhand and bump padding-left a bit further (2.25rem) to give
   the checkbox breathing room from the modal-body / search-results edge. */
.name-picker-row {
    padding-top: 0.35rem;
    padding-right: 0.5rem;
    padding-bottom: 0.35rem;
    padding-left: 2.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.15s ease;
}

.name-picker-row .form-check-input {
    /* Re-anchor the checkbox to the inner edge of our enlarged padding-left
       (Bootstrap's default is -1.5em, which would now leave it stranded). */
    margin-left: -1.75rem;
}

.name-picker-row:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

.name-picker-row.name-picker-seed {
    background-color: rgba(13, 110, 253, 0.08);
    border: 1px solid rgba(13, 110, 253, 0.2);
}

.name-picker-row .form-check-label {
    cursor: pointer;
}

.name-picker-search-results {
    max-height: 200px;
    overflow-y: auto;
    /* Allow a little inset so the checkbox in the first row isn't flush
       with the scroll-container's left edge. */
    padding-left: 0.25rem;
}

/* Inline person-search dropdown next to the Filter text input.
   Uses position: fixed (with JS-computed top/left) to escape the
   table-responsive overflow clip when the table has few rows. */
#personSearchResults {
    position: fixed;
    z-index: 1050;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.25rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    padding: 0.25rem 0;
    display: none;
}

.person-search-result {
    display: block;
    width: 100%;
    text-align: left;
    white-space: normal;
    border: 0;
    background: transparent;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.person-search-result:hover,
.person-search-result:focus {
    background-color: rgba(13, 110, 253, 0.08);
    outline: none;
}

.person-search-empty {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: #6c757d;
}

/* Inserted annotations (back-referenced text not in original) */
.anno.inserted {
    font-style: italic;
    opacity: 0.85;
}

/* Alias names (quondam [former name]) */
.anno.alias-forename, .anno.alias-surname {
    background-color: #fff3e0; /* light orange */
    color: #f57c00; /* deep orange */
    font-style: italic;
}

.anno.ship, .anno.ship-type, .anno.summing, .anno.status-marker {
    background-color: #ede7f6; /* light purple */
    color: #5e35b1; /* deep purple */
}

/* the alien-custom marker "Al'" (type status-marker): the charge family's purple, italic like a status */
.anno.status-marker { font-style: italic; }

.anno.place, .anno.merchant-place {
    background-color: #e6f4ea; /* pale green */
    color: #188038; /* Google green */
}

.anno.quantity, .anno.quantity_word, .anno.footnote {
    background-color: #e8f0fe; /* light blue */
    color: #0d6efd;
}

.anno.unit, .anno.mode {
    background-color: #e0f7fa; /* light cyan */
    color: #00796b; /* teal */
}

.anno.commodity, .anno.commodities {
    background-color: #fff3cd; /* pale yellow */
    color: #856404; /* Bootstrap warning text */
}

.anno.commodity-unit {
    background-color: #e8f5e9; /* light green - mix of commodity and unit */
    color: #2e7d32; /* dark green */
}

.anno.pence, .anno.money {
    background-color: #f3e5f5; /* lavender */
    color: #6a1b9a; /* deep violet */
}

.anno.containing {
    background-color: #fff3e0; /* light orange */
    color: #e65100; /* dark orange */
}

.anno.contained {
    background-color: #fce4ec; /* light pink */
    color: #c2185b; /* dark pink */
}

.anno.weighing {
    background-color: #f9fbe7; /* light lime */
    color: #827717; /* olive green */
}

.anno.qualifier {
    background-color: #f0f4c3; /* light yellow-green */
    color: #afb42b; /* mustard yellow */
}

/* Qualifiers borrowed from another concept (attested_on_concept: false) */
.anno.qualifier.qualifier-borrowed {
    border: 1px dashed rgba(175, 180, 43, 0.7);
}

/* Concept + qualifier(s) grouping boundary: an outlined box wrapping the head
   commodity/unit and its attached qualifier spans so the extent of one
   commodity phrase is visible inline. */
.anno-cluster {
    border-radius: 0.3rem;
    padding: 0.04em 0.22em;
    border: 1px dashed rgba(133, 100, 4, 0.55); /* amber — commodity default */
    background-color: rgba(255, 243, 205, 0.30);
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Soften the inner highlights so the cluster box reads as the outer boundary. */
.anno-cluster .anno {
    box-shadow: none;
}

.anno-cluster-unit {
    border-color: rgba(0, 121, 107, 0.55); /* teal */
    background-color: rgba(224, 247, 250, 0.35);
}

.anno-cluster-commodity-unit {
    border-color: rgba(46, 125, 50, 0.55); /* green */
    background-color: rgba(232, 245, 233, 0.40);
}

.anno.at {
    background-color: #e3f2fd; /* light blue */
    color: #1976d2; /* blue */
}

.anno.and {
    background-color: #ede7f6; /* light purple */
    color: #5e35b1; /* deep purple */
}

.anno:hover {
    filter: brightness(0.95);
}

#copyUrlBtn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1050; /* Higher than tooltips/modals if needed */
}

#chart-container {
    width: 100%;
    height: auto;
}

#map {
    height: 80vh;
    margin: 0;
    /* CARTO Voyager's own sea, sampled from an open-ocean tile. This is what
       shows before the first tiles arrive, so it should be the colour the map is
       about to be: the old dark navy was the fallback basemap's sea, and it
       flashed dark on a map that was about to come up pale. */
    background: #d5e8eb;
}

.marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.marker-dot {
    width: 12px;
    height: 12px;
    background: #ff0000;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

.marker-label {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #222;
    text-shadow: 0 0 3px white;
    white-space: nowrap;
    pointer-events: none;
}

#map, #cy {
    height: 80vh;
    margin: 0;
}

.dimmed {
    opacity: 0.2 !important;
}

/* Commodity/Unit Annotation Tooltip Styles */
.annotation-tooltip {
    text-align: left;
    max-width: 350px;
}

.tooltip-entry {
    padding: 8px 10px;
    margin: 4px 0;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.08);
}

.tooltip-entry:first-child {
    margin-top: 0;
}

.tooltip-entry:last-child {
    margin-bottom: 0;
}

/* Unit entries have different background */
.tooltip-entry-unit {
    background-color: rgba(100, 200, 200, 0.15);
}

/* Category name as heading */
.tooltip-category {
    font-weight: 700;
    font-size: 0.95em;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    line-height: 1.3;
}

/* Unit category heading with different color */
.tooltip-category-unit {
    font-weight: 700;
    font-size: 0.95em;
    color: #7dd3c0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    line-height: 1.3;
}

/* Terms listed under category */
.tooltip-terms {
    font-size: 0.92em;
    color: #ffffff;
    font-weight: 400;
    line-height: 1.5;
}

.tooltip-divider {
    border: none;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 6px 0;
}

/* Make Bootstrap tooltips larger and more readable for rich content */
.tooltip-inner {
    max-width: 400px;
    text-align: left;
    padding: 12px;
    background-color: rgba(35, 35, 35, 0.98);
}

/* Rich qualifier popover (canonical label + gloss + linked AAT/geo) */
.qual-pop { text-align: left; max-width: 260px; line-height: 1.35; }
.qual-pop-name { font-weight: 600; margin-bottom: 2px; }
.qual-pop-gloss { font-size: 0.85em; opacity: 0.9; margin-bottom: 3px; }
.qual-pop-links { font-size: 0.8em; }
.qual-pop-links a { color: #8ec7ff; }
.qual-pop-form, .qual-pop-fuzzy { font-size: 0.78em; opacity: 0.75; font-style: italic; }
.qual-geo-pt { opacity: 0.7; }
.qualifier-geo a { color: #2a7a2a; text-decoration: none; }

/* The undated-ladings note beside the result count (#41). Quiet enough not to compete
   with the count itself, but not so quiet that the gap it reports goes unread. */
.undated-note {
    font-style: italic;
    opacity: 0.85;
}
.undated-note a {
    text-decoration: underline;
}

/* The cargo record (plan §13), shown under a cargo on demand: a row per commodity
   with its quantity, measure, qualifiers and concept, and the frame around it. */
.cargo-record-slot { display: none; }
.cargo-record {
    margin: 6px 0 10px; padding: 8px 10px; border-left: 3px solid #b8c4cc;
    background: #f7f9fa; border-radius: 4px; font-size: 0.86rem;
}
.cargo-record .cr-frame { margin-bottom: 6px; color: #2f4858; }
.cargo-record .cr-role {
    text-transform: uppercase; font-size: 0.68rem; letter-spacing: .04em;
    color: #7a8b96; margin-right: 3px;
}
.cargo-record .cr-status, .cargo-record .cr-place { color: #55707f; }
.cargo-record .cr-from { color: #90a2ad; font-size: 0.78rem; }
.cargo-record table.cr-rows { width: 100%; border-collapse: collapse; background: transparent; }
.cargo-record table.cr-rows th {
    text-align: left; font-weight: 600; font-size: 0.72rem; text-transform: uppercase;
    letter-spacing: .04em; color: #7a8b96; border-bottom: 1px solid #dde4e8; padding: 2px 6px 3px 0;
}
.cargo-record table.cr-rows td { vertical-align: top; padding: 4px 6px 4px 0; border-bottom: 1px solid #edf1f3; }
.cargo-record td.cr-goods { font-weight: 600; }
.cargo-record td.cr-qty { white-space: nowrap; }
.cargo-record .cr-quals { font-weight: 400; margin-top: 2px; }
.cargo-record .cr-qual {
    display: inline-block; padding: 0 5px; margin: 1px 3px 1px 0; border-radius: 9px;
    background: #e8eef1; color: #4a616e; font-size: 0.76rem;
}
.cargo-record .cr-qual.cr-geo { background: #efe4f7; color: #5f4374; }
.cargo-record .cr-extra, .cargo-record .cr-materials { color: #6b7d88; font-size: 0.78rem; }
.cargo-record .cr-ids { font-size: 0.78rem; }
.cargo-record .cr-ids a { color: #2b6cb0; }
.cargo-record .cr-none { color: #90a2ad; font-style: italic; }
.cargo-record .cr-foot { margin-top: 6px; color: #90a2ad; font-size: 0.75rem; }
.record-icon { cursor: pointer; }
.record-icon:hover { color: #2b6cb0 !important; }
/* A person in a record's frame line. The site's existing rule is scoped to
   `.anno.clickable-name`, and these spans carry no `.anno` (they are not annotations
   over transcript text), so they need the affordance of their own. */
.cargo-record .clickable-name {
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}
.cargo-record .clickable-name:hover { background-color: #f7c7c2; }

/* The container a lot travelled in ("in 1 cista"): a packing fact, not a measure,
   so it sits under the measure rather than replacing it. */
.cargo-record .cr-container { color: #6b7d88; font-size: 0.78rem; font-style: italic; }


/* --- Term search (term_search.js; documentation/search_plan.md step 3) --- */
#clearTermSearchBtn {
    border-top-right-radius: var(--bs-border-radius-sm);
    border-bottom-right-radius: var(--bs-border-radius-sm);
}
#termSearchResults {
    position: fixed;             /* escapes the table's overflow clip; hidden while its box is out of sight (term_search.js _position) */
    z-index: 1025;               /* below Bootstrap's modals (1055) and tooltips (1080) */
    max-height: 420px;
    max-width: min(34rem, calc(100vw - 16px));
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.25rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    padding: 0.25rem 0;
    display: none;
}
.term-suggestion {
    display: block;
    width: 100%;
    text-align: left;
    white-space: normal;
    border: 0;
    background: transparent;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}
.term-suggestion:hover,
.term-suggestion.active {
    background-color: rgba(13, 110, 253, 0.10);
}
.term-via { color: #6c757d; font-style: italic; }
.term-kind {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 0.2rem;
    padding: 0 0.3rem;
    margin-left: 0.35rem;
    color: #fff;
}
.term-kind-goods, .term-chip-goods     { background-color: #1e6b52; }
.term-kind-measure, .term-chip-measure { background-color: #5b5f97; }
.term-kind-quality, .term-chip-quality { background-color: #8a5a00; }
.term-count { float: right; color: #6c757d; font-size: 0.8rem; margin-left: 0.5rem; }
.term-note { color: #6c757d; font-size: 0.78rem; }
.term-filter-chip {
    background-color: #1e6b52;
    color: white;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    display: inline-flex;
    align-items: center;
}
.term-filter-chip .btn-close {
    width: 0.5rem; height: 0.5rem; padding: 0; background-size: 0.5rem; opacity: 0.85;
}
.term-filter-chip .btn-close:hover { opacity: 1; }
/* A chosen term where it occurs in the cargo text. */
.anno.term-hit {
    outline: 2px solid #f0a202;
    outline-offset: 1px;
    border-radius: 2px;
}


/* --- Guided tour (tour.js; documentation/search_plan.md step 6) --- */
.tour-popover { max-width: 22rem; z-index: 2147483600; }
/* While the tour runs the page takes no pointer events (tour.js _veilOn). */
.tour-veil { position: fixed; inset: 0; z-index: 2147483500; background: transparent; cursor: default; }
.tour-spot { position: fixed; z-index: 2147483550; pointer-events: none; border-radius: 6px;
             outline: 3px solid #f0a202; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.25); display: none; }
.tour-popover .popover-body { font-size: 0.9rem; }
.tour-nav { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.6rem; }
.tour-count { margin-right: auto; color: #6c757d; font-size: 0.8rem; }
.tour-wait { margin-top: 0.45rem; color: #8a5a00; font-size: 0.82rem; }
.tour-target { }   /* marked for tour.js; the highlight is drawn by .tour-spot */


/* --- One search box (term_search.js; search_plan.md step 8) --- */
#termSearchWrap { flex: 1 1 22rem; min-width: 12rem; max-width: 42rem; }
#advancedRow #textFilter { flex: 1 1 18rem; max-width: 30rem; }
#advancedToggle.active { background-color: var(--bs-gray-300); }
.term-tabs { display: flex; align-items: center; gap: 0.15rem; padding: 0.2rem 0.5rem 0.35rem;
             border-bottom: 1px solid rgba(0,0,0,0.1); position: sticky; top: -0.25rem; background: #fff; z-index: 1; }
.term-tab { border: 0; background: transparent; font-size: 0.8rem; padding: 0.15rem 0.5rem; border-radius: 0.2rem; color: #495057; }
.term-tab.active { background: #1e6b52; color: #fff; }
.term-sounds { font-size: 0.78rem; color: #495057; cursor: pointer; white-space: nowrap; }
.term-section { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: #6c757d;
                padding: 0.35rem 0.75rem 0.1rem; }
.term-person { display: block; cursor: pointer; }
.term-similar { font-size: 0.78rem; }
.term-note-inline { color: #6c757d; font-size: 0.8rem; }
.term-kind-group, .term-chip-group   { background-color: #2f5f8a; }
.term-kind-place, .term-chip-place   { background-color: #7a3e8e; }
.term-kind-ship, .term-chip-ship     { background-color: #0f6b7a; }
.term-kind-person                    { background-color: #d93025; }
.chip-role { font-weight: normal; opacity: 0.85; font-size: 0.75em; margin-left: 0.25rem; }

/* Tooltips never take the mouse. A tooltip pops up under the pointer from whatever row it
   is over; taking pointer events, it swallowed the wheel -- it sits outside the table's
   scroll box -- and scrolling stalled wherever one appeared (29 Sep: scrollopen stuck at
   9,000 px with the pointer on a .tooltip-arrow). They vanish when the pointer leaves their
   trigger, so nothing in one could be clicked anyway. */
.tooltip { pointer-events: none; }

.term-loading { padding: 0.4rem 0.75rem; font-size: 0.85rem; color: #6c757d; display: flex; align-items: center; }

/* #27: a name the annotator filled in for "De eodem" / "dicto magistro" / "Et pro"
   (tooltip: the source's words); and the source's words shown in its place */
.resolved-name {
    text-decoration: underline dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    cursor: help;
}
.resolved-source {
    font-style: italic;
    text-decoration: underline dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    cursor: help;
}
