@layer base, layout, components, responsive;

@layer base {
    :root {
        color-scheme: light;
        --surface: #fff;
        --paper: #f5f6ef;
        --tint: #edf1e7;
        --accent-soft: #e8f0df;
        --hover: #edf3e8;
        --card-hover: #fcfff7;
        --card-tint: #e4efd8;
        --white: #fff;
        --ink: #1a2c24;
        --muted: #4e6057;
        --forest: #142d24;
        --forest-dark: #10241c;
        --green: #315d40;
        --link-hover: #163521;
        --line: #d9e0d3;
        --control-line: #9aab9d;
        --lime: #d1ed8c;
        --focus: #387c41;
        --primary-bg: var(--forest);
        --primary-hover: var(--green);
        --primary-ink: var(--white);
        --danger: #8d2923;
        --radius: 13px;
        font: 100%/1.55 "Segoe UI", "Trebuchet MS", sans-serif;
    }
    :root[data-theme="dark"] {
        color-scheme: dark;
        --surface: #111e18;
        --paper: #1b2a22;
        --tint: #203228;
        --accent-soft: #263b2e;
        --hover: #2c4234;
        --card-hover: #192c22;
        --card-tint: #243a2d;
        --ink: #eef4ee;
        --muted: #bdcdc0;
        --green: #b2d6aa;
        --link-hover: #def3d7;
        --line: #354e40;
        --control-line: #789380;
        --focus: #b2d6aa;
        --primary-bg: #b2d6aa;
        --primary-hover: #cbe7bd;
        --primary-ink: #142719;
        --danger: #ffb4ab;
    }
    * { box-sizing: border-box; }
    body { margin: 0; background: var(--surface); color: var(--ink); }
    h1, h2, h3, p { margin: 0; }
    h1, h2, h3 { line-height: 1.06; letter-spacing: -.035em; }
    a { color: inherit; }
    img { display: block; max-width: 100%; height: auto; }
    button, input, select, textarea { font: inherit; }
    button { cursor: pointer; }
    [hidden] { display: none !important; }
    :focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
    .sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .skip-link:focus { position: fixed; z-index: 9; top: 8px; left: 8px; padding: .65rem 1rem; background: var(--surface); }
}
@layer layout {
    .shell { width: min(1200px, calc(100% - 96px)); margin-inline: auto; }
    .masthead { display: flex; justify-content: space-between; align-items: center; gap: clamp(.75rem, 1.6vw, 1.5rem); min-height: 87px; }
    .section { padding-block: clamp(3rem, 6vw, 5.6rem); }
    .section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; margin-bottom: 2rem; }
    .section-heading h2, .story h2, .document-banner h2, .home-location h2, .home-solution h2 { font-size: clamp(2.2rem, 4vw, 3.55rem); }
    .area-grid, .cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
    .contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: clamp(2rem, 7vw, 6rem); }
    .footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.05fr; gap: 2rem; }
}
@layer components {
    .brand { display: inline-flex; align-items: center; flex-shrink: 0; }
    .brand img { width: 144px; }
    .site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 2; }
    .brand .brand-dark, [data-theme="dark"] .brand .brand-light { display: none; }
    [data-theme="dark"] .brand .brand-dark { display: block; }
    .masthead-actions { display: flex; align-items: center; flex-shrink: 0; gap: .65rem; }
    .main-nav { display: flex; align-items: center; gap: clamp(.8rem, 1.55vw, 1.55rem); margin-inline-start: auto; }
    .main-nav > a { font-size: .94rem; font-weight: 600; text-decoration: none; }
    .main-nav > a:not(.button):hover, .main-nav > a:not(.button)[aria-current] { text-decoration: underline; text-underline-offset: 5px; }
    .social-links { display: flex; gap: .2rem; padding-inline-start: .6rem; border-inline-start: 1px solid var(--line); }
    .social-links a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--green); }
    .social-links a:hover { background: var(--hover); color: var(--link-hover); }
    .theme-toggle { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--green); }
    .theme-toggle:hover { background: var(--hover); }
    .theme-toggle[aria-pressed="false"] .theme-sun, .theme-toggle[aria-pressed="true"] .theme-moon { display: none; }
    .menu-toggle { display: none; border: 1px solid var(--line); border-radius: 7px; padding: .45rem .85rem; background: var(--surface); color: var(--ink); font-weight: 700; }
    .button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: .68rem 1.1rem; border: 1px solid transparent; border-radius: 7px; text-decoration: none; font-weight: 700; font-size: .95rem; line-height: 1.25; }
    .button-outline { border-color: var(--control-line); background: transparent; color: var(--ink); }
    .button-outline:hover { background: var(--hover); }
    .button-dark { background: var(--primary-bg); color: var(--primary-ink); }
    .button-dark:hover { background: var(--primary-hover); }
    .button-lime { background: var(--lime); color: var(--forest-dark); }
    .button-lime:hover { background: #e5f6b6; }
    .button-hero-ghost { color: #fff; border-color: #7b9688; }
    .button-hero-ghost:hover { background: #254637; }
    .text-link { color: var(--green); font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 5px; }
    .text-link:hover { color: var(--link-hover); }
    .eyebrow { color: var(--green); font-size: .82rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; margin-bottom: .75rem; }
    .eyebrow a { text-underline-offset: 4px; }

    .hero { position: relative; isolation: isolate; overflow: hidden; background: var(--forest-dark); color: white; }
    .hero-figure { position: absolute; inset: 0 0 0 41%; z-index: -2; background: url("../images/territorio.webp") 61% center / cover; mask-image: linear-gradient(90deg, transparent, black 16%); }
    .hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #142d24 0%, #142d24 38%, #142d24e8 46%, #142d2475 60%, #142d2410 86%), linear-gradient(0deg,#13291fde,transparent 29%); }
    .hero-inner { position: relative; padding-block: clamp(2.5rem, 4.5vw, 4rem); min-height: 440px; }
    .hero-copy { max-width: 660px; }
    .eyebrow-hero { display: flex; align-items: center; gap: .6rem; color: #d6eca9; margin-bottom: 1.2rem; }
    .eyebrow-hero::before { content: ""; width: 23px; height: 1px; background: currentColor; }
    .hero h1 { font-weight: 700; font-size: clamp(2.75rem, 4.85vw, 4.25rem); letter-spacing: -.065em; line-height: .99; }
    .hero h1 em { color: var(--lime); font-style: normal; }
    .hero-description { max-width: 31rem; margin-top: 1.05rem; color: #e1e8df; font-size: 1.15rem; }
    .hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.3rem; }
    .hero :focus-visible { outline-color: var(--lime); }
    .hero-caption { position: absolute; right: 0; bottom: 1.4rem; padding: .5rem .8rem; border: 1px solid #b5c7ad60; border-radius: 6px; background: #142d24df; color: #f4f9ec; font-size: .8rem; }
    .hero-caption span { display: inline-block; width: .44rem; height: .44rem; margin-right: .35rem; background: var(--lime); border-radius: 50%; }
    .areas-section, .news-section { background: var(--paper); }
    .area-card, .showcase-card { background-image: radial-gradient(ellipse at top right, var(--card-tint), transparent 62%); }
    .area-card { min-height: 173px; padding: 1.35rem; background-color: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; transition: border-color .15s; }
    .area-card:hover { border-color: #7c9d7f; background-color: var(--card-hover); }
    .area-card h3 { font-size: clamp(1.2rem, 2.1vw, 1.55rem); margin-bottom: .5rem; }
    .area-card p, .news-card-copy > p:last-child, .document-row p:not(.entry-meta) { color: var(--muted); }
    .area-mark { display: inline-grid; place-items: center; width: 52px; height: 52px; color: var(--green); background: #edf4e6; border: 1px solid #d8e5d0; border-radius: 11px; margin-bottom: .95rem; }
    .area-card:is(:hover, :focus-visible) .area-mark { background: #e0eed6; }
    [data-theme="dark"] .area-mark { background: var(--tint); border-color: var(--line); }
    [data-theme="dark"] .area-card:is(:hover, :focus-visible) .area-mark { background: var(--hover); }
    .story { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: clamp(2rem, 7vw, 6rem); }
    .story img { width: 100%; min-height: 270px; aspect-ratio: 1.52; object-fit: cover; border-radius: var(--radius); }
    .story-copy > p:not(.eyebrow), .document-banner p:not(.eyebrow) { color: var(--muted); margin: 1rem 0 1.15rem; }
    .home-solution { background: var(--forest); color: var(--white); }
    .home-solution-inner { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(1.75rem, 6vw, 5rem); padding-block: clamp(2.5rem, 5vw, 4rem); }
    .home-solution p { margin-block: 1rem; max-width: 34rem; color: #e0ebe1; }
    .home-solution .text-link { color: var(--lime); }
    .home-solution :focus-visible { outline-color: var(--lime); }
    .home-solution img { width: 100%; aspect-ratio: 2; object-fit: cover; border-radius: var(--radius); }
    .contact-card { align-self: start; min-width: 0; padding: clamp(1rem, 2.5vw, 1.5rem); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
    .contact-details { font-style: normal; overflow-wrap: anywhere; }
    .contact-details p { margin-bottom: 1rem; }
    .contact-card .contact-details { margin-top: 1rem; }
    .contact-map { position: relative; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
    .contact-map-preview { display: block; width: 100%; height: 220px; border: 0; border-radius: 8px 8px 0 0; background: var(--tint); pointer-events: none; }
    .contact-map-link { display: block; padding: .65rem .85rem; color: var(--green); font-weight: 700; text-underline-offset: 3px; border-top: 1px solid var(--line); }
    .contact-map-link::before { content: ""; position: absolute; inset: 0; border-radius: 9px; }
    .contact-map-link:focus-visible { outline: none; }
    .contact-map-link:focus-visible::before { outline: 3px solid var(--focus); outline-offset: 3px; }
    .contact-map:has(.contact-map-link:hover) { border-color: var(--focus); }
    .home-documents { padding-bottom: clamp(1.5rem, 4vw, 2.75rem); }
    .home-location { padding-top: 0; }
    .home-location-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); align-items: center; gap: clamp(1.5rem, 5vw, 4rem); padding: clamp(1.15rem, 4vw, 3rem); }
    .home-location-card .contact-map-preview { height: clamp(220px, 23vw, 300px); }
    .news-card { overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
    .news-section .cards, .listing .cards { align-items: start; }
    .news-card-link { height: 100%; display: block; text-decoration: none; }
    .news-card-link:focus-visible { outline-offset: -4px; }
    .news-card-link:hover h3 { text-decoration: underline; text-underline-offset: 4px; }
    .news-card img { width: 100%; aspect-ratio: 1.85; object-fit: cover; }
    .news-card-text { border-top: 4px solid #b6cda8; }
    .news-card-copy { padding: 1.25rem; }
    .entry-meta { color: var(--green); font-size: .84rem; font-weight: 700; margin-bottom: .6rem; }
    .news-card h3, .document-row h2 { font-size: 1.35rem; margin-bottom: .5rem; }
    .document-banner { background: var(--accent-soft); border-radius: var(--radius); padding: clamp(1.5rem, 4vw, 3.6rem); display: flex; justify-content: space-between; align-items: center; gap: 1rem 2rem; flex-wrap: wrap; }
    .document-banner p:not(.eyebrow) { margin-bottom: 0; }

    .interior { background: var(--tint); padding-block: clamp(2.75rem, 6vw, 5rem); border-bottom: 1px solid var(--line); }
    .interior h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); max-width: 900px; }
    .interior p:not(.eyebrow) { max-width: 680px; color: var(--muted); font-size: 1.15rem; margin-top: 1rem; }
    .interior .button { margin-top: 1.25rem; }
    .article { max-width: 835px; }
    .article > p:not(.entry-meta) { font-size: 1.12rem; margin-bottom: 1.25rem; }
    .service-details { margin: 2rem 0 1.75rem; }
    .service-details :is(p, ul) { margin-top: .85rem; }
    .service-details ul { padding-inline-start: 1.45rem; }
    .service-details li + li { margin-top: .55rem; }
    .service-details > .text-link { display: inline-block; margin-top: .85rem; }
    .showcase-section > h2 { font-size: clamp(1.75rem, 3vw, 2.65rem); margin-bottom: 1.5rem; }
    .showcase-card { display: grid; align-content: start; gap: .7rem; background-color: var(--paper); border: 1px solid var(--line); padding: clamp(1.1rem, 3vw, 1.65rem); border-radius: var(--radius); }
    .showcase-card h3 { font-size: clamp(1.3rem, 2vw, 1.8rem); line-height: 1.15; }
    .showcase-card p:not(.entry-meta) { color: var(--muted); }
    .showcase-card .entry-meta { margin: 0; }
    .showcase-card .text-link { justify-self: start; }
    .showcase-image { display: block; width: 100%; height: auto; aspect-ratio: 3; object-fit: cover; border: 1px solid var(--line); border-radius: calc(var(--radius) - 4px); background: white; }
    .showcase-contact { margin-top: 1.5rem; }
    .directory-links { display: flex; flex-wrap: wrap; gap: .7rem 1.6rem; margin-bottom: 1.5rem; }
    .article-image { border-radius: var(--radius); width: 100%; aspect-ratio: auto; object-fit: contain; max-height: min(65vh, 32rem); background: var(--paper); margin-bottom: 2rem; }
    .article-video { display: block; width: 100%; height: auto; border-radius: var(--radius); background: #000; margin-block: 2rem; }
    .reviewed-hero { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); align-items: center; gap: clamp(1.5rem, 4vw, 3.5rem); }
    .reviewed-hero h1 { overflow-wrap: anywhere; }
    .reviewed-cover { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--paper); }
    .reviewed-cover img { width: 100%; height: auto; display: block; aspect-ratio: 2.73; object-fit: cover; }
    .reviewed-layout { display: grid; grid-template-columns: minmax(0, 42rem) minmax(0, 17rem); justify-content: space-between; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
    .reviewed-layout, .reviewed-copy section { scroll-margin-top: 2rem; overflow-wrap: anywhere; }
    .reviewed-copy { grid-column: 1; grid-row: 1; font-size: 1.08rem; }
    .reviewed-intro { font-size: 1.16rem; color: var(--muted); }
    .reviewed-copy section { border-top: 1px solid var(--line); margin-top: 1.65rem; padding-top: 1.65rem; }
    .reviewed-copy h2, .reviewed-related h2 { font-size: clamp(1.45rem, 2.8vw, 2.1rem); }
    .reviewed-copy :is(p, ul) + :is(p, ul), .reviewed-copy h2 + :is(p, ul) { margin-top: .7rem; }
    .reviewed-copy ul { padding-inline-start: 1.35rem; }
    .reviewed-copy li + li { margin-top: .4rem; }
    .reviewed-nav, .reviewed-related { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem; }
    .reviewed-nav { position: sticky; top: 1rem; grid-column: 2; grid-row: 1; }
    .reviewed-nav h2 { font-size: 1.12rem; }
    .reviewed-nav ul { list-style: none; margin: .55rem 0 0; padding: 0; }
    .reviewed-nav a { display: block; padding: .35rem .15rem; color: var(--green); text-underline-offset: 3px; }
    .reviewed-related { margin-block: 1.8rem; }
    .reviewed-related .directory-links { margin: .8rem 0 0; }
    .convenios-hero, .convenios-overview, .convenios-stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr); gap: clamp(1.65rem, 5vw, 4.5rem); align-items: center; }
    .convenios-hero { background-image: radial-gradient(ellipse at 80% 48%, var(--card-tint), transparent 73%); }
    .convenios-flow, .convenios-screen { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
    .convenios-flow img, .convenios-screen img { display: block; width: 100%; height: auto; background: white; }
    .convenios-flow img { padding: clamp(.7rem, 2vw, 1.35rem); }
    .convenios-flow figcaption, .convenios-screen figcaption { padding: .8rem 1rem; color: var(--muted); font-size: .94rem; }
    .convenios-content > section[id] { scroll-margin-top: 6rem; }
    .convenios-content h2 { font-size: clamp(1.85rem, 3.4vw, 2.9rem); }
    .convenios-overview { align-items: start; padding-bottom: clamp(2rem, 5vw, 4rem); }
    .convenios-content h2 + p, .convenios-overview p + p, .convenios-stage p + p, .convenios-stage ul + p, .convenios-management figcaption p { margin-top: .75rem; }
    .convenios-jumps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: .65rem; padding: 0; margin: 0; list-style: none; }
    .convenios-jumps a { display: block; height: 100%; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); text-decoration: none; }
    .convenios-jumps a:hover { background: var(--hover); }
    .convenios-jumps span { display: block; color: var(--muted); font-size: .9rem; }
    .convenios-stage, .convenios-management { border-top: 1px solid var(--line); padding-block: clamp(2rem, 5vw, 4rem); }
    .convenios-stage ul { margin: 1rem 0 0; padding-inline-start: 1.25rem; }
    .convenios-stage li + li { margin-top: .45rem; }
    .convenios-mobile { padding: clamp(1.15rem, 4vw, 2.75rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--tint); }
    .convenios-mobile .convenios-screen img { padding: clamp(.3rem, 1vw, .75rem); }
    .convenios-screen a { display: block; }
    .convenios-screen a:focus-visible { outline-offset: -4px; }
    .convenios-management-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.15rem; }
    .convenios-management img { aspect-ratio: 16 / 9; object-fit: cover; object-position: top; }
    .convenios-management h3 { color: var(--ink); }
    .convenios-resources { border-top: 1px solid var(--line); padding-block: clamp(1.75rem, 4vw, 3rem); }
    .convenios-resources ul { padding-inline-start: 1.25rem; margin-block: .8rem 0; }
    .convenios-resources li + li { margin-top: .45rem; }
    .convenios-contact { margin-top: 1rem; }
    .article-gallery { margin: 2rem 0; }
    .article-gallery-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 1rem; }
    .article-gallery-grid a { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
    .article-gallery-grid img { width: 100%; aspect-ratio: 1.4; object-fit: contain; }
    .document-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; overflow-wrap: anywhere; }
    .document-row .button { flex-shrink: 0; }
    .document-list, .admin-list { display: grid; gap: .8rem; }
    .search-form { display: flex; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
    .list-total { color: var(--muted); margin-bottom: 1rem; font-size: .92rem; }
    .search-form > label:first-of-type { flex: 1 1 240px; max-width: 450px; }
    .search-form > .text-link { align-self: center; }
    label { display: grid; gap: .38rem; font-size: .95rem; font-weight: 650; }
    input:not([type="hidden"]), select, textarea { width: 100%; border: 1px solid var(--control-line); background: var(--surface); border-radius: 6px; min-height: 46px; padding: .62rem .75rem; color: var(--ink); font-size: 1rem; }
    textarea { resize: vertical; }
    .form-box { background: var(--paper); padding: clamp(1rem, 3vw, 1.65rem); border: 1px solid var(--line); border-radius: var(--radius); }
    .form-box h2 { margin-bottom: 1rem; }
    .stack-form { display: grid; gap: 1rem; }
    .stack-form > .button { justify-self: start; }
    .form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
    .form-actions, .pagination, .admin-bar, .tabs { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem 1rem; }
    .admin-content-actions { margin-bottom: 1rem; }
    .editorial-history { margin-top: 1rem; }
    .editorial-history > summary { cursor: pointer; font-weight: 650; }
    .gallery-editor-row { display: grid; min-width: 0; gap: .75rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
    .gallery-editor-row legend { font-weight: 650; padding-inline: .4rem; overflow-wrap: anywhere; }
    .gallery-editor-row img { object-fit: contain; background: var(--paper); }
    .gallery-editor-row .check-inline { display: flex; align-items: center; width: fit-content; }
    .gallery-editor-row input[type="checkbox"] { width: auto; }
    .accounts-list { margin-top: 2rem; }
    .accounts-list h3 { margin-bottom: .25rem; }
    .recovery-code { font-family: monospace; }
    .pagination { justify-content: center; margin-top: 1.5rem; }
    .notice { padding: .75rem 1rem; color: #235534; background: #e7f5e9; border: 1px solid #b8d5bd; border-radius: 6px; margin-bottom: 1rem; }
    .notice.error { color: #8d2923; background: #fff0ee; border-color: #edc0bb; }
    [data-theme="dark"] .notice { color: var(--green); background: var(--accent-soft); border-color: var(--control-line); }
    [data-theme="dark"] .notice.error { color: var(--danger); background: #421f21; border-color: #895354; }
    .login-form { max-width: 440px; }
    .edit-form { max-width: 820px; }
    .edit-context { margin-bottom: 1rem; }
    .edit-context .entry-meta { margin: 0; }
    .edit-form h2 { margin: 0; font-size: 1.35rem; }
    .editor-gallery { justify-self: start; }
    .editor-actions { position: sticky; bottom: 0; z-index: 1; padding: .65rem .85rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
    html:has(.edit-form) { scroll-padding-bottom: 5.25rem; }
    .editor-image { width: 240px; height: 160px; object-fit: contain; background: var(--surface); border-radius: 6px; }
    .image-upload { max-width: 650px; margin-bottom: 1.5rem; }
    .image-upload > summary { width: fit-content; cursor: pointer; font-weight: 700; padding: .65rem 1rem; border-radius: 7px; background: var(--primary-bg); color: var(--primary-ink); }
    .image-upload > summary:hover { background: var(--primary-hover); }
    .image-upload .form-box { margin-top: .75rem; }
    .image-library { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 1rem; }
    .library-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
    .library-card > img { width: 100%; aspect-ratio: 1.65; object-fit: contain; background: var(--paper); }
    .library-card-body { padding: 1rem; overflow-wrap: anywhere; }
    .library-card h2 { font-size: 1.2rem; margin-bottom: .5rem; }
    .library-card summary { cursor: pointer; color: var(--green); }
    .library-card details form { margin-top: .65rem; }
    .preview-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding-block: 1rem; }
    .admin-masthead { min-height: 66px; }
    .admin-masthead .brand img { width: 115px; }
    .admin-section { padding-block: 1.25rem 4rem; }
    .admin-title { margin-block: .5rem 1.5rem; font-size: clamp(1.9rem, 4vw, 2.75rem); }
    .admin-bar { justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1.75rem; padding: .45rem .7rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
    .admin-bar nav, .admin-account { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .5rem; }
    .admin-bar nav a, .tabs a { display: block; padding: .6rem .75rem; border-radius: 7px; font-size: .94rem; font-weight: 700; text-decoration: none; }
    .admin-bar nav a:hover, .tabs a:hover { background: var(--hover); }
    .admin-bar nav [aria-current] { background: var(--primary-bg); color: var(--primary-ink); }
    .admin-bar nav [aria-current]:hover { background: var(--primary-hover); }
    .admin-account { gap: 1rem; font-size: .92rem; font-weight: 650; }
    .admin-account small { display: block; }
    .admin-account .button { min-height: 40px; padding: .45rem .75rem; }
    .tabs { gap: .35rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--line); padding-bottom: .6rem; }
    .tabs [aria-current] { color: var(--green); background: var(--accent-soft); }
    .admin-filters { margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
    .admin-list { display: grid; gap: .6rem; margin-top: 1rem; }
    .admin-list .document-row { padding: .85rem 1rem; }
    .admin-list .document-row h2 { margin-bottom: 0; font-size: 1.18rem; line-height: 1.25; }
    .admin-entry-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .7rem; margin-bottom: .35rem; font-size: .82rem; }
    .state-pill { padding: .12rem .55rem; border-radius: 99px; background: #eaf0ed; color: #34483d; font-weight: 700; }
    .state-published { background: #e4f3df; color: #254d2d; }
    .state-review { background: #f9efd1; color: #624b11; }
    .state-archived { background: #ece8f1; color: #4e3863; }
    [data-theme="dark"] .state-draft { background: #34483d; color: #eaf0ed; }
    [data-theme="dark"] .state-published { background: #254d2d; color: #e4f3df; }
    [data-theme="dark"] .state-review { background: #554012; color: #f9efd1; }
    [data-theme="dark"] .state-archived { background: #4e3863; color: #ece8f1; }
    .row-actions, .order-actions { flex-shrink: 0; }
    .danger-link { padding: .55rem .25rem; color: var(--danger); font-weight: 700; text-underline-offset: 4px; }
    .button-danger { background: #8d2923; color: white; }
    .button-danger:hover { background: #6b1d18; }
    .confirm-box { max-width: 690px; }
    .confirm-box .form-actions { margin-top: 1.25rem; }
    .admin-intro { margin-top: .75rem; color: var(--muted); }
    .admin-intro + .notice, .home-area-form { margin-top: 1rem; }
    .home-area-form { max-width: 820px; }
    .home-area-slots select { min-width: 0; }
    .order-list { list-style: none; padding: 0; }
    .audit-list { list-style: none; padding: 0; }
    .backup-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 275px), 1fr)); gap: 1rem; }
    .backup-options h2, .backup-restore h2 { margin: 0; }
    .backup-restore { margin-top: 1.25rem; }
    .backup-checkbox { display: flex; align-items: center; gap: .7rem; }
    .backup-checkbox input { width: auto; min-height: auto; }
    .order-list li:target { border-color: var(--green); background: var(--hover); scroll-margin-block: 1rem; }
    .order-entry { display: flex; align-items: center; gap: .85rem; }
    .order-position { flex-shrink: 0; display: grid; place-items: center; min-width: 2.3rem; padding: .28rem; border-radius: 6px; background: var(--paper); color: var(--green); font-weight: 750; }
    .order-button { gap: .35rem; padding-inline: .7rem; }
    .order-button:disabled { opacity: .45; cursor: default; background: transparent; }
    .message { margin-bottom: 1rem; overflow-wrap: anywhere; }
    .message p { margin-bottom: .6rem; }
    small { color: var(--muted); font-weight: 400; }

    .site-footer { background: var(--forest-dark); color: #edf5e8; padding-block: 3rem 1.2rem; }
    .footer-brand { margin-bottom: .55rem; }
    .footer-brand img { width: 108px; }
    .footer-grid > div { display: grid; align-content: start; justify-items: start; gap: .45rem; overflow-wrap: anywhere; }
    .footer-grid h2 { margin: .4rem 0; font-size: 1.03rem; letter-spacing: 0; }
    .footer-grid a:not(.brand), .footer-grid p { font-size: .92rem; color: #d4e2d5; }
    .footer-grid a { text-underline-offset: 3px; }
    .footer-base { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #476251; color: #c2d0c1; font-size: .85rem; }
    .site-footer :focus-visible { outline-color: var(--lime); }
}
@layer responsive {
    @media (max-width: 950px) {
        .shell { width: calc(100% - 56px); }
        .masthead { gap: 1rem; }
        .main-nav { gap: 1rem; }
        .brand img { width: 127px; }
        .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }
    @media (max-width: 1120px) {
        .masthead { min-height: 70px; flex-wrap: wrap; }
        .menu-toggle { display: inline-block; }
        .main-nav { flex-basis: 100%; flex-wrap: wrap; align-items: flex-start; gap: .9rem 1.2rem; padding-bottom: 1rem; }
        .has-menu-toggle { display: none; }
        .has-menu-toggle.is-open { display: flex; flex-direction: column; }
        .social-links { padding: .5rem 0 0; border-inline-start: 0; border-top: 1px solid var(--line); }
    }
    @media (max-width: 760px) {
        .shell { width: calc(100% - 36px); }
        .hero-inner { min-height: 0; padding-block: 2.25rem 3.8rem; }
        .hero-figure { inset: 0 0 0 18%; background-position: 64% center; }
        .hero::after { background: linear-gradient(90deg,#142d24 0%,#142d24ee 40%,#142d249e 100%); }
        .hero-description { font-size: 1.04rem; line-height: 1.45; }
        .hero-actions { gap: .6rem; margin-top: 1.1rem; }
        .hero-caption { bottom: .85rem; }
        .area-grid, .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .story, .contact-grid, .home-solution-inner, .home-location-card { grid-template-columns: 1fr; }
        .convenios-hero, .convenios-overview, .convenios-stage, .convenios-management-grid { grid-template-columns: minmax(0, 1fr); }
        .reviewed-hero, .reviewed-layout { grid-template-columns: minmax(0, 1fr); }
        .reviewed-nav { position: static; grid-column: 1; }
        .reviewed-copy { grid-row: 2; }
        .story img { min-height: 0; }
    }
    @media (max-width: 460px) {
        .hero h1 { font-size: clamp(2.1rem, 10.25vw, 3.1rem); }
        .reviewed-hero h1 { font-size: clamp(1.9rem, 9.25vw, 2.5rem); }
        .section-heading { align-items: start; flex-direction: column; gap: .75rem; }
        .area-grid, .cards, .form-row { grid-template-columns: 1fr; }
        .area-card { min-height: auto; }
        .document-row { flex-direction: column; align-items: flex-start; }
        .admin-bar { align-items: start; flex-direction: column; }
        .admin-bar nav a, .tabs a { padding-inline: .5rem; }
        .admin-account { width: 100%; justify-content: space-between; padding: .3rem .5rem; border-top: 1px solid var(--line); }
        .footer-grid { gap: 1.3rem 1rem; }
    }
    @media (prefers-reduced-motion: reduce) {
        *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
    }
}
