:root {
    --tv-ink: #382818;
    --tv-ink-soft: #5f574a;
    --tv-olive: #908060;
    --tv-olive-dark: #776a4f;
    --tv-olive-soft: #9d9175;
    --tv-wine: #581010;
    --tv-gold: #a08050;
    --tv-red: #d82820;
    --tv-paper: #f4f4f3;
    --tv-paper-2: #e5e1db;
    --tv-line: #e0ded8;
    --tv-white: #ffffff;
}

body.public-body {
    background: var(--tv-paper);
    color: var(--tv-ink);
    display: flex;
    flex-direction: column;
    font-family: Arial, Helvetica, sans-serif;
    min-height: 100vh;
}

.public-body main {
    flex: 1 0 auto;
}

.public-body .container {
    max-width: 1600px;
    padding-left: 24px;
    padding-right: 24px;
}

.public-navbar {
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--tv-line);
    min-height: 76px;
}

.public-brand {
    align-items: center;
    color: var(--tv-ink);
    display: inline-flex;
    gap: 12px;
    line-height: 1.1;
}

.public-brand img {
    height: 54px;
    width: 54px;
    object-fit: contain;
}

.public-brand strong,
.public-brand small {
    display: block;
}

.public-brand strong {
    font-size: 1.05rem;
}

.public-brand small {
    color: var(--tv-ink-soft);
    font-size: .78rem;
    margin-top: 3px;
}

.public-navbar .nav-link {
    color: var(--tv-ink);
    font-weight: 600;
    padding-left: .85rem;
    padding-right: .85rem;
}

.public-navbar .nav-link:hover,
.public-navbar .nav-link:focus {
    color: var(--tv-wine);
}

.public-login-btn,
.portal-btn-primary,
.portal-btn-secondary {
    align-items: center;
    border-radius: 6px;
    display: inline-flex;
    font-weight: 700;
    gap: 8px;
    justify-content: center;
    min-height: 42px;
}

.public-login-btn {
    background: var(--tv-wine);
    color: var(--tv-white);
    padding: .55rem 1rem;
}

.public-login-btn:hover,
.public-login-btn:focus {
    background: #701010;
    color: var(--tv-white);
}

.portal-hero {
    background: var(--tv-ink) url("../images/hero-tribunal-virtual-v3.png") center right / cover no-repeat;
    color: var(--tv-white);
    min-height: calc(100vh - 76px);
    position: relative;
}

.portal-hero-overlay {
    background: linear-gradient(90deg, rgba(56, 40, 24, .94) 0%, rgba(56, 40, 24, .78) 40%, rgba(144, 128, 96, .20) 100%);
    inset: 0;
    position: absolute;
}

.portal-hero-content {
    align-items: center;
    display: flex;
    min-height: calc(100vh - 76px);
    padding-bottom: 48px;
    padding-top: 48px;
    position: relative;
}

.portal-hero-copy {
    max-width: 680px;
}

.portal-kicker {
    color: var(--tv-gold);
    display: block;
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .08rem;
    margin-bottom: 14px;
    text-transform: uppercase;
}

.portal-hero h1 {
    font-size: clamp(2.5rem, 7vw, 5.8rem);
    font-weight: 800;
    line-height: 1;
    margin: 0 0 20px;
}

.portal-hero p {
    color: rgba(255, 255, 255, .9);
    font-size: 1.15rem;
    line-height: 1.7;
    margin-bottom: 30px;
    max-width: 620px;
}

.portal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.portal-btn-primary {
    background: var(--tv-olive);
    color: var(--tv-white);
    padding: .8rem 1.15rem;
}

.portal-btn-primary:hover,
.portal-btn-primary:focus {
    background: var(--tv-olive-dark);
    color: var(--tv-white);
}

.portal-btn-secondary {
    border: 1px solid rgba(255, 255, 255, .72);
    color: var(--tv-white);
    padding: .8rem 1.15rem;
}

