/* ==========================================================================
   pedigree.css — Sistema Web de Pedigree Ganadero
   Paleta "Registro Oficial" — Montserrat · Bootstrap 5 local
   ========================================================================== */

@import url('../vendors/montserrat.css');

/* --------------------------------------------------------------------------
   Variables de color — paleta minimalista profesional
   -------------------------------------------------------------------------- */
:root {
    --ped-brand:     #1A2B3C;   /* pizarra profunda — institucional */
    --ped-brand-dk:  #0F1D2C;   /* pizarra oscura — hover */
    --ped-primary:   #2C4E7A;   /* azul acero — árbol genealógico */
    --ped-secondary: #2E6B4F;   /* verde bosque — línea materna */
    --ped-accent:    #C49430;   /* oro cálido */
    --ped-light:     #F3F5F8;   /* fondo de tarjetas/secciones */
    --ped-border:    #DDE3EC;   /* borde suave */
    --ped-text:      #1A2332;   /* casi negro azulado */
    --ped-text-muted:#6B7A8D;
    --ped-shadow:    0 1px 4px rgba(26, 43, 60, 0.07);
    --ped-shadow-md: 0 4px 18px rgba(26, 43, 60, 0.11);
    --ped-radius:    7px;
    --ped-radius-sm: 4px;
}

/* --------------------------------------------------------------------------
   Reset y base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
    color: var(--ped-text);
    background-color: #EAECF1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --------------------------------------------------------------------------
   Header — pizarra profunda, elegante y sobrio
   -------------------------------------------------------------------------- */
.ped-header {
    background: #fff;
    color: var(--ped-brand);
    box-shadow: 0 2px 12px rgba(10, 18, 30, 0.10);
}

.ped-org-name {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ped-brand);
    margin-top: 6px;
    margin-bottom: 1px;
}

.ped-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: none;
    color: var(--ped-brand);
}

.ped-subtitle {
    font-size: 1rem;
    font-weight: 400;
    color: #5a7080;
    margin-top: 4px;
}

.ped-back-link {
    color: #2e6da4;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: color 0.2s;
}
.ped-back-link:hover { color: #1a4a7a; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.ped-footer {
    background: var(--ped-brand);
    color: rgba(255,255,255,0.5);
    margin-top: auto;
}
.ped-footer .text-muted { color: rgba(255,255,255,0.45) !important; }

