.com-historicidad-vis {
    width: 96%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

.hist-vis-header h1 {
    font-size: 1.7rem;
    margin: 0 0 0.35rem 0;
}

.hist-vis-subtitle {
    color: #666;
    margin: 0 0 1rem 0;
}

.hist-vis-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.hist-vis-windows {
    display: flex;
    gap: 0.25rem;
}

.hist-btn {
    padding: 0.3rem 0.7rem;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
}

.hist-btn:hover,
.hist-btn:focus {
    background: #f0f0f0;
    border-color: #999;
}

.hist-vis-search input,
.hist-vis-group-filter select {
    padding: 0.32rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.85rem;
}

.hist-vis-search input {
    min-width: 200px;
}

.hist-vis-count {
    margin-left: auto;
    font-size: 0.85rem;
    color: #777;
    font-variant-numeric: tabular-nums;
}

.hist-vis-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.6rem 0;
}

.hist-legend-chip {
    font-size: 0.7rem;
    padding: 0.15rem 0.55rem;
    border-radius: 10px;
    background: #eee;
    border: 1px solid #ddd;
    text-transform: capitalize;
}

.hist-vis-layout {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.hist-vis-canvas {
    flex: 1 1 auto;
    min-height: 520px;
    min-width: 0;
}

.hist-vis-evidence {
    flex: 0 0 340px;
    padding: 1rem;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow-y: auto;
    max-height: 70vh;
}

.hist-vis-evidence[hidden] {
    display: none;
}

.hist-evidence-close {
    float: right;
    border: none;
    background: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.hist-ev-title {
    font-size: 1.05rem;
    margin: 0.4rem 0;
}

.hist-ev-date,
.hist-ev-group {
    color: #888;
    font-size: 0.82rem;
    margin: 0 0 0.3rem 0;
}

.hist-ev-text {
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0 0 1rem 0;
}

.hist-ev-sources h3,
.hist-ev-hashes h3,
.hist-ev-epistemic h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #666;
    margin: 0.9rem 0 0.25rem 0;
    letter-spacing: 0.03em;
}

.hist-ev-source-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hist-ev-source-list a {
    font-size: 0.82rem;
    word-break: break-all;
}

.hist-ev-hash {
    font-size: 0.72rem;
    word-break: break-all;
    display: block;
}

.hist-ev-status {
    font-size: 0.82rem;
    display: inline-block;
    padding: 0.12rem 0.5rem;
    border-radius: 3px;
    background: #e8e8e8;
}

.hist-ev-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.45rem 0.9rem;
    background: #4285f4;
    color: #fff;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.82rem;
}

.hist-ev-link:hover {
    background: #3367d6;
}

.hist-vis-noscript {
    padding: 1rem;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
}

/* Epistemic status vocabulary.
   observed  = directly documented in a primary source
   verified  = cross-checked against a second independent source
   inferred  = reconstructed from context, not directly stated
   disputed  = sources contradict each other */

.vis-item.hist-status-observed,
.vis-item.hist-status-observado {
    background-color: #e3f2fd;
    border-color: #1e88e5;
}

.vis-item.hist-status-verified,
.vis-item.hist-status-verificado {
    background-color: #e8f5e9;
    border-color: #43a047;
}

.vis-item.hist-status-inferred,
.vis-item.hist-status-inferido,
.vis-item.hist-status-en-verificacion,
.vis-item.hist-status-en-revision {
    background-color: #fff8e1;
    border-color: #fbc02d;
}

.vis-item.hist-status-unverified,
.vis-item.hist-status-no-verificado,
.vis-item.hist-status-sin-estatus {
    background-color: #f5f5f5;
    border-color: #bdbdbd;
    border-style: dashed;
}

.vis-item.hist-status-disputed,
.vis-item.hist-status-disputado,
.vis-item.hist-status-refuted,
.vis-item.hist-status-refutado {
    background-color: #ffebee;
    border-color: #e53935;
}

/* Unpublished drafts surfaced by preview mode */
.vis-item.hist-is-draft {
    opacity: 0.62;
    border-style: dotted;
    border-width: 2px;
}

.vis-item.hist-is-draft .vis-item-content::before {
    content: "\25CB\00a0";
    color: #e65100;
    font-weight: 700;
}

