/* (c) Javier Fernandez @ JotaSoft 2026 */
/* Casa Roja search: components the ISSS theme lacks, built from its tokens (isss.css). */

.page {
    padding-block: var(--space-12) var(--space-16)
}

.page-title {
    font-family: var(--font-display), sans-serif;
    font-size: clamp(36px, 6vw, 64px);
    font-weight: 900;
    line-height: .98;
    letter-spacing: var(--tracking-tight);
    text-transform: uppercase
}

.page-title em {
    font-style: normal;
    color: var(--brand-primary)
}

.lede {
    font-size: var(--text-md);
    color: var(--fg-muted);
    max-width: 56ch;
    line-height: var(--leading-relaxed);
    margin-top: var(--space-4)
}

/* Panels and forms, after the theme's comment form */
.panel {
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-top: var(--space-8);
    max-width: 640px
}

.panel h2 {
    font-family: var(--font-display), sans-serif;
    font-size: var(--text-lg);
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: var(--space-4)
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: var(--space-4)
}

.field label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--fg-muted)
}

input[type=text], input[type=search], select {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--fg-primary);
    font-family: var(--font-body), sans-serif;
    font-size: 15px;
    padding: 10px 12px;
    outline: none;
    transition: border-color 150ms, box-shadow 150ms
}

input:focus, select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(245, 184, 0, .15)
}

input::placeholder {
    color: var(--fg-disabled)
}

.row {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    align-items: center
}

.inline {
    display: inline
}

.hint {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-steel-600);
    letter-spacing: .04em;
    margin-top: var(--space-3);
    line-height: 1.6
}

.hint code, .token {
    font-family: var(--font-mono);
    color: var(--brand-primary);
    background: var(--bg-sunken);
    border: 1px solid var(--border-subtle);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    word-break: break-all
}

/* Notices, after .cmt-notice */
.notice {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    margin-top: var(--space-5);
    max-width: 640px
}

.notice:empty {
    display: none
}

.notice.info, #status {
    background: rgba(20, 114, 192, .1);
    border-color: rgba(20, 114, 192, .35);
    color: var(--signal-info)
}

.notice.ok, #status.ok {
    background: rgba(26, 122, 60, .12);
    border-color: rgba(26, 122, 60, .35);
    color: var(--signal-success)
}

.notice.warn, #status.warning {
    background: var(--brand-subtle);
    border-color: rgba(245, 184, 0, .35);
    color: var(--brand-primary)
}

.notice.err, #status.error {
    background: rgba(204, 34, 0, .12);
    border-color: rgba(204, 34, 0, .4);
    color: var(--signal-error)
}

/* Search */
.search {
    display: grid;
    grid-template-columns:1fr 180px auto auto auto;
    gap: var(--space-3);
    margin-top: var(--space-8)
}

/* «Solo KB»: only the knowledge base's pages. */
.search-kb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
    cursor: pointer
}

.search input[type=search] {
    font-size: 18px;
    padding: 12px 14px
}

/* «Búsquedas recientes»: the user's last searches; recent-searches.js puts one in the box. */
.recent-searches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin-top: var(--space-3)
}

.recent-searches ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none
}

.recent-searches a.tag {
    text-transform: none;
    text-decoration: none;
    cursor: pointer
}

.recent-searches a.tag:hover {
    border-color: var(--border-brand)
}

.recent-searches form {
    margin: 0
}

.result-count {
    margin-top: var(--space-8);
    margin-bottom: var(--space-3)
}

.hit {
    border-bottom: 1px solid var(--border-subtle);
    padding-block: var(--space-6);
    display: grid;
    grid-template-columns:120px 1fr;
    gap: var(--space-6)
}

.hit-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-2)
}

.hit-meta time {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--color-steel-600)
}

.hit h3 {
    font-family: var(--font-display), sans-serif;
    font-size: var(--text-lg);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -.01em;
    line-height: var(--leading-snug)
}

.hit h3 a {
    color: var(--fg-primary)
}

.hit h3 a:hover {
    color: var(--brand-primary)
}

.hit .path {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-steel-600);
    margin-top: var(--space-1);
    word-break: break-all
}