.ped-footer-disclaimer {
    background: var(--ped-brand-dk);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 12px 0;
}
.ped-disclaimer-text {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    line-height: 1.6;
    margin: 0;
    text-align: center;
}
.ped-disclaimer-text strong { color: #e07060; }
.ped-disclaimer-text a {
    color: rgba(255,255,255,0.5);
    text-decoration: underline;
}
.ped-footer-bottom {
    background: var(--ped-brand);
}

/* --------------------------------------------------------------------------
   Búsqueda
   -------------------------------------------------------------------------- */
.ped-search-form .form-control.ped-search-input {
    border: 1.5px solid var(--ped-border);
    border-right: none;
    background: #fff;
    color: var(--ped-text);
    border-radius: var(--ped-radius) 0 0 var(--ped-radius);
    padding: 0.65rem 1rem;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ped-search-form .form-control.ped-search-input:focus {
    border-color: var(--ped-primary);
    box-shadow: 0 0 0 3px rgba(44, 78, 122, 0.13);
    outline: none;
}

.ped-btn-search {
    background: var(--ped-brand);
    color: #fff;
    border: 1.5px solid var(--ped-brand);
    border-radius: 0 var(--ped-radius) var(--ped-radius) 0;
    padding: 0.65rem 1.4rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.92rem;
    transition: background 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ped-btn-search:hover, .ped-btn-search:focus {
    background: var(--ped-brand-dk);
    color: #fff;
    border-color: var(--ped-brand-dk);
}

/* Sugerencias AJAX */
.ped-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1.5px solid var(--ped-border);
    border-top: none;
    border-radius: 0 0 var(--ped-radius) var(--ped-radius);
    box-shadow: var(--ped-shadow-md);
    display: none;
    max-height: 320px;
    overflow-y: auto;
}
.ped-suggestions.show { display: block; }

.ped-suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #EDF0F5;
    transition: background 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.ped-suggestion-item:last-child { border-bottom: none; }
.ped-suggestion-item:hover,
.ped-suggestion-item.active {
    background: var(--ped-light);
}
.ped-suggestion-name { font-weight: 600; font-size: 0.92rem; }
.ped-suggestion-meta { font-size: 0.78rem; color: var(--ped-text-muted); white-space: nowrap; }

/* --------------------------------------------------------------------------
   Tabla de resultados
   -------------------------------------------------------------------------- */
.ped-results-table {
    background: #fff;
    border-radius: var(--ped-radius);
    overflow: hidden;
    box-shadow: var(--ped-shadow);
}
.ped-results-table thead th {
    background: var(--ped-brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border: none;
    padding: 11px 14px;
}
.ped-results-table tbody tr {
    border-bottom: 1px solid #EDF0F5;
    transition: background 0.12s;
}
.ped-results-table tbody tr:hover { background: var(--ped-light); }
.ped-results-table tbody td { padding: 10px 14px; font-size: 0.9rem; vertical-align: middle; }

.ped-registro {
    font-size: 0.76rem;
    background: #EDF0F5;
    border: 1px solid var(--ped-border);
    padding: 2px 7px;
    border-radius: 3px;
    color: var(--ped-primary);
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 600;
}

.ped-btn-ver {
    background: var(--ped-primary);
    color: #fff;
    border: none;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--ped-radius-sm);
    white-space: nowrap;
    transition: background 0.2s;
}
.ped-btn-ver:hover { background: #1E3A60; color: #fff; }

/* Paginación */
.ped-pagination .page-link {
    color: var(--ped-primary);
    border-color: var(--ped-border);
    font-weight: 500;
    font-size: 0.9rem;
}
.ped-pagination .page-item.active .page-link {
    background: var(--ped-brand);
    border-color: var(--ped-brand);
    color: #fff;
}
.ped-pagination .page-link:hover {
    color: var(--ped-brand);
    background: var(--ped-light);
}

/* Estado inicial */
.ped-welcome-icon { font-size: 3rem; }
.ped-no-results    { opacity: 0.8; }

/* --------------------------------------------------------------------------
   Showcase de funcionalidades (pantalla de bienvenida)
   -------------------------------------------------------------------------- */
.ped-welcome {
    padding: 8px 0 16px;
}

.ped-welcome-lead {
    font-size: 1rem;
    color: var(--ped-text-muted);
    font-weight: 400;
    margin: 0 0 14px;
}

.ped-welcome-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.ped-welcome-tags span {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    background: var(--ped-brand);
    color: rgba(255,255,255,0.88);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.ped-welcome-note {
    font-size: 0.78rem;
    color: var(--ped-text-muted);
    margin: 0;
}

/* Tarjeta de funcionalidad */
.ped-feat-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--ped-border);
    border-radius: var(--ped-radius);
    padding: 16px;
    height: 100%;
    box-shadow: var(--ped-shadow);
    transition: box-shadow 0.2s, transform 0.18s;
}
.ped-feat-card:hover {
    box-shadow: var(--ped-shadow-md);
    transform: translateY(-2px);
}

/* Icono circular de la funcionalidad */
.ped-feat-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Variantes de color del icono */
.ped-feat-icon--blue   { background: #2C4E7A; }
.ped-feat-icon--green  { background: #2E6B4F; }
.ped-feat-icon--gold   { background: #9A7215; }
.ped-feat-icon--teal   { background: #2A6E6E; }
.ped-feat-icon--amber  { background: #A0621A; }
.ped-feat-icon--navy   { background: #1A2B3C; }
.ped-feat-icon--bronze { background: #7A5018; }
.ped-feat-icon--slate  { background: #4A5A6A; }

/* Texto de la tarjeta */
.ped-feat-body { min-width: 0; }

.ped-feat-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--ped-text);
    margin-bottom: 4px;
    line-height: 1.3;
}

.ped-feat-desc {
    font-size: 0.78rem;
    color: var(--ped-text-muted);
    line-height: 1.55;
    margin: 0;
}

/* --------------------------------------------------------------------------
   Tarjetas (ficha de animal)
   -------------------------------------------------------------------------- */
.ped-card {
    background: #fff;
    border: 1px solid var(--ped-border);
    border-radius: var(--ped-radius);
    box-shadow: var(--ped-shadow);
    overflow: hidden;
}

.ped-card-header {
    background: var(--ped-light);
    border-bottom: 1px solid var(--ped-border);
    padding: 16px 20px;
}

.ped-card-body { padding: 20px; }

.ped-section-title {
    background: var(--ped-brand);
    color: #fff;
    padding: 9px 20px;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ped-section-count {
    font-weight: 400;
    font-size: 0.78rem;
    opacity: 0.75;
    text-transform: none;
    letter-spacing: 0;
}

.ped-animal-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ped-brand);
}

.ped-registro-badge {
    display: inline-block;
    background: var(--ped-primary);
    color: #fff;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.93rem;
    padding: 4px 12px;
    border-radius: var(--ped-radius-sm);
    letter-spacing: 0.04em;
}

.ped-dato-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ped-text-muted);
    margin-bottom: 2px;
}
.ped-dato-valor { font-size: 0.91rem; color: var(--ped-text); font-weight: 500; }

/* --------------------------------------------------------------------------
   Árbol genealógico
   -------------------------------------------------------------------------- */
.pedigree-tree {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1.3fr;
    gap: 0 10px;
    align-items: stretch;
}

.ped-col-self,
.ped-col-parents,
.ped-col-grands {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 5px;
}

.ped-box {
    border-left: 3px solid var(--ped-primary);
    padding: 10px 14px;
    background: #fff;
    border-radius: 0 var(--ped-radius-sm) var(--ped-radius-sm) 0;
    border-top: 1px solid var(--ped-border);
    border-right: 1px solid var(--ped-border);
    border-bottom: 1px solid var(--ped-border);
    position: relative;
    transition: box-shadow 0.18s;
}
.ped-box:hover { box-shadow: var(--ped-shadow); }

.ped-self         { border-left-color: var(--ped-accent); background: #FDFBF5; border-left-width: 4px; }
.ped-padre        { border-left-color: var(--ped-primary); }
.ped-madre        { border-left-color: var(--ped-secondary); }
.ped-abuelo-pat   { border-left-color: #4A7BAD; background: #FAFCFE; }

/* Fundadora */
.ped-fundadora-info {
    border-left-color: #7CB87C;
    background: #F4FAF4;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    height: 100%;
}
.ped-fundadora-icon   { font-size: 1.6rem; line-height: 1; }
.ped-fundadora-titulo { font-weight: 700; font-size: .85rem; color: #3A7A3A; }
.ped-fundadora-texto  { font-size: .78rem; color: #555; line-height: 1.4; }
.ped-abuelo-mat   { border-left-color: #4E9E78; background: #F7FCF9; }

.ped-box-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--ped-text-muted);
    margin-bottom: 3px;
}

.ped-box-name {
    font-size: 0.87rem;
    font-weight: 600;
    color: var(--ped-text);
    line-height: 1.3;
    margin-bottom: 3px;
    display: block;
}

a.ped-box-name, .ped-link {
    color: var(--ped-primary);
    text-decoration: none;
}
a.ped-box-name:hover, .ped-link:hover {
    color: var(--ped-brand);
    text-decoration: underline;
}

.ped-box-reg {
    font-size: 0.70rem;
    color: var(--ped-text-muted);
    font-family: 'Consolas', 'Courier New', monospace;
}
.ped-pais {
    font-size: 0.67rem;
    color: var(--ped-accent);
    font-style: italic;
}
.ped-anc-desc {
    font-size: 0.67rem;
    color: var(--ped-text-muted);
    font-style: italic;
}

/* --------------------------------------------------------------------------
   Tabla de lactancias
   -------------------------------------------------------------------------- */
.ped-lact-table th {
    background: var(--ped-light);
    color: var(--ped-brand);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 12px;
    border-bottom: 2px solid var(--ped-border);
}
.ped-lact-table td { font-size: 0.87rem; padding: 7px 12px; }

/* --------------------------------------------------------------------------
   Clasificación lineal
   -------------------------------------------------------------------------- */
.ped-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.clasif-EX      { background: #ffd700; color: #000; box-shadow: 0 1px 4px rgba(255,215,0,0.4); }
.clasif-MB      { background: #c0c0c0; color: #000; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.clasif-B       { background: #cd7f32; color: #fff; box-shadow: 0 1px 4px rgba(205,127,50,0.35); }
.clasif-default { background: #e0e0e0; color: #333; }

/* Barras de score */
.ped-scores { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.ped-score-row {
    display: grid;
    grid-template-columns: 200px 1fr 40px;
    align-items: center;
    gap: 10px;
}
.ped-score-label { font-size: 0.83rem; color: var(--ped-text); }
.ped-score-bar-wrap { background: #DDE3EC; border-radius: 4px; height: 7px; overflow: hidden; }
.score-bar {
    height: 7px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--ped-brand), var(--ped-primary));
    transition: width 0.6s ease;
}
.ped-score-val { font-size: 0.8rem; font-weight: 700; color: var(--ped-primary); text-align: right; }

/* --------------------------------------------------------------------------
   Premios
   -------------------------------------------------------------------------- */
.ped-premios-list { display: flex; flex-direction: column; gap: 10px; }

.ped-premio-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px 16px;
    background: var(--ped-light);
    border: 1px solid var(--ped-border);
    border-radius: var(--ped-radius-sm);
    border-left: 3px solid var(--ped-accent);
}
.ped-premio-icon { font-size: 1.4rem; flex-shrink: 0; }
.ped-premio-nombre { font-size: 0.93rem; color: var(--ped-text); font-weight: 500; }
.ped-premio-expo   { font-size: 0.82rem; }
.ped-premio-desc   { font-size: 0.8rem; line-height: 1.5; }

.ped-badge-posicion {
    background: var(--ped-accent);
    color: #fff;
    margin-right: 6px;
    margin-top: 4px;
    font-size: 0.72rem;
}
.ped-badge-categ {
    background: var(--ped-primary);
    color: #fff;
    margin-top: 4px;
    font-size: 0.72rem;
}

/* --------------------------------------------------------------------------
   Responsive — dispositivos móviles y tablets
   -------------------------------------------------------------------------- */

.lin-section { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── 767px ─────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .pedigree-tree {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .ped-col-self,
    .ped-col-parents,
    .ped-col-grands {
        gap: 4px;
        margin-bottom: 8px;
    }
    .ped-col-parents .ped-box,
    .ped-col-grands  .ped-box { border-left-width: 3px; }

    .ped-score-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }
    .ped-score-bar-wrap { margin: 2px 0; }

    .ped-animal-name { font-size: 1.2rem; }
    .ped-org-name    { font-size: 1.4rem; }
    .ped-title       { font-size: 1.1rem; }

    .ped-results-table thead th:nth-child(4),
    .ped-results-table tbody td:nth-child(4),
    .ped-results-table thead th:nth-child(5),
    .ped-results-table tbody td:nth-child(5) { display: none; }

    .lin-th-left,  .lin-td-left,
    .lin-th-right, .lin-td-right { display: none; }
    .lin-th-name { width: 40%; }
    .lin-th-bar  { width: 50%; }
    .lin-th-val  { width: 10%; }
}

/* ── 575px ──────────────────────────────────────────────────────────────── */
@media (max-width: 575px) {
    .ped-org-name { font-size: 1.25rem; }
    .ped-title    { font-size: 1rem; }
    .ped-subtitle { font-size: 0.9rem; }
    .ped-card-header { padding: 12px 14px; }

    .ped-results-table thead th:nth-child(3),
    .ped-results-table tbody td:nth-child(3),
    .ped-results-table thead th:nth-child(6),
    .ped-results-table tbody td:nth-child(6) { display: none; }

    .ped-pagination .page-link { padding: 5px 10px; font-size: 0.85rem; }

    .modal-xl { max-width: 100%; }
    .modal-dialog { margin: 0.5rem; }
}

/* ── 480px ──────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .ped-card-body   { padding: 12px; }
    .ped-card-header { padding: 10px 12px; }
    .ped-box         { padding: 8px 10px; }
    .ped-animal-name    { font-size: 1.05rem; }
    .ped-registro-badge { font-size: 0.82rem; padding: 3px 8px; }
    .ped-card-header .d-flex { gap: 0.6rem !important; }
    .ped-results-table thead th:nth-child(1),
    .ped-results-table tbody td:nth-child(1) { display: none; }
    .ped-section-title { font-size: 0.78rem; padding: 8px 14px; }
    .ped-premio-item { flex-direction: column; gap: 6px; }
    .ped-premio-icon { font-size: 1.1rem; }
}

/* --------------------------------------------------------------------------
   Lactancias datos compactos
   -------------------------------------------------------------------------- */
.lact-datos {
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    color: var(--ped-primary);
}

/* --------------------------------------------------------------------------
   Botones de acción
   -------------------------------------------------------------------------- */
.ped-btn-pdf {
    background: var(--ped-accent);
    color: #fff;
    border: none;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--ped-radius-sm);
    white-space: nowrap;
    transition: background 0.2s;
    text-decoration: none;
}
.ped-btn-pdf:hover { background: #A87C20; color: #fff; }

.ped-btn-progenie {
    background: var(--ped-secondary);
    color: #fff;
    border: none;
    font-size: .85rem;
    font-weight: 700;
    padding: 8px 20px;
    border-radius: var(--ped-radius-sm);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s;
}
.ped-btn-progenie:hover { background: #1E5038; }

.ped-btn-clasif {
    background: var(--ped-brand);
    color: #fff;
    border: none;
    font-size: .85rem;
    font-weight: 700;
    padding: 8px 20px;
    border-radius: var(--ped-radius-sm);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s;
}
.ped-btn-clasif:hover { background: var(--ped-brand-dk); }

.ped-btn-menu {
    background: var(--ped-brand);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--ped-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.ped-btn-menu:hover,
.ped-btn-menu:focus { background: var(--ped-brand-dk); outline: none; }

/* --------------------------------------------------------------------------
   Clasificación lineal — modal
   -------------------------------------------------------------------------- */
.lin-section-hdr {
    background: var(--ped-brand);
    color: #fff;
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 6px 12px;
    border-radius: var(--ped-radius-sm) var(--ped-radius-sm) 0 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.lin-section-sc {
    background: var(--ped-accent);
    color: #fff;
    font-size: .72rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
}

.lin-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--ped-border);
    border-top: none;
    margin-bottom: 0;
    font-size: .82rem;
}
.lin-table thead tr { background: var(--ped-light); }
.lin-th-name  { width: 22%; padding: 5px 10px; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ped-text-muted); font-weight: 700; }
.lin-th-left  { width: 12%; padding: 5px 8px;  font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ped-text-muted); font-weight: 700; text-align: right; }
.lin-th-bar   { width: 36%; padding: 5px 12px; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ped-text-muted); font-weight: 700; text-align: center; }
.lin-th-right { width: 12%; padding: 5px 8px;  font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ped-text-muted); font-weight: 700; }
.lin-th-val   { width: 6%;  padding: 5px 10px; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ped-text-muted); font-weight: 700; text-align: center; }

.lin-row { border-bottom: 1px solid #EDF0F5; }
.lin-row:last-child { border-bottom: none; }
.lin-row:hover { background: var(--ped-light); }

.lin-td-name  { padding: 7px 10px; font-weight: 600; color: var(--ped-text); }
.lin-td-left  { padding: 7px 8px;  color: var(--ped-text-muted); font-size: .77rem; text-align: right; white-space: nowrap; }
.lin-td-right { padding: 7px 8px;  color: var(--ped-text-muted); font-size: .77rem; white-space: nowrap; }
.lin-td-val   { padding: 7px 10px; font-weight: 700; color: var(--ped-primary); text-align: center; font-size: .9rem; }
.lin-td-bar   { padding: 7px 12px; }

.lin-bar {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
}
.lin-bar-track {
    position: absolute;
    left: 0; right: 0; top: 50%;
    transform: translateY(-50%);
    height: 5px;
    background: #DDE3EC;
    border-radius: 3px;
}
.lin-bar-center {
    position: absolute;
    left: 50%;
    top: 15%;
    height: 70%;
    width: 2px;
    background: #bbb;
    transform: translateX(-50%);
}
.lin-bar-ideal-band {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(46, 107, 79, 0.12);
    pointer-events: none;
    z-index: 0;
}
.lin-bar-ideal-line {
    position: absolute;
    top: 8%;
    height: 84%;
    width: 2px;
    background: var(--ped-secondary);
    opacity: 0.50;
    transform: translateX(-50%);
    z-index: 1;
}
.lin-bar-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: var(--ped-primary);
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(26, 43, 60, 0.35);
    z-index: 1;
}

/* Badges de sección */
.lin-sec-badge {
    text-align: center;
    background: var(--ped-light);
    border: 1px solid var(--ped-border);
    border-top: 3px solid var(--ped-accent);
    border-radius: var(--ped-radius-sm);
    padding: 6px 14px;
    min-width: 80px;
}
.lin-sec-val {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--ped-brand);
    line-height: 1.1;
}
.lin-sec-lbl {
    font-size: .63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ped-text-muted);
    margin-top: 2px;
}

.ped-btn-proof {
    display: inline-block;
    background: transparent;
    color: var(--ped-primary);
    border: 1px solid var(--ped-primary);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: var(--ped-radius-sm);
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
    line-height: 1.7;
}
.ped-btn-proof:hover,
.ped-btn-proof:focus {
    background: var(--ped-primary);
    color: #fff;
    outline: none;
}

/* --------------------------------------------------------------------------
   Modal de pruebas
   -------------------------------------------------------------------------- */
.ped-modal-header {
    background: var(--ped-brand);
    color: #fff;
}
.ped-modal-header .modal-title { font-size: 1rem; font-weight: 700; }

/* --------------------------------------------------------------------------
   Bloques de prueba (canadiense / americana / colombiana)
   -------------------------------------------------------------------------- */
.proof-block {
    background: #fff;
    border: 1px solid var(--ped-border);
    border-radius: var(--ped-radius);
    padding: 16px 18px;
}

.proof-block-title {
    font-size: 0.90rem;
    font-weight: 700;
    color: var(--ped-brand);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.proof-fecha {
    font-size: 0.73rem;
    font-weight: 400;
    color: var(--ped-text-muted);
    text-transform: none;
    letter-spacing: 0;
    background: var(--ped-light);
    border: 1px solid var(--ped-border);
    padding: 2px 8px;
    border-radius: 20px;
}

.proof-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.proof-stat {
    background: #fff;
    border: 1px solid var(--ped-border);
    border-radius: var(--ped-radius-sm);
    padding: 10px 14px;
    text-align: center;
    min-width: 80px;
    flex: 0 1 auto;
}

.proof-stat-main {
    border-color: var(--ped-primary);
    background: var(--ped-light);
}

.proof-stat-val {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ped-primary);
    line-height: 1.2;
}

.proof-stat-main .proof-stat-val { font-size: 1.55rem; }

.proof-stat-lbl {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ped-text-muted);
    margin-top: 3px;
}

.proof-pos .proof-stat-val { color: #2E6B4F; }
.proof-neg .proof-stat-val { color: #C0392B; }

.proof-indices,
.proof-hijas-prom,
.proof-clasif {
    border-top: 1px solid var(--ped-border);
    padding-top: 10px;
}

.proof-indices-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ped-text-muted);
    margin-bottom: 8px;
}

.proof-hijas-prom { font-size: 0.88rem; color: var(--ped-text); }
.proof-clasif     { font-size: 0.85rem; }

/* Prueba colombiana — estilo lista */
.proof-col-block  { border-left: 4px solid var(--ped-primary); }

.proof-col-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.proof-col-titulo {
    font-size: 0.90rem;
    font-weight: 700;
    color: var(--ped-brand);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.proof-col-lista {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.88rem;
    color: var(--ped-text);
}
.proof-col-lista li { border-bottom: 1px solid var(--ped-border); padding-bottom: 4px; }
.proof-col-lista li:last-child { border-bottom: none; }
.proof-col-lista strong { color: var(--ped-primary); }
.proof-col-premio { font-size: 0.82rem; color: var(--ped-text); }
.proof-col-fecha {
    margin-top: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ped-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-top: 1px solid var(--ped-border);
    padding-top: 8px;
}

/* --------------------------------------------------------------------------
   Botón "Apareamiento" (ámbar — acción especializada)
   -------------------------------------------------------------------------- */
.ped-btn-mating {
    background: #A0621A;
    color: #fff;
    border: none;
    font-size: .85rem;
    font-weight: 700;
    padding: 8px 20px;
    border-radius: var(--ped-radius-sm);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s;
}
.ped-btn-mating:hover { background: #7A4A12; }

.ped-btn-mating-search {
    background: #A0621A;
    color: #fff;
    border: none;
    font-weight: 700;
    padding: 6px 18px;
    border-radius: var(--ped-radius-sm);
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.ped-btn-mating-search:hover,
.ped-btn-mating-search:focus { background: #7A4A12; color: #fff; outline: none; }
.ped-btn-mating-search:disabled { opacity: .65; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   Modal de Análisis de Apareamiento
   -------------------------------------------------------------------------- */
.mat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--ped-light);
    border: 1px solid var(--ped-border);
    border-radius: var(--ped-radius);
    padding: 12px 16px;
    margin-bottom: 14px;
}

.mat-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    min-width: 0;
}

.mat-pair-label {
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ped-text-muted);
    margin-bottom: 2px;
}

.mat-pair-cow  .mat-pair-label { color: var(--ped-secondary); }
.mat-pair-bull .mat-pair-label { color: #A0621A; }

.mat-pair-name {
    font-size: .93rem;
    font-weight: 700;
    color: var(--ped-brand);
    line-height: 1.2;
    word-break: break-word;
}

.mat-pair-reg {
    font-size: .72rem;
    color: var(--ped-text-muted);
    font-family: 'Consolas', 'Courier New', monospace;
    margin-top: 2px;
}

.mat-times {
    font-size: 1.6rem;
    font-weight: 300;
    color: var(--ped-border);
    flex-shrink: 0;
    padding: 0 4px;
}

.mat-source-note {
    font-size: .72rem;
    color: var(--ped-text-muted);
    text-align: center;
    margin-bottom: 12px;
    font-style: italic;
}

.mat-rec {
    font-size: .88rem;
    font-weight: 600;
    margin-bottom: 14px;
    border-radius: var(--ped-radius-sm);
}

.mat-section {
    margin-bottom: 12px;
    border: 1px solid var(--ped-border);
    border-radius: var(--ped-radius-sm);
    overflow: hidden;
}

.mat-sec-hdr {
    background: var(--ped-brand);
    color: #fff;
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 7px 14px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.mat-sec-subtitle {
    background: #EDF0F5;
    color: #4a6070;
    font-size: .72rem;
    padding: 3px 14px 4px;
    border-bottom: 1px solid var(--ped-border);
    font-style: italic;
    letter-spacing: .01em;
}
.mat-sec-body {
    padding: 8px 14px;
    background: #fff;
}

.mat-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 4px 8px;
    padding: 5px 0;
    border-bottom: 1px solid #EDF0F5;
    font-size: .86rem;
}
.mat-item:last-child { border-bottom: none; }

.mat-item-label {
    color: var(--ped-text-muted);
    font-size: .82rem;
    flex: 1;
    min-width: 0;
}

.mat-item-val {
    font-weight: 600;
    color: var(--ped-text);
    text-align: right;
    white-space: nowrap;
}

.mat-item-note {
    width: 100%;
    font-size: .75rem;
    color: #666;
    font-style: italic;
    line-height: 1.4;
    padding: 1px 0 4px 0;
}

.mat-val-good      { color: #2E6B4F; }
.mat-val-bad       { color: #C0392B; }
.mat-val-highlight {
    color: var(--ped-brand);
    font-size: .93rem;
    background: var(--ped-light);
    border: 1px solid var(--ped-accent);
    border-radius: 4px;
    padding: 2px 8px;
}

.mat-clasif-note {
    font-size: .75rem;
    color: var(--ped-text-muted);
    margin-bottom: 6px;
    font-style: italic;
}

.mat-comp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
    margin-top: 4px;
}
.mat-comp-table thead tr { background: var(--ped-light); }
.mat-comp-table th {
    padding: 5px 8px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ped-text-muted);
    border-bottom: 2px solid var(--ped-border);
}
.mat-comp-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #EDF0F5;
    vertical-align: middle;
}
.mat-comp-table tr:last-child td { border-bottom: none; }

.mat-comp-good { background: #F3FAF6; }
.mat-comp-bad  { background: #FDF4F3; }
.mat-comp-note { font-size: .77rem; color: var(--ped-text-muted); }
.mat-comp-good .mat-comp-note { color: #2E6B4F; }
.mat-comp-bad  .mat-comp-note { color: #C0392B; }

.mat-score-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}
.mat-score-track {
    position: relative;
    width: 46px;
    height: 8px;
    background: #DDE3EC;
    border-radius: 4px;
    flex-shrink: 0;
}
.mat-score-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.22);
    z-index: 1;
}
.mat-score-num {
    font-size: .8rem;
    font-weight: 700;
    color: var(--ped-primary);
    min-width: 18px;
    text-align: left;
}

@media (max-width: 480px) {
    .mat-header    { flex-direction: column; gap: 6px; }
    .mat-times     { font-size: 1.2rem; padding: 0; }
    .mat-pair      { flex-direction: row; text-align: left; gap: 8px; align-items: baseline; }
    .mat-pair-name { font-size: .88rem; }
    .mat-comp-table th:nth-child(2),
    .mat-comp-table td:nth-child(2) { display: none; }
}

/* --------------------------------------------------------------------------
   Formulario de ingreso manual (apareamiento)
   -------------------------------------------------------------------------- */
.mat-manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 10px 14px;
}
.mat-manual-wide { grid-column: 1 / -1; }
.mat-manual-field label {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    color: var(--ped-text-muted);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.mat-manual-field label small {
    font-weight: 400;
    text-transform: none;
    color: #999;
    letter-spacing: 0;
}
@media (max-width: 480px) {
    .mat-manual-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Cabecera del dashboard */
.dash-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
}
.dash-header-title {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ped-brand);
}
.dash-header-sub {
    font-size: .67rem;
    color: var(--ped-text-muted);
}
.dash-header-sub--warn {
    color: #9A7215;
}

/* Tarjeta base */
.dash-card {
    background: #fff;
    border: 1px solid var(--ped-border);
    border-radius: var(--ped-radius);
    padding: 13px 14px 11px;
    box-shadow: var(--ped-shadow);
}
.dash-card-title {
    font-size: .69rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ped-brand);
    border-bottom: 1px solid var(--ped-border);
    padding-bottom: 7px;
    margin-bottom: 9px;
}

/* Bloque de métrica individual */
.dash-metric {
    margin-bottom: 10px;
}
.dash-metric:last-child { margin-bottom: 0; }
.dash-metric-label {
    font-size: .67rem;
    color: var(--ped-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 3px;
}
.dash-metric-vals {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 4px;
}
.dash-metric-ani {
    font-size: .85rem;
    font-weight: 700;
    color: var(--ped-text);
}
.dash-metric-pob {
    font-size: .67rem;
    color: var(--ped-text-muted);
    text-align: right;
    flex-shrink: 0;
}

/* Fila de leche en vida (sin barra) */
.dash-metric--total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 7px;
    border-top: 1px dashed var(--ped-border);
    margin-top: 8px;
}
.dash-metric-total-val {
    font-size: .88rem;
    font-weight: 700;
    color: var(--ped-primary);
}

/* ── Barra de comparación con marcador de promedio ── */
.dash-cmp-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
}
.dash-cmp-bar-track {
    position: relative;
    flex: 1;
    height: 6px;
    background: var(--ped-border);
    border-radius: 3px;
    overflow: visible;
}
.dash-cmp-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .5s ease;
}
/* Marcador vertical del promedio de la población */
.dash-cmp-bar-avg {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 12px;
    background: var(--ped-text);
    border-radius: 1px;
    transform: translateX(-50%);
}
.dash-cmp-avg-tip {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: .55rem;
    color: var(--ped-text-muted);
    white-space: nowrap;
    font-weight: 600;
}

/* Badge de diferencia (+/- %) */
.dash-diff {
    font-size: .68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
.dash-diff--pos {
    background: #e8f5ee;
    color: #2E6B4F;
    border: 1px solid #b5ddc7;
}
.dash-diff--neg {
    background: #fdf0ef;
    color: #a33;
    border: 1px solid #f0c0bd;
}

/* Fila stat simple (sin barra) */
.dash-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
}
.dash-stat-label {
    font-size: .7rem;
    color: var(--ped-text-muted);
}
.dash-stat-val {
    font-size: .78rem;
    font-weight: 600;
    color: var(--ped-text);
}

/* Badge de clasificación */
.dash-clasif-badge {
    font-size: .75rem;
    font-weight: 700;
    background: var(--ped-light);
    border: 1px solid var(--ped-border);
    border-radius: var(--ped-radius-sm);
    padding: 3px 10px;
    color: var(--ped-brand);
    text-align: center;
    margin-top: 6px;
    letter-spacing: .04em;
}

/* Estado badge */
.dash-estado-badge {
    font-size: .75rem;
    font-weight: 600;
    background: var(--ped-light);
    border: 1px solid var(--ped-border);
    border-radius: var(--ped-radius-sm);
    padding: 4px 10px;
    color: var(--ped-brand);
    text-align: center;
    margin: 3px 0;
}

/* Nota de referencia (fuente del promedio) */
.dash-ref-note {
    font-size: .63rem;
    color: var(--ped-text-muted);
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px dashed var(--ped-border);
}

/* Mensajes vacío / nota */
.dash-empty {
    font-size: .71rem;
    color: var(--ped-text-muted);
    font-style: italic;
    text-align: center;
    padding: 4px 0;
}
.dash-note {
    font-size: .68rem;
    color: var(--ped-text-muted);
    font-style: italic;
    margin-top: 4px;
    line-height: 1.4;
}

/* Sticky sidebar en pantallas grandes */
@media (min-width: 992px) {
    .col-lg-3.d-none.d-lg-block {
        position: sticky;
        top: 20px;
        align-self: flex-start;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        scrollbar-width: thin;
    }
}