.hist-legend-chip.hist-status-observed,
.hist-legend-chip.hist-status-observado { background: #e3f2fd; border-color: #1e88e5; }
.hist-legend-chip.hist-status-verified,
.hist-legend-chip.hist-status-verificado { background: #e8f5e9; border-color: #43a047; }
.hist-legend-chip.hist-status-inferred,
.hist-legend-chip.hist-status-inferido,
.hist-legend-chip.hist-status-en-verificacion,
.hist-legend-chip.hist-status-en-revision { background: #fff8e1; border-color: #fbc02d; }
.hist-legend-chip.hist-status-unverified,
.hist-legend-chip.hist-status-no-verificado,
.hist-legend-chip.hist-status-sin-estatus { background: #f5f5f5; border-color: #bdbdbd; }
.hist-legend-chip.hist-status-disputed,
.hist-legend-chip.hist-status-disputado,
.hist-legend-chip.hist-status-refuted,
.hist-legend-chip.hist-status-refutado { background: #ffebee; border-color: #e53935; }

/* Notices and diagnostics */

.hist-vis-notice {
    padding: 0.6rem 0.9rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin: 0 0 0.8rem 0;
}

.hist-vis-notice--preview {
    background: #fff3e0;
    border: 1px solid #ffb74d;
    color: #7c4a00;
}

.hist-vis-empty {
    padding: 1.2rem 1.4rem;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin: 1rem 0;
}

.hist-vis-empty h2 {
    font-size: 1.1rem;
    margin: 0 0 0.7rem 0;
}

.hist-diag-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.86rem;
    line-height: 1.6;
    color: #555;
}

.hist-diag-error {
    color: #c62828;
    font-weight: 600;
}

.hist-diag-warn {
    color: #e65100;
    font-weight: 600;
}

/* Export button */

.hist-btn--export {
    background: #4285f4;
    color: #fff;
    border-color: #3367d6;
}

.hist-btn--export:hover,
.hist-btn--export:focus {
    background: #3367d6;
    color: #fff;
}

/* Draft flag inside the evidence panel */

.hist-ev-draft-flag {
    display: inline-block;
    margin: 0 0 0.5rem 0;
    padding: 0.15rem 0.55rem;
    border-radius: 3px;
    background: #fff3e0;
    border: 1px solid #ffb74d;
    color: #7c4a00;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hist-ev-nosource {
    color: #999;
    font-size: 0.8rem;
    font-style: italic;
}

/* ECharts metrics layer */

.hist-metrics {
    margin-top: 2rem;
    padding-top: 1.2rem;
    border-top: 1px solid #e0e0e0;
}

.hist-metrics-title {
    font-size: 1.2rem;
    margin: 0 0 0.3rem 0;
}

.hist-metrics-span {
    color: #777;
    font-size: 0.85rem;
    margin: 0 0 1rem 0;
}

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

.hist-chart {
    margin: 0;
    padding: 0.8rem;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
}

.hist-chart figcaption {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #666;
    margin-bottom: 0.5rem;
}

.hist-chart-canvas {
    width: 100%;
    height: 260px;
}

/* Silences in the record */

.hist-gaps {
    margin-top: 1.4rem;
    padding: 1rem;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
}

.hist-gaps h3 {
    font-size: 0.9rem;
    margin: 0 0 0.25rem 0;
}

.hist-gaps-hint {
    font-size: 0.8rem;
    color: #777;
    margin: 0 0 0.7rem 0;
}

.hist-gaps-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hist-gaps-list li {
    display: flex;
    flex-direction: column;
    padding: 0.4rem 0.7rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 3px solid #9e9e9e;
    border-radius: 3px;
    min-width: 110px;
}

.hist-gap-range {
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.hist-gap-years {
    font-size: 0.72rem;
    color: #888;
}

.vis-item.vis-selected {
    box-shadow: 0 0 0 2px #4285f4;
}

.vis-timeline {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-family: inherit;
}

.vis-labelset .vis-label {
    font-size: 0.82rem;
    padding-left: 0.5rem;
}

@media (max-width: 900px) {
    .hist-vis-layout {
        flex-direction: column;
    }

    .hist-vis-evidence {
        flex: 1 1 auto;
        max-height: none;
    }

    .hist-vis-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .hist-vis-count {
        margin-left: 0;
    }

    .hist-vis-search input {
        width: 100%;
        min-width: 0;
    }

    .hist-vis-canvas {
        min-height: 420px;
    }
}

/* ── Presidential bands overlay (vis mode) ────────────── */

.hist-vis-president-section {
    margin: 0.75rem 0;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.hist-vis-president-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1a1a1a;
    margin: 0;
    padding: 0.5rem 0.75rem;
    background: #f6f8fa;
    border-bottom: 1px solid #d0d7de;
}

.hist-vis-president-bands {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0.4rem;
}

.hist-vis-president-band {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.5rem;
    border-radius: 4px;
    background: var(--band-color, #ccc);
    color: #fff;
    min-width: 7rem;
    flex-basis: calc(100% / 8);
    max-width: calc(100% / 6);
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    position: relative;
    text-decoration: none;
    text-align: center;
}

.hist-vis-president-band:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.hist-vis-president-band.is-empty {
    opacity: 0.3;
    background: repeating-linear-gradient(
        45deg,
        var(--band-color, #ccc),
        var(--band-color, #ccc) 4px,
        rgba(255, 255, 255, 0.2) 4px,
        rgba(255, 255, 255, 0.2) 8px
    );
}

.hist-vis-band-name {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.hist-vis-band-years {
    font-size: 0.62rem;
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

.hist-vis-band-count {
    position: absolute;
    top: 0.15rem;
    right: 0.15rem;
    font-size: 0.6rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    width: 1.1rem;
    height: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hist-vis-band-count:empty,
.hist-vis-president-band.is-empty .hist-vis-band-count {
    display: none;
}

@media (max-width: 768px) {
    .hist-vis-president-band {
        flex-basis: calc(100% / 4);
        min-width: 5rem;
        padding: 0.4rem 0.35rem;
    }

    .hist-vis-band-name {
        font-size: 0.65rem;
    }
}