.hit .summary {
    font-size: var(--text-sm);
    color: var(--fg-secondary);
    line-height: var(--leading-normal);
    margin-top: var(--space-3);
    max-width: 75ch
}

.hit .snippet {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-muted);
    line-height: 1.6;
    margin-top: var(--space-3);
    max-width: 90ch;
    white-space: pre-line;
    border-left: 2px solid var(--border-default);
    padding-left: var(--space-4)
}

.hit .snippet b {
    color: var(--brand-primary);
    font-weight: 600
}

.hit .actions {
    margin-top: var(--space-4)
}

/* Tables of keys and tokens */
.list {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    margin-top: var(--space-4)
}

.list th {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--fg-muted);
    text-align: left;
    padding: 0 var(--space-3) var(--space-3) 0;
    border-bottom: 1px solid var(--border-default)
}

.list td {
    padding: var(--space-3) var(--space-3) var(--space-3) 0;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle
}

.list th.num, .list td.num {
    text-align: right
}

.status {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    color: var(--fg-muted)
}

.status.approved {
    color: var(--signal-success);
    border-color: rgba(26, 122, 60, .5)
}

.status.pending {
    color: var(--brand-primary);
    border-color: rgba(245, 184, 0, .5)
}

.status.denied {
    color: var(--signal-error);
    border-color: rgba(204, 34, 0, .5)
}

.btn {
    white-space: nowrap
}

.article-header {
    padding-top: 0
}

.doc-actions {
    margin-top: var(--space-6)
}

/* An original's path: its folders are links to /explorar; long paths wrap. */
.source-path {
    overflow-wrap: anywhere
}

/* The site is wider than the ISSS theme's default (1180px), for the archive's wide tables;
   running text keeps a readable measure. */
:root {
    --site-max: 1440px
}

.prose {
    margin-top: var(--space-10);
    max-width: none
}

.prose > :not(.table-wrap, pre, hr) {
    max-width: 80ch
}

/* break-word, not anywhere: "anywhere" lets cells shrink to one character, breaking
   numbers mid-digit; table cells break only at spaces. */
.prose p, .prose li {
    overflow-wrap: break-word
}

.table-wrap, .prose .table-wrap {
    overflow-x: auto;
    max-width: 100%
}

.prose table {
    width: 100%
}

.prose td, .prose th {
    overflow-wrap: normal
}

@media (max-width: 680px) {
    .search {
        grid-template-columns:1fr
    }

    .hit {
        grid-template-columns:1fr;
        gap: var(--space-2)
    }
}

/* Zip viewer */
.zip-list {
    max-width: 1000px
}

.zip-list a {
    color: var(--fg-primary);
    word-break: break-word
}

.zip-list a:hover {
    color: var(--brand-primary)
}

.zip-list .folder {
    color: var(--fg-muted)
}

.zip-list .num, .zip-list .when {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--fg-muted);
    white-space: nowrap
}

.zip-list .num {
    text-align: right
}

/* Tab bar, in the site header */
.site-header .container {
    justify-content: flex-start
}

.tabs {
    display: flex;
    align-self: stretch;
    gap: var(--space-2);
    margin-left: var(--space-10)
}

.tabs a {
    display: flex;
    align-items: center;
    padding-inline: var(--space-4);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--fg-muted);
    border-bottom: 2px solid transparent;
    transition: color 150ms, border-color 150ms
}

.tabs a:hover {
    color: var(--fg-primary);
    text-decoration: none
}

.tabs a[aria-current=page] {
    color: var(--fg-primary);
    border-bottom-color: var(--brand-primary)
}

.who {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-4)
}

/* Explorar */
.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: var(--space-4)
}

.crumbs a {
    color: var(--fg-muted)
}

.crumbs a:hover {
    color: var(--brand-primary)
}

.folders {
    list-style: none;
    display: grid;
    grid-template-columns:repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-3);
    margin-block: var(--space-8)
}

.folders a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--fg-primary)
}

.folders a:hover {
    border-color: var(--brand-primary);
    text-decoration: none
}

.folders .name {
    overflow-wrap: anywhere
}

