:root {
    --bg: #eef1f5;
    --panel: rgba(255, 255, 255, 0.95);
    --text: #0f172a;
    --muted: #5b6475;
    --accent: #0f766e;
    --accent-2: #2563eb;
    --border: rgba(15, 23, 42, 0.1);
    --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text);
    background: linear-gradient(180deg, #f5f7fa 0%, var(--bg) 100%);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 3px 0 8px;
    flex: 1;
}

.shell-admin {
    width: 100%;
    max-width: none;
}

.shell-login {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px 0 8px;
}

.shell-login .site-footer {
    margin-top: 0;
    padding-top: 24px;
}

.topbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.admin-topline,
.split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 800;
}

.brand-logo {
    width: 68px;
    height: 68px;
    object-fit: contain;
    flex: 0 0 68px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-title {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.1;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.1;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    justify-content: flex-end;
}

.admin-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.admin-nav {
    justify-content: flex-start;
    width: auto;
}

.nav a,
.button {
    padding: 10px 14px;
    border-radius: 14px 14px 0 0;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.86);
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.nav a:hover,
.button:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.3);
}

.nav a.active-nav {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.button {
    cursor: pointer;
    font: inherit;
}

.button.primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.button.danger {
    color: #b91c1c;
    border-color: rgba(220, 38, 38, 0.22);
    background: rgba(220, 38, 38, 0.08);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.hero,
.cards,
.panel,
.card {
    animation: rise 0.45s ease both;
}

.page-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0;
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    line-height: 1.15;
}

.page-heading-icon {
    font-size: 1.05em;
    line-height: 1;
}

.hero-home {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 34px;
    text-align: center;
}

.home-message {
    display: grid;
    gap: 14px;
    font-size: clamp(0.95rem, 1.6vw, 1.12rem);
    line-height: 1.65;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

.home-message p {
    margin: 0;
}

.home-actions {
    margin-top: 28px;
    justify-content: flex-start;
}

.panel,
.card,
.hero-copy,
.hero-panel,
.stat-grid div,
.status-card,
.chart-card,
.indicator-card,
.indicator-hero-copy,
.indicator-metric-card,
.pdf-viewer-panel,
.chat-item,
.success-box {
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    background: var(--panel);
}

.panel,
.card {
    padding: 24px;
}

.panel {
    margin-top: 20px;
}

.shell > .panel:first-of-type,
.shell > .form-panel:first-of-type {
    margin-top: 3px;
}

.nested {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.96);
}

.login-shell {
    width: 100%;
    padding: 12px 0 20px;
}

.login-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 440px);
    gap: 28px;
    align-items: stretch;
}

.login-hero-copy {
    position: relative;
    overflow: hidden;
    padding: 44px;
    border: 1px solid rgba(15, 118, 110, 0.14);
    border-radius: 30px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.14), transparent 36%),
        radial-gradient(circle at bottom left, rgba(15, 118, 110, 0.16), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
    box-shadow: var(--shadow);
}

.login-hero-copy::after {
    content: "";
    position: absolute;
    inset: auto -80px -120px auto;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.18) 0%, rgba(37, 99, 235, 0.03) 60%, transparent 70%);
    pointer-events: none;
}

.login-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 26px;
    padding: 16px 18px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.login-brand-logo--hero {
    width: 126px;
    height: 126px;
}

.login-kicker {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-title {
    margin: 14px 0 12px;
    font-size: clamp(2rem, 4vw, 3.7rem);
    line-height: 1.03;
    max-width: 12ch;
}

.login-summary {
    max-width: 54ch;
    margin: 0;
    color: var(--muted);
    font-size: 1.03rem;
    line-height: 1.7;
}

.login-highlights {
    display: grid;
    gap: 12px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}

.login-highlights li {
    position: relative;
    padding: 14px 16px 14px 46px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.04);
}

.login-highlights li::before {
    content: "•";
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-2);
    font-size: 1.8rem;
    line-height: 1;
}

.login-panel {
    display: flex;
    align-items: center;
}

.login-card {
    width: 100%;
}

.login-card--raised {
    position: relative;
    overflow: hidden;
    padding: 34px;
    border-radius: 30px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.94));
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.login-brand-logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
}

.login-brand-logo--panel {
    width: 82px;
    height: 82px;
    flex: 0 0 82px;
}

.login-panel-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.login-panel-head h2 {
    margin: 0;
    font-size: 1.45rem;
}

.login-panel-head p {
    margin: 4px 0 0;
}

.login-form {
    display: grid;
    gap: 16px;
    margin-top: 10px;
}

.login-form label,
.grid-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 600;
}

.login-actions {
    justify-content: stretch;
    margin-top: 4px;
}

.login-button {
    width: 100%;
    justify-content: center;
}

.admin-placeholder {
    margin-top: 18px;
}

.export-row {
    display: flex;
    justify-content: flex-end;
    margin: 6px 0 12px;
}

.export-button,
.table-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 14px;
    white-space: nowrap;
}

.admin-cards,
.cards {
    display: grid;
    gap: 16px;
}

.admin-cards {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 0 0 18px;
}

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

.status-card {
    padding: 16px 18px;
}

.status-card span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    text-align: right;
}

.status-card strong {
    display: block;
    margin-left: auto;
    font-size: 1.8rem;
    line-height: 1;
    text-align: right;
}

.hero {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: 20px;
    margin-bottom: 20px;
}

.hero-copy,
.hero-panel {
    padding: 30px;
}