.portal-btn-secondary:hover,
.portal-btn-secondary:focus {
    background: rgba(255, 255, 255, .12);
    color: var(--tv-white);
}

.portal-section {
    padding: 72px 0;
}

.portal-section-heading {
    margin: 0 auto 34px;
    max-width: 720px;
    text-align: center;
}

.portal-section-heading span {
    color: var(--tv-wine);
    display: block;
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .07rem;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.portal-section-heading h2,
.portal-band h2,
.module-hero h1 {
    color: var(--tv-ink);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.18;
    margin-bottom: 12px;
}

.portal-section-heading p,
.portal-band p,
.module-hero p,
.module-panel p {
    color: var(--tv-ink-soft);
    line-height: 1.65;
    margin-bottom: 0;
}

.service-card {
    background: var(--tv-white);
    border: 1px solid var(--tv-line);
    border-radius: 8px;
    color: var(--tv-ink);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 238px;
    padding: 26px;
    text-decoration: none;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.service-card i {
    align-items: center;
    background: #f0ece3;
    border-radius: 8px;
    color: var(--tv-olive-dark);
    display: inline-flex;
    font-size: 2rem;
    height: 52px;
    justify-content: center;
    width: 52px;
}

.service-card strong {
    font-size: 1.14rem;
}

.service-card span {
    color: var(--tv-ink-soft);
    line-height: 1.55;
}

.service-card:hover,
.service-card:focus {
    border-color: var(--tv-gold);
    box-shadow: 0 18px 40px rgba(17, 37, 45, .12);
    color: var(--tv-ink);
    transform: translateY(-2px);
}

.service-card-secure i {
    background: #f3e8eb;
    color: var(--tv-wine);
}

.portal-band {
    background: var(--tv-white);
    border-bottom: 1px solid var(--tv-line);
    border-top: 1px solid var(--tv-line);
    padding: 56px 0;
}

.portal-band-grid {
    align-items: center;
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
}

.portal-help {
    background: var(--tv-paper-2);
}

.portal-steps {
    display: grid;
    gap: 14px;
}

.portal-steps div {
    align-items: center;
    background: var(--tv-white);
    border: 1px solid var(--tv-line);
    border-radius: 8px;
    display: grid;
    gap: 16px;
    grid-template-columns: 44px 1fr;
    padding: 18px;
}

.portal-steps b {
    align-items: center;
    background: var(--tv-olive);
    border-radius: 8px;
    color: var(--tv-white);
    display: inline-flex;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.portal-steps span {
    color: var(--tv-ink-soft);
}

.public-footer {
    background: var(--tv-ink);
    color: rgba(255, 255, 255, .84);
    padding: 26px 0;
}

.public-footer .container {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
}

.public-footer strong,
.public-footer span {
    display: block;
}

.public-footer a {
    color: rgba(255, 255, 255, .86);
    font-weight: 700;
    text-decoration: none;
}

.public-footer a:hover,
.public-footer a:focus {
    color: var(--tv-gold);
}

.public-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.module-hero {
    background:
        linear-gradient(90deg, rgba(244, 244, 243, .96) 0%, rgba(244, 244, 243, .9) 45%, rgba(244, 244, 243, .74) 100%),
        url("../images/hero-tribunal-virtual-v3.png") center right / cover no-repeat;
    border-bottom: 1px solid var(--tv-line);
    padding: 70px 0 54px;
    position: relative;
}

.module-back {
    align-items: center;
    color: var(--tv-wine);
    display: inline-flex;
    font-weight: 800;
    gap: 6px;
    margin-bottom: 22px;
    text-decoration: none;
}

.module-panel {
    align-items: flex-start;
    background: var(--tv-white);
    border: 1px solid var(--tv-line);
    border-radius: 8px;
    display: flex;
    gap: 20px;
    max-width: 820px;
    padding: 28px;
}

.module-panel i {
    color: var(--tv-gold);
    font-size: 2.2rem;
}

.module-panel h2 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.module-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.juicios-feature-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.juicios-feature {
    background: var(--tv-white);
    border: 1px solid var(--tv-line);
    border-radius: 8px;
    min-height: 230px;
    padding: 24px;
}

.juicios-feature i {
    align-items: center;
    background: #f0ece3;
    border-radius: 8px;
    color: var(--tv-olive-dark);
    display: inline-flex;
    font-size: 1.9rem;
    height: 52px;
    justify-content: center;
    margin-bottom: 18px;
    width: 52px;
}

.juicios-feature h3 {
    color: var(--tv-ink);
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.juicios-feature p,
.juicios-access-panel p {
    color: var(--tv-ink-soft);
    line-height: 1.62;
    margin-bottom: 0;
}

.juicios-band {
    background: var(--tv-paper);
}

.juicios-access {
    padding-top: 0;
}

.juicios-access-panel {
    align-items: center;
    background: var(--tv-white);
    border: 1px solid var(--tv-line);
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(56, 40, 24, .07);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 28px;
}

.juicios-access-panel h2 {
    color: var(--tv-ink);
    font-size: 1.45rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.query-panel,
.results-panel {
    background: var(--tv-white);
    border: 1px solid var(--tv-line);
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(56, 40, 24, .07);
}

.query-panel {
    margin-bottom: 24px;
    padding: 24px;
}

.query-panel .form-label {
    color: var(--tv-ink);
    font-size: .88rem;
    font-weight: 800;
}

.query-panel .form-control,
.query-panel .form-select {
    border-color: var(--tv-line);
    border-radius: 6px;
    min-height: 42px;
}

.query-panel .form-control:focus,
.query-panel .form-select:focus {
    border-color: var(--tv-olive);
    box-shadow: 0 0 0 .2rem rgba(144, 128, 96, .18);
}

.query-submit {
    align-items: center;
    background: var(--tv-wine);
    border-radius: 6px;
    color: var(--tv-white);
    display: inline-flex;
    font-weight: 800;
    gap: 8px;
    justify-content: center;
    min-height: 42px;
    min-width: 138px;
}

.query-clear {
    align-items: center;
    border: 1px solid var(--tv-line);
    border-radius: 6px;
    color: var(--tv-ink);
    display: inline-flex;
    font-weight: 800;
    gap: 8px;
    justify-content: center;
    min-height: 42px;
    min-width: 118px;
}

.query-clear:hover,
.query-clear:focus {
    background: #f8f7f4;
    color: var(--tv-ink);
}

.query-clear.disabled {
    opacity: .65;
    pointer-events: none;
}

.query-submit:hover,
.query-submit:focus {
    background: #701010;
    color: var(--tv-white);
}

.results-panel {
    overflow: hidden;
}

.results-heading {
    align-items: center;
    background: #f8f7f4;
    border-bottom: 1px solid var(--tv-line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 18px 22px;
}

.results-heading h2 {
    color: var(--tv-ink);
    font-size: 1.12rem;
    font-weight: 800;
    margin: 0;
}

.results-heading span {
    color: var(--tv-ink-soft);
    font-weight: 700;
}

.public-table {
    margin-bottom: 0;
    min-width: 1180px;
}

.sentencias-table {
    min-width: 1460px;
}

.public-table thead th {
    background: var(--tv-olive);
    color: var(--tv-white);
    font-size: .82rem;
    letter-spacing: .02rem;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
}

.public-table tbody tr {
    transition: background-color .15s ease;
}

.public-table tbody tr:hover {
    background: #fbfaf7;
}

.public-table tbody td {
    color: var(--tv-ink-soft);
    font-size: .88rem;
    line-height: 1.45;
    padding: 12px 10px;
    vertical-align: middle;
}

.table-expediente {
    width: 120px;
}

.table-expediente span {
    color: var(--tv-ink);
    font-weight: 800;
    white-space: nowrap;
}

.table-materia {
    text-align: center;
    width: 110px;
}

.table-registro {
    width: 170px;
}

.table-registro span {
    background: #f1eee7;
    border: 1px solid #e4ddd0;
    border-radius: 999px;
    color: var(--tv-ink);
    display: inline-block;
    font-size: .78rem;
    font-weight: 800;
    line-height: 1.3;
    max-width: 100%;
    padding: 5px 9px;
}

.table-juzgado {
    color: var(--tv-ink);
    font-weight: 700;
    min-width: 260px;
}

.table-date {
    color: var(--tv-ink);
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    white-space: nowrap;
    width: 150px;
}

.table-resumen {
    min-width: 330px;
}

.public-pagination {
    align-items: center;
    background: #f8f7f4;
    border-top: 1px solid var(--tv-line);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    padding: 14px 18px;
}

.public-pagination a {
    align-items: center;
    border: 1px solid var(--tv-line);
    border-radius: 6px;
    color: var(--tv-ink);
    display: inline-flex;
    font-weight: 800;
    gap: 4px;
    min-height: 36px;
    min-width: 36px;
    justify-content: center;
    padding: 6px 10px;
    text-decoration: none;
}

.public-pagination a:hover,
.public-pagination a:focus {
    background: #fff;
    border-color: var(--tv-olive);
    color: var(--tv-wine);
}

.public-pagination a.active {
    background: var(--tv-wine);
    border-color: var(--tv-wine);
    color: var(--tv-white);
}

.public-pagination a.disabled {
    opacity: .45;
    pointer-events: none;
}

.document-link {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--tv-wine);
    display: inline-flex;
    font-weight: 800;
    gap: 6px;
    padding: 0;
    text-decoration: none;
    white-space: nowrap;
}

.document-link:hover,
.document-link:focus {
    color: #701010;
}

.table-actions {
    align-items: center;
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 12px;
    justify-content: center;
    min-width: 224px;
}

.table-actions-heading,
.table-actions-cell {
    min-width: 250px;
    width: 250px;
}

.summary-link {
    cursor: pointer;
}

.summary-link[disabled] {
    cursor: wait;
    opacity: .62;
}

.action-pill {
    border-radius: 999px;
    font-size: .78rem;
    justify-content: center;
    line-height: 1;
    min-height: 34px;
    padding: 8px 13px;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.action-pill i {
    font-size: 1rem;
}

.action-pill-summary {
    background: #f3efe7;
    border: 1px solid #d9cdb7;
    color: var(--tv-ink);
    min-width: 104px;
}

.action-pill-pdf {
    background: var(--tv-white);
    border: 1px solid #e1c8c8;
    color: var(--tv-wine);
    min-width: 86px;
}

.action-pill-summary:hover,
.action-pill-summary:focus {
    background: var(--tv-olive);
    border-color: var(--tv-olive);
    box-shadow: 0 8px 18px rgba(56, 40, 24, .12);
    color: var(--tv-white);
    transform: translateY(-1px);
}

.action-pill-pdf:hover,
.action-pill-pdf:focus {
    background: var(--tv-wine);
    border-color: var(--tv-wine);
    box-shadow: 0 8px 18px rgba(88, 16, 16, .14);
    color: var(--tv-white);
    transform: translateY(-1px);
}

.summary-modal {
    display: none;
    inset: 0;
    position: fixed;
    z-index: 1060;
}

.summary-modal.is-open {
    display: block;
}

.summary-modal-overlay {
    align-items: center;
    background: rgba(56, 40, 24, .48);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 18px;
    position: fixed;
}

.summary-modal-dialog {
    background: var(--tv-white);
    border-radius: 8px;
    box-shadow: 0 22px 54px rgba(56, 40, 24, .28);
    display: flex;
    flex-direction: column;
    max-height: 88vh;
    max-width: 860px;
    overflow: hidden;
    width: min(860px, 96vw);
}

.summary-modal-header,
.summary-modal-footer {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 16px 18px;
}

.summary-modal-header {
    border-bottom: 1px solid var(--tv-line);
}

.summary-modal-title {
    align-items: center;
    color: var(--tv-ink);
    display: inline-flex;
    font-size: 1.05rem;
    font-weight: 800;
    gap: 8px;
    margin: 0;
}

.summary-modal-close {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--tv-ink);
    display: inline-flex;
    font-size: 1.4rem;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.summary-modal-body {
    color: var(--tv-ink-soft);
    line-height: 1.62;
    overflow: auto;
    padding: 18px;
}

.summary-modal-content {
    white-space: pre-wrap;
}

.summary-modal-loading {
    align-items: center;
    color: var(--tv-ink);
    display: flex;
    flex-direction: column;
    font-weight: 800;
    gap: 12px;
    justify-content: center;
    min-height: 180px;
    text-align: center;
}

.summary-modal-loading img {
    height: 64px;
    object-fit: contain;
    width: 64px;
}

.summary-modal-footer {
    border-top: 1px solid var(--tv-line);
    justify-content: flex-end;
}

.public-alert {
    align-items: center;
    background: #fff7e8;
    border: 1px solid #e8d4aa;
    border-radius: 8px;
    color: var(--tv-ink);
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px 16px;
}

.public-alert i {
    color: var(--tv-gold);
    font-size: 1.35rem;
}

.boletin-note {
    align-items: flex-start;
    background: #f8f7f4;
    border: 1px solid var(--tv-line);
    border-left: 4px solid var(--tv-olive);
    border-radius: 8px;
    color: var(--tv-ink-soft);
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    padding: 13px 16px;
}

.boletin-note i {
    color: var(--tv-olive-dark);
    font-size: 1.3rem;
    line-height: 1.3;
}

.boletin-note p {
    line-height: 1.55;
    margin: 0;
}

.boletin-loading {
    align-items: center;
    background: rgba(244, 244, 243, .72);
    display: flex;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 1050;
}

.boletin-loading[hidden] {
    display: none;
}

.boletin-loading-box {
    align-items: center;
    background: var(--tv-white);
    border: 1px solid var(--tv-line);
    border-radius: 8px;
    box-shadow: 0 18px 46px rgba(56, 40, 24, .18);
    color: var(--tv-ink);
    display: flex;
    flex-direction: column;
    font-weight: 800;
    gap: 12px;
    min-width: 220px;
    padding: 22px 26px;
}

.boletin-loading-box img {
    height: 64px;
    object-fit: contain;
    width: 64px;
}

@media (max-width: 991.98px) {
    .public-navbar .navbar-nav {
        align-items: stretch !important;
        padding: 18px 0 8px;
    }

    .portal-band-grid {
        grid-template-columns: 1fr;
    }

    .juicios-feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .juicios-access-panel {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {
    .public-body .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .public-brand small {
        display: none;
    }

    .portal-hero,
    .portal-hero-content {
        min-height: auto;
    }

    .portal-hero-content {
        padding-bottom: 72px;
        padding-top: 72px;
    }

    .portal-hero-overlay {
        background: rgba(17, 37, 45, .88);
    }

    .portal-actions,
    .portal-actions .btn {
        width: 100%;
    }

    .portal-section {
        padding: 54px 0;
    }

    .service-card {
        min-height: auto;
    }

    .juicios-feature-grid {
        grid-template-columns: 1fr;
    }

    .juicios-feature {
        min-height: auto;
    }

    .module-actions,
    .module-actions .btn,
    .juicios-access-panel .btn {
        width: 100%;
    }

    .public-footer .container {
        align-items: flex-start;
        flex-direction: column;
    }

    .module-panel {
        flex-direction: column;
    }
}
