:root {
    --bg: #f6f4ef;
    --panel: #ffffff;
    --panel-soft: #f2f8f6;
    --text: #1f2933;
    --muted: #52606d;
    --line: #d8e1e8;
    --brand: #0f766e;
    --brand-strong: #0b5b56;
    --accent: #f97316;
    --danger: #b42318;
    --success: #166534;
    --shadow: 0 18px 40px rgba(15, 118, 110, 0.12);
    --radius-lg: 18px;
    --radius-sm: 10px;
    --brand-logo-height: 44px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 10%, rgba(249, 115, 22, 0.16), transparent 45%),
        radial-gradient(circle at 85% 18%, rgba(15, 118, 110, 0.15), transparent 42%),
        linear-gradient(180deg, #f9f7f2 0%, var(--bg) 50%, #edf6f2 100%);
    font-family: "IBM Plex Sans", "Source Sans 3", "Nunito Sans", sans-serif;
    line-height: 1.55;
    min-height: 100vh;
}

a {
    color: var(--brand-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.shell {
    width: min(1120px, 94vw);
    margin: 32px auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.logo {
    font-weight: 800;
    letter-spacing: 0.03em;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    display: inline-flex;
    align-items: center;
    min-height: var(--brand-logo-height);
}

.brand-logo-img {
    display: block;
    height: var(--brand-logo-height);
    width: auto;
    max-width: 420px;
    object-fit: contain;
}

.badge {
    background: rgba(15, 118, 110, 0.12);
    color: var(--brand-strong);
    border: 1px solid rgba(15, 118, 110, 0.25);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.user-menu {
    position: relative;
}

.user-menu > summary {
    list-style: none;
    cursor: pointer;
}

.user-menu > summary::-webkit-details-marker {
    display: none;
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(240px, 84vw);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 10px;
    z-index: 20;
}

.user-menu-link {
    display: block;
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--text);
    font-weight: 700;
}

.user-menu-link:hover {
    background: #f2f8f6;
    text-decoration: none;
}

.menu-divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 8px 0;
}

.grid {
    display: grid;
    gap: 16px;
}

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

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: clamp(18px, 2.8vw, 28px);
    box-shadow: var(--shadow);
}

.card.soft {
    background: var(--panel-soft);
}

h1,
h2,
h3 {
    margin: 0 0 10px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(1.8rem, 4vw, 2.7rem);
}

h2 {
    font-size: clamp(1.2rem, 2.8vw, 1.55rem);
}

p {
    margin: 0 0 10px;
    color: var(--muted);
}

.kpi {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 6px 10px 6px 0;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 700;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, filter 120ms ease;
}

.btn:hover {
    text-decoration: none;
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.btn.secondary {
    background: #fff;
    color: var(--brand-strong);
    border-color: var(--line);
}

.btn.warn {
    background: var(--accent);
}

.notice {
    margin: 8px 0 14px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.notice.ok {
    background: rgba(22, 101, 52, 0.1);
    border-color: rgba(22, 101, 52, 0.24);
    color: var(--success);
}

.notice.error {
    background: rgba(180, 35, 24, 0.1);
    border-color: rgba(180, 35, 24, 0.24);
    color: var(--danger);
}

.inline-form {
    display: inline;
}

label {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--text);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #b8c7d4;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font: inherit;
    background: #fff;
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(15, 118, 110, 0.35);
    outline-offset: 0;
    border-color: var(--brand);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

.footer-note {
    margin-top: 18px;
    font-size: 0.85rem;
}

.list-clean {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.property-meta {
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.property-meta-item {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: baseline;
}

.property-meta-item .key {
    font-weight: 800;
    color: var(--text);
}

.property-meta-item .val {
    color: var(--muted);
}

.map-link {
    font-weight: 700;
}

.blog-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.blog-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: 14px;
}

.blog-meta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.blog-date {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--brand-strong);
    margin-bottom: 8px;
}

.blog-cover {
    width: 100%;
    height: clamp(130px, 15vw, 180px);
    max-height: 180px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    display: block;
}

.blog-cover.large {
    height: min(360px, 42vw);
}

/* Detalle de noticia: priorizar ajuste proporcional sobre recorte agresivo. */
.news-article .blog-cover.large {
    height: auto;
    max-height: min(460px, 58vh);
    object-fit: contain;
    object-position: center;
    background: #f7fafb;
}

.news-article .rich-content img {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
    margin: 12px auto;
    object-fit: contain;
}

.blog-title {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.blog-summary {
    margin: 0 0 8px;
}

.blog-author {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 700;
}

.thumb-sm {
    width: 56px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
}

.table th,
.table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    font-size: 0.92rem;
}

.table th {
    color: var(--text);
    font-weight: 800;
}

.table-wrap {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: auto;
    background: #fff;
}

.table-wrap.excel-scroll {
    max-height: 520px;
    overflow: auto;
}

.table-wrap.excel-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.table-wrap.excel-scroll::-webkit-scrollbar-thumb {
    background: #c5d2dc;
    border-radius: 999px;
}

.table-wrap.excel-scroll::-webkit-scrollbar-track {
    background: #eef3f7;
}

.table.modern {
    margin-top: 0;
    min-width: 760px;
}

.table.modern th {
    background: #f4f9f7;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table.modern tr:nth-child(even) td {
    background: #fbfdfc;
}

.table.modern tr:hover td {
    background: #eef7f4;
}

.table.excel {
    border: 1px solid #c9d7e2;
    border-collapse: collapse;
}

.table.excel th,
.table.excel td {
    border: 1px solid #d2dde6;
}

.table.excel th {
    background: #edf3f7;
}

.table.excel.grid {
    min-width: 980px;
    table-layout: fixed;
}

.table.excel.grid th,
.table.excel.grid td {
    vertical-align: middle;
    word-break: break-word;
}

.table.list-grid {
    --col-id-width: auto;
    --col-main-width: auto;
    --col-contact-width: auto;
    --col-address-width: auto;
    --col-owner-width: auto;
    --col-amount-width: auto;
    --col-status-width: auto;
    --col-actions-width: auto;
    --col-category-width: auto;
    --col-slug-width: auto;
    --col-media-width: auto;
    --row-font-size: 0.93rem;
    font-size: var(--row-font-size);
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.table.list-grid.owners-grid {
    --col-id-width: 90px;
    --col-main-width: 260px;
    --col-contact-width: 280px;
    --col-status-width: 120px;
    --col-actions-width: 210px;
}

.table.list-grid.properties-grid {
    --col-id-width: 90px;
    --col-main-width: 260px;
    --col-address-width: 320px;
    --col-owner-width: 210px;
    --col-status-width: 120px;
    --col-actions-width: 210px;
}

.table.list-grid.invoices-grid {
    --col-main-width: 240px;
    --col-owner-width: 260px;
    --col-amount-width: 180px;
    --col-status-width: 120px;
    --col-actions-width: 210px;
}

.table.list-grid.news-grid {
    --col-category-width: 150px;
    --col-main-width: 300px;
    --col-slug-width: 220px;
    --col-media-width: 120px;
    --col-owner-width: 210px;
    --col-status-width: 120px;
    --col-actions-width: 210px;
}

.table.list-grid.owner-invoices-grid {
    --col-main-width: 220px;
    --col-owner-width: 240px;
    --col-amount-width: 150px;
    --col-status-width: 120px;
    --col-actions-width: 110px;
}

.table.list-grid th.col-id,
.table.list-grid td.col-id,
.table.list-grid td.table-id {
    width: var(--col-id-width);
}

.table.list-grid th.col-status,
.table.list-grid td.col-status {
    width: var(--col-status-width);
}

.table.list-grid th.col-actions,
.table.list-grid td.col-actions {
    width: var(--col-actions-width);
}

.table.list-grid th.col-owner,
.table.list-grid td.col-owner {
    width: var(--col-owner-width);
}

.table.list-grid th.col-amount,
.table.list-grid td.col-amount {
    width: var(--col-amount-width);
}

.table.list-grid th.col-category,
.table.list-grid td.col-category {
    width: var(--col-category-width);
}

.table.list-grid th.col-slug,
.table.list-grid td.col-slug {
    width: var(--col-slug-width);
}

.table.list-grid th.col-media,
.table.list-grid td.col-media {
    width: var(--col-media-width);
}

.table.list-grid th.col-main,
.table.list-grid td.col-main {
    min-width: var(--col-main-width);
}

.table.list-grid th.col-contact,
.table.list-grid td.col-contact {
    min-width: var(--col-contact-width);
}

.table.list-grid th.col-address,
.table.list-grid td.col-address {
    min-width: var(--col-address-width);
}

.table.list-grid.owner-invoices-grid th.col-date,
.table.list-grid.owner-invoices-grid td.col-date {
    width: 130px;
    white-space: nowrap;
}

.table.list-grid th {
    white-space: nowrap;
    padding: 11px 12px;
    border-bottom: 1px solid #bfd0dc;
    background: linear-gradient(180deg, #f7fbfd 0%, #ecf3f8 100%);
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 800;
    color: #0f2a43;
    text-decoration: none;
}

.sort-link:hover {
    color: var(--brand-strong);
    text-decoration: none;
}

.table.list-grid td {
    padding: 12px;
    border-bottom: 1px solid #d7e2ea;
    vertical-align: top;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}

.table.list-grid td + td,
.table.list-grid th + th {
    border-left: 1px solid #dce6ee;
}

.table.list-grid .col-id,
.table.list-grid .col-status,
.table.list-grid .col-actions,
.table.list-grid .col-media,
.table.list-grid .col-category {
    white-space: nowrap;
}

.table.list-grid td.col-actions {
    white-space: nowrap;
}

.table.list-grid.owner-invoices-grid th.col-money,
.table.list-grid.owner-invoices-grid td.col-money {
    text-align: right;
}

.table.list-grid.owner-invoices-grid td.col-actions,
.table.list-grid.owner-invoices-grid th.col-actions {
    text-align: center;
}

.table-id {
    font-family: "IBM Plex Mono", "Fira Code", "Source Code Pro", monospace;
    font-size: 0.84rem;
    color: var(--muted);
}

.table-main {
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}

.table-sub {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 4px;
    line-height: 1.35;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 800;
    border: 1px solid transparent;
}

.status-pill.ok {
    background: rgba(22, 101, 52, 0.12);
    border-color: rgba(22, 101, 52, 0.28);
    color: #14532d;
}

.status-pill.off {
    background: rgba(180, 35, 24, 0.08);
    border-color: rgba(180, 35, 24, 0.2);
    color: #8f2318;
}

.status-pill.warn {
    background: rgba(249, 115, 22, 0.12);
    border-color: rgba(249, 115, 22, 0.3);
    color: #9a3412;
}

.status-pill.info {
    background: rgba(15, 118, 110, 0.1);
    border-color: rgba(15, 118, 110, 0.28);
    color: #115e59;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.btn.mini {
    padding: 7px 10px;
    font-size: 0.78rem;
    font-weight: 700;
}

.filters-bar {
    margin-top: 12px;
    margin-bottom: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fbfa;
}

.list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.pager {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.empty-state {
    margin-top: 14px;
    border: 1px dashed #b8c7d4;
    border-radius: 12px;
    padding: 18px;
    background: #f9fbfc;
    color: var(--muted);
    font-size: 0.92rem;
}

.text-ok {
    color: var(--success);
    font-weight: 700;
}

.text-error {
    color: var(--danger);
    font-weight: 700;
}

.rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--line);
}

.rich-content a {
    font-weight: 700;
}

/* Ajustes específicos QA responsive del panel owner. */
.owner-dashboard .card {
    padding: clamp(16px, 2.4vw, 24px);
}

/* Ajustes visuales del módulo de seguridad de login (admin). */
.security-dashboard .card.soft h3 {
    margin-bottom: 8px;
}

.security-dashboard .card.soft .actions {
    margin-top: 10px;
}

.security-dashboard .table-wrap {
    margin-top: 10px;
}

.owner-dashboard h1 {
    letter-spacing: -0.022em;
}

.owner-dashboard h2 {
    letter-spacing: -0.015em;
}

.owner-dashboard .kpi {
    font-size: 0.84rem;
}

@media (max-width: 860px) {
    .grid.cols-2 {
        grid-template-columns: 1fr;
    }

    .shell {
        width: min(1120px, 95vw);
        margin: 18px auto 26px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .blog-grid {
        grid-template-columns: 1fr;
    }

    .blog-cover.large {
        height: 220px;
    }

    .news-article .blog-cover.large {
        max-height: 320px;
    }

    .pager {
        width: 100%;
        margin-left: 0;
    }

    .table-wrap.excel-scroll {
        max-height: 440px;
    }

    .table.modern.excel.grid.list-grid {
        min-width: 920px;
    }
}

@media (max-width: 1024px) {
    .owner-dashboard {
        width: min(1120px, 95vw);
    }

    .owner-dashboard .table.list-grid.owner-invoices-grid {
        --col-main-width: 210px;
        --col-owner-width: 220px;
        --col-amount-width: 140px;
    }
}

@media (max-width: 768px) {
    .owner-dashboard .filters-bar .grid.cols-2 {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .security-dashboard .kpi {
        width: 100%;
        justify-content: space-between;
        margin-right: 0;
    }

    .owner-dashboard .table.list-grid.owner-invoices-grid {
        min-width: 840px;
    }

    .owner-dashboard .table.modern {
        min-width: 720px;
    }
}

@media (max-width: 480px) {
    :root {
        --brand-logo-height: 40px;
    }

    .owner-dashboard {
        width: 96vw;
        margin: 14px auto 22px;
    }

    .security-dashboard .actions .btn {
        width: 100%;
    }

    .owner-dashboard h1 {
        font-size: clamp(1.45rem, 8.3vw, 1.95rem);
    }

    .owner-dashboard h2 {
        font-size: clamp(1.08rem, 6.2vw, 1.32rem);
    }

    .owner-dashboard .kpi {
        display: flex;
        width: 100%;
        justify-content: space-between;
        margin-right: 0;
        margin-bottom: 8px;
    }

    .owner-dashboard .actions {
        gap: 8px;
    }

    .owner-dashboard .actions .btn {
        width: 100%;
    }

    .owner-dashboard .badge {
        font-size: 0.76rem;
    }
}