.hero-copy h1 {
    margin: 16px 0;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.02;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: var(--accent);
    font-size: 0.86rem;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.grid-form.compact {
    grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-top: 18px;
}

.grid-form .full {
    grid-column: 1 / -1;
}

.grid-form.compact label {
    margin: 0;
}

.grid-form.compact .button.primary {
    height: 48px;
    white-space: nowrap;
}

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

textarea {
    resize: vertical;
}

.checkbox {
    flex-direction: row !important;
    align-items: center;
    font-weight: 500 !important;
}

.checkbox input {
    width: auto;
}

.split {
    align-items: flex-start;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    text-align: left;
}

.table-wrap thead {
    background: #eef2f7;
}

.table-wrap thead th {
    color: var(--accent);
    font-size: 0.92rem;
    font-weight: 700;
    background: #eef2f7;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.stat-grid div {
    padding: 16px;
    border-radius: 18px;
}

.stat-grid strong {
    display: block;
    font-size: 1.6rem;
}

.muted,
.stat-grid span,
.indicator-summary,
.indicator-text,
.indicator-list-row span,
.chart-kind,
.site-footer {
    color: var(--muted);
}

.chat-list,
.indicator-list,
.indicator-tree,
.stack-form,
.chat-list,
.indicators-workspace,
.indicator-stage {
    display: grid;
    gap: 12px;
}

.chat-item {
    padding: 14px 16px;
}

.chat-item header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 8px;
}

.chat-admin {
    border-left: 4px solid var(--accent);
}

.chat-denunciante {
    border-left: 4px solid var(--accent-2);
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
}

.flash-success {
    background: rgba(15, 118, 110, 0.1);
    border: 1px solid rgba(15, 118, 110, 0.2);
}

.flash-error {
    background: rgba(220, 38, 38, 0.09);
    border: 1px solid rgba(220, 38, 38, 0.18);
    color: #b91c1c;
}

.success-box {
    padding: 18px;
    margin-bottom: 18px;
    background: rgba(15, 118, 110, 0.08);
    border: 1px solid rgba(15, 118, 110, 0.15);
}

.receipt-box code {
    padding: 0;
    border-radius: 0;
    background: transparent;
    font: inherit;
    font-weight: 700;
}

.receipt-actions {
    margin-top: 18px;
}

.track-result-actions {
    justify-content: flex-end;
    margin-top: 0;
    margin-bottom: 18px;
}

.track-result-grid {
    display: grid;
    grid-template-columns: minmax(0, 7.5fr) minmax(280px, 3.5fr);
    gap: 28px;
    align-items: start;
}

code {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
}

.denuncia-layout {
    display: grid;
    grid-template-areas: "main stepper";
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 16px;
    align-items: start;
    margin-top: 18px;
}

.denuncia-main {
    grid-area: main;
    min-width: 0;
}

.denuncia-main > .panel.nested {
    margin-top: 0;
}

.stepper-panel {
    grid-area: stepper;
    width: 100%;
    position: sticky;
    top: 0;
    padding: 18px 16px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
}

.stepper-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
}

.stepper-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
}

.stepper-bubble {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid rgba(15, 23, 42, 0.12);
    background: #fff;
    font-weight: 700;
}

.stepper-item.is-active {
    color: var(--text);
    font-weight: 700;
}

.stepper-item.is-active .stepper-bubble {
    color: #fff;
    border-color: var(--accent-2);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.22);
}

.stepper-item.is-complete {
    color: var(--accent);
}

.stepper-item.is-complete .stepper-bubble {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(15, 118, 110, 0.1);
}

.stepper-item.is-pending .stepper-bubble {
    opacity: 0.75;
}

.relato-intro {
    margin: 18px 0 24px;
    padding: 16px 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    background: rgba(15, 118, 110, 0.04);
    line-height: 1.7;
}

.relato-intro p,
.relato-intro ul {
    margin: 0 0 12px;
}

.relato-intro ul {
    padding-left: 20px;
}

.required-mark {
    margin-right: 6px;
    color: #dc2626;
    font-weight: 700;
}

.field-label-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
}

.is-hidden {
    display: none !important;
}

.pdf-viewer-panel {
    margin: 0 0 20px;
    overflow: hidden;
}

.pdf-viewer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.pdf-viewer-close {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    padding: 8px 14px;
    cursor: pointer;
}

.pdf-viewer-frame {
    display: block;
    width: 100%;
    min-height: 78vh;
    border: 0;
}

.site-footer {
    margin-top: auto;
    padding: 10px 0 0;
    text-align: center;
    font-size: 0.95rem;
}

@media (max-width: 900px) {
    .hero,
    .cards,
    .grid-form,
    .denuncia-layout,
    .indicators-layout,
    .indicators-hero,
    .indicator-grid,
    .indicators-toolbar,
    .admin-cards {
        grid-template-columns: 1fr;
        grid-template-areas:
            "stepper"
            "main";
    }

    .login-hero {
        grid-template-columns: 1fr;
    }

    .topbar,
    .split,
    .admin-topline {
        flex-direction: column;
        align-items: stretch;
    }

    .stepper-panel {
        position: static;
    }

    .denuncia-main,
    .stepper-panel {
        grid-area: auto;
    }

    .indicator-filter-form {
        justify-content: stretch;
    }

    .indicator-filter-form label,
    .indicator-filter-form .button {
        width: 100%;
    }

    .login-hero-copy,
    .login-card--raised {
        padding: 28px;
        border-radius: 24px;
    }

    .login-title {
        max-width: none;
    }

    .track-result-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    body {
        background: #fff;
    }

    .topbar,
    .site-footer,
    .stepper-panel,
    .denuncia-layout,
    .button:not(.print-button) {
        display: none !important;
    }

    .shell {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .form-panel {
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
        background: #fff;
    }

    .receipt-box {
        margin: 0;
        border: 1px solid #000;
        background: #fff;
        box-shadow: none;
    }

    .track-search-form,
    .track-search-form * {
        display: none !important;
    }

    .receipt-actions {
        display: none !important;
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