.folders .count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-muted)
}

@media (max-width: 680px) {
    .site-header .container {
        flex-wrap: wrap;
        height: auto;
        padding-block: var(--space-2)
    }

    .tabs {
        order: 3;
        width: 100%;
        margin-left: 0;
        height: 40px
    }
}

/* Entrar: one button per account */
.accounts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3)
}

.accounts .btn {
    font-size: 15px;
    padding: 12px 20px
}

/* Administrar */
.panel.account {
    max-width: none
}

.account-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap
}

.account-head h2 {
    margin: 0
}

.account-head .push {
    margin-left: auto
}

.panel .list + .list {
    margin-top: var(--space-6)
}

.s3-table code {
    font-family: var(--font-mono);
    word-break: break-all
}

.s3-table .num {
    font-family: var(--font-mono);
    white-space: nowrap
}

.s3-table .when {
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: nowrap
}

.zip-list .zip-actions {
    justify-content: flex-end;
    flex-wrap: nowrap
}

/* Panel: stat tiles, meters, the partidas' states.
   Confirmed trozos are green and probable ones orange-red (the user's choice, 2026-10-30),
   so the two read apart at a glance; hipótesis keeps the dark amber, and "sin resolver" is
   the empty track. Labels stay in text tokens; the swatch beside them carries the state. */
:root {
    --grado-confirmado: var(--color-green-light);
    --grado-probable: var(--color-red-light);
    --grado-hipotesis: #7A5A10;
    --grado-pendiente: var(--color-steel-800)
}

.kpis {
    display: grid;
    grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-10)
}

.kpi {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-5);
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: inherit
}

a.kpi:hover {
    border-color: var(--brand-primary);
    text-decoration: none
}

.kpi-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--fg-muted);
    min-height: 2.6em
}

.kpi-value {
    white-space: nowrap;
    font-family: var(--font-display), sans-serif;
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
    color: var(--fg-primary);
    font-variant-numeric: tabular-nums
}

.kpi-sub {
    font-size: var(--text-sm);
    color: var(--fg-secondary)
}

.meter {
    display: block;
    height: 8px;
    border-radius: 4px;
    background: var(--grado-pendiente);
    overflow: hidden
}

.meter-fill {
    display: block;
    height: 100%;
    background: var(--grado-confirmado);
    border-radius: 4px
}

.panel.wide {
    max-width: none
}

/* Panel: the work's stages, left to right with an arrow between each; stacked, the arrows
   point down. */
.etapas {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-8);
    margin: var(--space-5) 0 0;
    padding: 0
}

.etapa {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4);
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md)
}

.etapa + .etapa::before {
    content: "→";
    position: absolute;
    left: calc(-1 * var(--space-8));
    width: var(--space-8);
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    color: var(--fg-muted)
}

.etapa-nombre {
    font-weight: 700;
    color: var(--fg-primary)
}

a.etapa-nombre {
    color: var(--brand-primary)
}

.etapa-que {
    font-size: var(--text-sm);
    color: var(--fg-secondary)
}

.etapa-cifra {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-secondary)
}

@media (max-width: 680px) {
    .etapas {
        grid-template-columns: 1fr
    }

    .etapa + .etapa::before {
        content: "↓";
        left: 0;
        width: 100%;
        top: calc(-1 * var(--space-8));
        height: var(--space-8);
        line-height: var(--space-8);
        transform: none
    }
}

.stack {
    display: flex;
    gap: 2px;
    height: 20px;
    margin-block: var(--space-5) var(--space-3)
}

.stack-seg {
    height: 100%;
    min-width: 4px
}

.stack-seg:first-child {
    border-radius: 4px 0 0 4px
}

.stack-seg:last-child {
    border-radius: 0 4px 4px 0
}

.stack-seg:only-child {
    border-radius: 4px
}

.confirmado {
    --grado: var(--grado-confirmado)
}

.probable {
    --grado: var(--grado-probable)
}

.hipotesis {
    --grado: var(--grado-hipotesis)
}

.pendiente {
    --grado: var(--grado-pendiente)
}

.stack-seg, .swatch {
    background: var(--grado)
}

