:root { color-scheme: light; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: #172033; background: #f3f5f8; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; line-height: 1.5; }
a { color: #0b4f7d; }
a:hover { color: #073653; }
:focus-visible { outline: 3px solid #e2a92c; outline-offset: 3px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card, .panel { width: min(100%, 42rem); margin: 3rem auto; padding: 2rem; background: white; border-radius: .75rem; box-shadow: 0 8px 30px #17203318; }
form { display: grid; gap: .75rem; }
label { font-weight: 650; }
input { width: 100%; padding: .75rem; border: 1px solid #b8c0cc; border-radius: .4rem; font: inherit; }
.association-confirmation input[type="checkbox"] { width: auto; margin-right: .5rem; }
select { width: 100%; padding: .75rem; border: 1px solid #b8c0cc; border-radius: .4rem; background: white; font: inherit; }
textarea { width: 100%; padding: .75rem; border: 1px solid #b8c0cc; border-radius: .4rem; resize: vertical; font: inherit; }
button { padding: .75rem 1rem; border: 0; border-radius: .4rem; background: #174f83; color: white; font: inherit; font-weight: 700; cursor: pointer; }
button.secondary { background: #445064; }
button.danger { background: #9d2533; }
.alert { margin: 1rem 0; padding: .8rem; border-radius: .4rem; color: #7b1822; background: #fdebed; }
.alert-neutral { margin: 1rem 0; padding: .8rem; border-radius: .4rem; color: #33445e; background: #eaf2fa; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 2rem; background: #172033; color: white; }
.topbar form { display: block; }
.brand { color: white; text-decoration: none; font-weight: 800; }
.user-menu { display: flex; align-items: center; gap: .75rem; }
.role-badge { padding: .2rem .55rem; border-radius: 999px; background: #ffffff20; font-size: .8rem; font-weight: 800; }
.role-dark { color: #26344a; background: #e7ebf0; }
.panel-grid { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: calc(100vh - 4.5rem); }
.sidebar { padding: 1.5rem 1rem; background: white; border-right: 1px solid #dce1e8; }
.sidebar a { display: block; margin-bottom: .35rem; padding: .7rem .8rem; border-radius: .4rem; color: #26344a; text-decoration: none; }
.sidebar a:hover, .sidebar a.active { color: #123f69; background: #eaf2fa; font-weight: 750; }
.panel-content { width: 100%; max-width: 75rem; padding: 2rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; }
.card, .empty-state { padding: 1.25rem; border: 1px solid #dce1e8; border-radius: .65rem; background: white; }
.empty-state { color: #566276; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; margin: 1.5rem 0; padding: 1rem; border: 1px solid #dce1e8; border-radius: .65rem; background: white; }
.filters > div { display: grid; align-content: end; gap: .4rem; }
.filter-actions { grid-template-columns: 1fr 1fr; align-items: end; }
.filter-actions a { padding: .75rem; text-align: center; }
.result-count { color: #566276; }
.table-wrap { overflow-x: auto; border: 1px solid #dce1e8; border-radius: .65rem; background: white; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .85rem; text-align: left; border-bottom: 1px solid #e5e9ef; vertical-align: top; }
th { background: #f7f9fb; }
small { color: #667286; }
.status { display: inline-block; padding: .25rem .5rem; border-radius: 999px; background: #e7ebf0; font-size: .75rem; font-weight: 800; }
.status-publicado { color: #146338; background: #e3f5e9; }
.status-retirado { color: #8b2430; background: #f9e5e8; }
.integrity-ok { color: #146338; background: #e3f5e9; }
.integrity-error { color: #8b2430; background: #f9e5e8; }
.health-ok { color: #146338; background: #e3f5e9; }
.health-error { color: #8b2430; background: #f9e5e8; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.page-heading h1 { margin-bottom: .25rem; }
.button-link { display: inline-block; padding: .75rem 1rem; border-radius: .4rem; background: #174f83; color: white; text-decoration: none; font-weight: 700; white-space: nowrap; }
.button-secondary { background: #445064; }
.dashboard-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .65rem; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 1rem; margin: 1.5rem 0 2rem; }
.metric-card { display: flex; min-height: 8.5rem; padding: 1.1rem; flex-direction: column; justify-content: space-between; border: 1px solid #dce1e8; border-radius: .65rem; color: #445064; background: white; text-decoration: none; }
a.metric-card:hover { border-color: #8eb4d6; box-shadow: 0 5px 18px #17203310; }
.metric-card strong { color: #172033; font-size: 2rem; line-height: 1; }
.dashboard-section { margin-top: 1rem; }
.report-section { margin-top: 2rem; }
.success { margin: 1rem 0; padding: .8rem; border-radius: .4rem; color: #146338; background: #e3f5e9; }
.document-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1.25rem; border: 1px solid #dce1e8; border-radius: .65rem; background: white; }
.document-form > div { display: grid; align-content: start; gap: .4rem; }
.document-form .full { grid-column: 1 / -1; }
.field-error { color: #a51d2d; }
.form-actions { display: flex !important; flex-direction: row; align-items: center; }
.upload-form { max-width: 40rem; padding: 1.25rem; border: 1px solid #dce1e8; border-radius: .65rem; background: white; }
.actions { min-width: 11rem; }
.actions > a { display: inline-block; margin: 0 .45rem .35rem 0; }
.actions form { display: inline; margin-left: .5rem; }
.link-button { display: inline; padding: 0; border: 0; background: transparent; color: #174f83; font-weight: 400; text-decoration: underline; }
.danger-link { margin-left: .5rem; color: #9d2533; }
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: #f3f5f8; }
.error-card { max-width: 32rem; padding: 2rem; text-align: center; background: white; border-radius: .75rem; box-shadow: 0 8px 30px #17203318; }
.error-code { margin: 0; color: #a51d2d; font-size: 4rem; font-weight: 900; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; }
dt { font-weight: 700; }
dd { margin: 0; }
@media (max-width: 700px) {
    .topbar { align-items: flex-start; padding: 1rem; }
    .user-menu { align-items: flex-end; flex-direction: column; }
    .panel-grid { grid-template-columns: 1fr; }
    .sidebar { display: flex; gap: .5rem; overflow-x: auto; border-right: 0; border-bottom: 1px solid #dce1e8; }
    .sidebar a { margin: 0; white-space: nowrap; }
    .panel-content { padding: 1rem; }
    .document-form { grid-template-columns: 1fr; }
}
.public-site { min-height: 100vh; color: #172033; background: #f7f9fb; }
.public-site a { color: #5c1e2a; }
.public-site a:hover { color: #3f141d; }
.public-site button, .public-site .button-link { color: white; background: #5c1e2a; }
.public-site button:hover, .public-site .button-link:hover { color: white; background: #3f141d; }
.skip-link { position: fixed; z-index: 1000; top: .5rem; left: .5rem; padding: .75rem 1rem; border-radius: .35rem; color: white; background: #172033; transform: translateY(-150%); }
.skip-link:focus { color: white; transform: translateY(0); }
.public-header { padding: 0; border-bottom: 4px solid #b98a32; color: white; background: #5c1e2a; }
.public-header-inner { display: flex; width: min(calc(100% - 2rem), 75rem); min-height: 6.5rem; margin: 0 auto; justify-content: space-between; align-items: center; gap: 2rem; }
.public-header a { color: white; text-decoration: none; }
.municipal-brand { display: flex; align-items: center; gap: .85rem; min-width: 16rem; }
.municipal-brand img { width: 54px; height: 80px; object-fit: contain; filter: drop-shadow(0 2px 2px #0005); }
.municipal-brand span { display: grid; line-height: 1.2; }
.municipal-brand strong { font-size: 1rem; }
.municipal-brand small { margin-top: .35rem; color: #e8edf2; font-size: .88rem; }
.public-navigation { display: flex; align-items: center; justify-content: flex-end; gap: .25rem; }
.public-navigation a { padding: .7rem .8rem; border-radius: .35rem; font-weight: 700; }
.public-navigation a:hover, .public-navigation a[aria-current="page"] { color: white; background: #ffffff1f; }
.public-navigation .administrative-link { margin-left: .25rem; border: 1px solid #e7c780; }
.hero, .public-main { width: min(calc(100% - 2rem), 75rem); margin: 0 auto; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(10rem, 17rem); align-items: center; gap: 3rem; padding: 5.5rem 0; }
.hero h1 { max-width: 50rem; margin: .4rem 0 1rem; font-size: clamp(2.2rem, 6vw, 4.5rem); line-height: 1.05; }
.hero > p:not(.eyebrow) { max-width: 42rem; margin-bottom: 2rem; font-size: 1.2rem; color: #4d5c71; }
.hero > div > p:not(.eyebrow) { max-width: 42rem; margin-bottom: 2rem; font-size: 1.2rem; color: #4d5c71; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.hero-actions .text-link { padding: .7rem .25rem; font-weight: 750; }
.hero-crest { width: min(100%, 188px); height: auto; justify-self: center; filter: drop-shadow(0 12px 18px #1720332e); }
.eyebrow { color: #5c1e2a; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.public-main { padding: 3rem 0; }
.public-features { width: min(calc(100% - 2rem), 75rem); margin: 0 auto; padding: 0 0 4.5rem; }
.public-features > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.public-features article { padding: 1.35rem; border-top: 4px solid #b98a32; border-radius: .35rem .35rem .7rem .7rem; background: white; box-shadow: 0 5px 18px #1720330d; }
.public-features h3 { margin-top: 0; }
.public-filters { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.advanced-search .search-wide { grid-column: 1 / -1; }
.search-empty h2 { margin-top: 0; color: #26344a; font-size: 1.15rem; }
.search-empty p { margin-bottom: 0; }
.public-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); gap: 1rem; }
.public-document { padding: 1.25rem; border: 1px solid #dce1e8; border-radius: .65rem; background: white; }
.public-document h2 { margin: .35rem 0 .75rem; font-size: 1.2rem; }
.public-document h2 a { color: #172033; text-decoration: none; }
.public-document h2 a:hover { color: #5c1e2a; text-decoration: underline; }
.document-meta { margin: 0; color: #5c1e2a; font-size: .82rem; font-weight: 800; text-transform: uppercase; }
.document-meta a { color: inherit; }
.document-detail { max-width: 55rem; }
.document-detail > .document-meta { margin-top: 2rem; }
.document-detail .lead { color: #445064; font-size: 1.12rem; line-height: 1.7; }
.institutional-page-content { margin: 2rem 0; padding: 1.5rem; border: 1px solid #dce1e8; border-radius: .65rem; background: white; overflow-wrap: anywhere; line-height: 1.8; }
.metadata { margin: 2rem 0; padding: 1.25rem; border: 1px solid #dce1e8; border-radius: .65rem; background: white; }
.json-view { overflow-x: auto; padding: 1rem; border-radius: .5rem; color: #e8edf5; background: #172033; white-space: pre-wrap; }
.break-word { overflow-wrap: anywhere; }
.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; margin-top: 2rem; }
.section-card { display: flex; min-height: 15rem; padding: 1.35rem; flex-direction: column; border: 1px solid #dce1e8; border-radius: .7rem; background: white; }
.section-card h2 { margin: 0 0 .65rem; }
.section-card h2 a { color: #172033; text-decoration: none; }
.section-card h2 a:hover { color: #5c1e2a; text-decoration: underline; }
.section-card > a { margin-top: auto; }
.section-counts { display: flex; flex-wrap: wrap; gap: .5rem; color: #566276; font-size: .9rem; }
.section-counts span { padding: .25rem .55rem; border-radius: 999px; background: #edf2f7; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 2rem; color: #566276; font-size: .92rem; }
.public-section-heading { max-width: 55rem; }
.public-section-heading h1 { margin: .25rem 0 .75rem; font-size: clamp(2rem, 5vw, 3.5rem); }
.public-section-heading > p:not(.eyebrow) { color: #445064; font-size: 1.1rem; line-height: 1.65; }
.count-badge { display: inline-block; padding: .3rem .65rem; border-radius: 999px; color: #5c1e2a; background: #f7e7ee; font-size: .82rem; font-weight: 750; }
.public-section-block { margin-top: 2.5rem; }
.category-browser { padding: 1rem 1.25rem; border: 1px solid #dce1e8; border-radius: .7rem; background: white; }
.category-tree { margin: 0; padding-left: 1.25rem; }
.category-tree .category-tree { margin-top: .65rem; }
.category-tree li { margin: .4rem 0 .8rem; }
.category-tree li::marker { color: #b86888; }
.category-row { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.category-row > a { color: #172033; font-weight: 750; }
.category-tree p { margin: .3rem 0 .5rem; color: #566276; }
.public-footer { border-top: 4px solid #b98a32; color: #fff5f8; background: #5c1e2a; }
.public-footer-inner { display: grid; width: min(calc(100% - 2rem), 75rem); margin: 0 auto; padding: 2.5rem 0; grid-template-columns: 1.5fr 1fr 1fr; gap: 2rem; }
.public-footer h2 { margin: 0 0 .75rem; color: white; font-size: 1rem; }
.public-footer p { margin: .35rem 0; }
.public-footer a { color: #fff2c9; }
.public-footer nav { display: flex; align-items: flex-start; flex-direction: column; gap: .5rem; }
.public-footer-legal { margin: 0; padding: 1rem; border-top: 1px solid #ffffff24; text-align: center; font-size: .88rem; }
.public-site .error-page { min-height: 52vh; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
@media (max-width: 850px) {
    .public-header-inner { align-items: stretch; padding: .85rem 0; flex-direction: column; gap: .75rem; }
    .public-navigation { justify-content: flex-start; flex-wrap: wrap; }
    .public-navigation .administrative-link { margin-left: 0; }
    .hero { grid-template-columns: minmax(0, 1fr) 9rem; gap: 1.5rem; }
    .public-features > div { grid-template-columns: 1fr; }
    .public-footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .municipal-brand img { width: 44px; height: 65px; }
    .public-navigation { display: grid; grid-template-columns: 1fr 1fr; }
    .public-navigation a { display: block; padding: .75rem; text-align: center; background: #ffffff0d; }
    .hero { display: block; padding: 3.5rem 0; }
    .hero-crest { display: none; }
    .public-footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
    .metadata { grid-template-columns: 1fr; }
}