.legend {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5);
    font-size: var(--text-sm);
    color: var(--fg-secondary)
}

.legend li {
    display: flex;
    align-items: center;
    gap: var(--space-2)
}

.swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px
}

/* The empty track's color is close to the panel's: outline it where it stands alone. */
.swatch.pendiente, .grado.pendiente::before {
    box-shadow: inset 0 0 0 1px var(--border-strong)
}

.grado {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-secondary);
    white-space: nowrap
}

.grado::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--grado)
}

.partidas .num {
    font-family: var(--font-mono);
    color: var(--fg-muted)
}

.partidas td {
    font-size: var(--text-sm)
}

/* Cronología: dates | a vertical line | cards, each event on one row so the card lines
   up with its date. The line is drawn in every row's axis cell, rows touching, so it is
   continuous; year labels and gap marks are rows too, centered on it. Acts are filled
   dots, registry entries hollow (shape, not color). */
.timeline {
    --tl-date: 190px;
    --tl-axis: 24px;
    --tl-gap: 16px;
    list-style: none;
    margin-top: var(--space-10);
    padding: 0
}

.tl-row {
    display: grid;
    grid-template-columns:var(--tl-date) var(--tl-axis) minmax(0, 1fr);
    column-gap: var(--tl-gap)
}

.tl-axis {
    position: relative;
    display: flex;
    justify-content: center;
    background-image: linear-gradient(var(--border-strong), var(--border-strong));
    background-size: 2px 100%;
    background-position: 50% 0;
    background-repeat: no-repeat
}

.tl-event {
    scroll-margin-top: 80px
}

/* Spacing inside the row, so the axis cell (and the line) spans it. */
.tl-event .tl-card {
    margin-bottom: var(--space-3)
}

/* Long dates ("antes del 15 feb 1904", intervals) wrap within the column, never into the line. */
.tl-date {
    text-align: right;
    padding-top: 15px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--fg-secondary);
    overflow-wrap: break-word;
    text-wrap: balance
}

.tl-date a {
    color: inherit
}

.tl-date a:hover {
    color: var(--brand-primary)
}

.tl-dot {
    position: relative;
    margin-top: 17px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--bg-base)
}

.tl-dot.hollow {
    background: var(--bg-base);
    border: 2px solid var(--brand-primary)
}

.tl-event:target .tl-card {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-brand)
}

.tl-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-5) var(--space-4)
}

.tl-card.dudoso {
    border-style: dashed
}

.tl-card h3 {
    font-family: var(--font-body), sans-serif;
    font-size: var(--text-base);
    font-weight: 600;
    line-height: var(--leading-snug);
    color: var(--fg-primary);
    margin-top: var(--space-2)
}

.tl-meta {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap
}

.tl-grado {
    color: var(--brand-primary);
    border-color: rgba(245, 184, 0, .4)
}

.tl-partes, .tl-refs {
    font-size: var(--text-sm);
    color: var(--fg-secondary);
    margin-top: var(--space-2)
}

.tl-refs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    font-family: var(--font-mono);
    font-size: 11px
}

.tl-fuentes {
    list-style: none;
    margin-top: var(--space-2);
    font-size: var(--text-sm)
}

.tl-fuentes .lugar {
    color: var(--fg-muted)
}

.tl-card details {
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    color: var(--fg-secondary)
}

.tl-card summary {
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-muted)
}

.tl-card details p {
    margin-top: var(--space-2);
    max-width: 80ch
}

.tl-year .tl-axis {
    height: 72px;
    align-items: center
}

.tl-gap .tl-axis {
    height: 44px;
    align-items: center
}

.tl-mark {
    position: relative;
    z-index: 1;
    white-space: nowrap;
    background: var(--bg-base);
    padding: 2px 10px
}

.tl-year .tl-mark {
    font-family: var(--font-display), sans-serif;
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--fg-primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm)
}

.tl-gap .tl-mark {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .08em;
    color: var(--fg-muted)
}

/* Filter chips */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-6)
}

.chips a {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 5px 10px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    color: var(--fg-secondary)
}

.chips a:hover {
    border-color: var(--border-strong);
    color: var(--fg-primary);
    text-decoration: none
}

.chips a[aria-current=page] {
    border-color: var(--brand-primary);
    color: var(--fg-primary);
    background: var(--brand-subtle)
}

.chips .count {
    color: var(--fg-muted)
}

@media (max-width: 680px) {
    .tl-event {
        grid-template-columns:var(--tl-axis) minmax(0, 1fr);
        grid-template-areas:"axis date" "axis card";
        column-gap: 12px
    }

    .tl-year, .tl-gap {
        grid-template-columns:var(--tl-axis) minmax(0, 1fr);
        column-gap: 12px
    }

    .tl-year > span:first-child, .tl-gap > span:first-child {
        display: none
    }

    .tl-event .tl-axis {
        grid-area: axis
    }

    .tl-date {
        grid-area: date;
        text-align: left;
        padding-top: 0
    }

    .tl-card {
        grid-area: card
    }

    .tl-dot {
        margin-top: 4px
    }

    .tl-mark {
        position: absolute;
        left: 0
    }
}

/* Panel: each partida's trozos, as a small stacked bar and a count. */
.trozos-estado {
    white-space: nowrap
}

.mini-stack {
    display: inline-flex;
    gap: 2px;
    width: 96px;
    height: 8px;
    vertical-align: middle;
    margin-right: var(--space-2)
}

.mini-stack .stack-seg {
    border-radius: 0
}

.mini-stack .stack-seg:first-child {
    border-radius: 2px 0 0 2px
}

.mini-stack .stack-seg:last-child {
    border-radius: 0 2px 2px 0
}

.mini-stack .stack-seg:only-child {
    border-radius: 2px
}

details.trozos {
    margin-top: var(--space-1)
}

details.trozos summary {
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-muted)
}

details.trozos ul {
    list-style: none;
    margin-top: var(--space-2);
    display: grid;
    gap: 4px
}

/* Spreadsheet viewer */
.spreadsheet-viewer-frame {
    margin-top: var(--space-8);
    width: 100%;
    min-height: 700px;
    height: calc(100vh - 280px);
    position: relative;
    background: var(--color-white);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden
}

#spreadsheet-mount {
    width: 100%;
    height: 100%;
    position: relative
}

#spreadsheet-loading {
    margin: var(--space-6)
}

.spreadsheet-viewer-frame .spreadsheet-container,
.spreadsheet-viewer-frame .canvas-area,
.spreadsheet-viewer-frame .canvas-wrapper {
    background: var(--color-white)
}

.spreadsheet-viewer-frame .column-headers,
.spreadsheet-viewer-frame .row-headers,
.spreadsheet-viewer-frame .corner-cell {
    background: var(--color-steel-100)
}

.spreadsheet-viewer-frame .column-header,
.spreadsheet-viewer-frame .row-header {
    color: var(--color-ink);
    font-family: var(--font-mono), monospace;
    font-size: 11px
}

.spreadsheet-viewer-frame .column-header.selected,
.spreadsheet-viewer-frame .row-header.selected {
    background: var(--color-amber-100);
    color: var(--color-ink);
    font-weight: 600
}

.spreadsheet-viewer-frame .sheet-tabs {
    background: var(--color-steel-100);
    border-top: 1px solid var(--color-steel-200)
}

.spreadsheet-viewer-frame .tab {
    background: var(--color-steel-200);
    color: var(--color-ink);
    font-family: var(--font-body), sans-serif;
    font-size: 12px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: background 120ms ease
}

.spreadsheet-viewer-frame .tab.active {
    background: var(--color-white);
    color: var(--color-ink);
    font-weight: 600;
    border-bottom: 2px solid var(--brand-primary)
}

.spreadsheet-viewer-frame .tab:hover:not(.active) {
    background: var(--color-steel-100)
}

/* Control tab: Cost Explorer & Project Segregation */
.control-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-8);
    flex-wrap: wrap
}

.control-time-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-4)
}

.subtabs {
    display: inline-flex;
    background: var(--bg-sunken);
    padding: 3px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    gap: 2px
}

.subtab {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    font-family: var(--font-mono), monospace;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--fg-secondary);
    border-radius: var(--radius-xs, 2px);
    transition: color 120ms ease, background 120ms ease;
    text-decoration: none
}

.subtab:hover {
    color: var(--fg-primary);
    text-decoration: none
}

.subtab.is-active, .subtab[aria-current=page] {
    background: var(--bg-raised);
    color: var(--fg-primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm)
}

.badge-subtle {
    font-family: var(--font-mono), monospace;
    font-size: 10px;
    color: var(--color-steel-600);
    background: var(--bg-sunken);
    border: 1px solid var(--border-subtle);
    padding: 3px 8px;
    border-radius: var(--radius-sm)
}

.highlighted-kpi {
    color: var(--brand-primary)
}

.cost-periods-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    margin-top: var(--space-8)
}

.cost-period-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-6)
}

.cost-period-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    flex-wrap: wrap
}

.cost-period-title {
    font-family: var(--font-display), sans-serif;
    font-size: var(--text-lg);
    font-weight: 800;
    text-transform: uppercase;
    margin: 0
}

.cost-period-sub {
    font-family: var(--font-mono), monospace;
    font-size: 11px;
    color: var(--fg-secondary);
    display: block;
    margin-top: 2px
}

.cost-period-summary-badges {
    display: flex;
    gap: var(--space-3);
    align-items: center
}

.cost-badge {
    display: inline-flex;
    gap: var(--space-2);
    align-items: baseline;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    border: 1px solid var(--border-default);
    background: var(--bg-base)
}

.cost-badge .badge-label {
    font-family: var(--font-mono), monospace;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--fg-muted)
}

.cost-badge.project-badge {
    border-color: var(--brand-primary);
    background: rgba(245, 184, 0, .06)
}

.cost-badge.project-badge strong {
    color: var(--brand-primary);
    font-family: var(--font-mono), monospace
}

.cost-badge.total-badge span {
    font-family: var(--font-mono), monospace
}

.cost-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse
}

.cost-table th.num, .cost-table td.num {
    text-align: right;
    font-family: var(--font-mono), monospace;
    font-size: 12px;
    font-variant-numeric: tabular-nums
}

.cost-table th.highlight-col, .cost-table td.highlight-col {
    background: rgba(245, 184, 0, .03)
}

.cost-table td.highlight-col strong {
    color: var(--brand-primary)
}

.cost-table td.text-muted {
    color: var(--fg-muted)
}

.cost-table .service-name {
    font-family: var(--font-body), sans-serif;
    font-weight: 500
}

.cost-table tfoot .total-row td {
    border-top: 2px solid var(--border-default);
    font-weight: 700;
    background: var(--bg-base)
}

.cost-pagination {
    margin-top: var(--space-8);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-3);
    list-style: none;
    padding: 0
}

.cost-pagination .pagination-info {
    font-family: var(--font-mono), monospace;
    font-size: 11px;
    color: var(--fg-secondary);
    padding: 5px 10px
}

/* The words just searched for (?term=), marked by highlight.js: dim yellow, black text. */
mark.hl {
    background: var(--color-amber-600);
    color: var(--color-black);
    border-radius: 2px;
    padding: 0 1px
}

/* The page's own address as a QR code, at the end of the footer. White quiet zone, so phones
   read it on the dark theme. */
.page-qr {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.page-qr svg {
    display: block;
    width: 96px;
    height: 96px;
}

@media print {
    .page-qr svg {
        width: 72px;
        height: 72px;
    }
}

/* «Compartir» (share.js): small touch screens only, where the share sheet is the way to pass
   a page on; elsewhere the QR code serves. */
.page-share:not([hidden]) {
    display: none;
}

@media (max-width: 640px) and (pointer: coarse) {
    .page-share:not([hidden]) {
        display: inline-flex;
    }
}

/* The language switch in the header: the current language pressed. */
.locale-switch {
    display: flex;
    gap: var(--space-1);
    margin-left: var(--space-4);
}

.locale-switch [aria-pressed="true"] {
    color: var(--brand-primary);
    border-color: var(--border-brand);
}

