@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700&family=Source+Serif+4:wght@600;700&display=swap');

:root {
    --background: #f3f5f2;
    --background-accent: #edf1eb;
    --surface: #ffffff;
    --surface-soft: rgba(255, 255, 255, 0.78);
    --line: rgba(33, 58, 45, 0.11);
    --line-strong: rgba(33, 58, 45, 0.18);
    --text: #1f2a24;
    --muted: #637065;
    --primary: #213a2d;
    --primary-strong: #182c21;
    --primary-soft: rgba(33, 58, 45, 0.07);
    --primary-softer: rgba(33, 58, 45, 0.04);
    --success: #24593b;
    --success-soft: rgba(36, 89, 59, 0.1);
    --warning: #90631c;
    --warning-soft: #fff8eb;
    --error: #8b3333;
    --error-soft: #fff3f2;
    --shadow: 0 14px 40px rgba(15, 23, 42, 0.05);
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.04);
    --radius: 20px;
    --radius-sm: 14px;
    --font-sans: "Source Sans 3", "Segoe UI", sans-serif;
    --font-serif: "Source Serif 4", Georgia, serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(33, 58, 45, 0.06), transparent 26%),
        linear-gradient(180deg, var(--background-accent) 0%, var(--background) 30%, var(--background) 100%);
}

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

img {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

code {
    padding: 0.08rem 0.38rem;
    border-radius: 8px;
    background: var(--primary-soft);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--line);
    background: rgba(248, 250, 247, 0.82);
    backdrop-filter: blur(20px);
}

.site-header__inner {
    width: min(1440px, calc(100% - 40px));
    margin: 0 auto;
    padding: 0.72rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}

.brand__logo {
    width: auto;
    height: 48px;
    flex-shrink: 0;
}

.brand__copy {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    min-width: 0;
}

.brand__eyebrow,
.section-kicker {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.brand__system {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    line-height: 1;
    color: var(--primary);
}

.brand__subtitle {
    font-size: 0.84rem;
    color: var(--muted);
}

.module-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-left: auto;
}

.module-nav__primary,
.module-nav__session {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.28rem;
    border: 1px solid rgba(33, 58, 45, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: var(--shadow-soft);
}

.module-nav__session {
    flex-wrap: wrap;
}

.module-nav__form {
    margin: 0;
}

.module-nav__button {
    appearance: none;
    cursor: pointer;
}

.module-nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0.45rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    font-weight: 600;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.module-nav__link:hover,
.module-nav__link.is-active {
    border-color: rgba(33, 58, 45, 0.08);
    background: rgba(33, 58, 45, 0.07);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.site-main {
    padding: 1.4rem 0 2.5rem;
}

.page-shell {
    width: min(1440px, calc(100% - 40px));
    margin: 0 auto;
}

.intro-card--hero {
    background:
        radial-gradient(circle at top right, rgba(33, 58, 45, 0.08), transparent 38%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(246, 249, 245, 0.94));
}

.intro-card,
.upload-panel,
.notice,
.result-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.intro-card,
.upload-panel,
.result-panel {
    padding: 1.2rem 1.25rem;
}

.intro-card {
    margin-bottom: 0.9rem;
}

.intro-card--compact {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.5rem;
}

.hero-copy {
    max-width: 58rem;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.55rem;
}

.hero-meta__item {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0.45rem 0.85rem;
    border: 1px solid rgba(33, 58, 45, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.page-title {
    margin: 0.2rem 0 0;
    font-family: var(--font-serif);
    font-size: clamp(1.8rem, 3.4vw, 2.6rem);
    line-height: 0.98;
    color: var(--primary);
}

.page-subtitle,
.dropzone-copy,
.dropzone-caption,
.panel-tip,
.results-timestamp,
.table-panel__meta,
.file-message,
.file-item__meta {
    color: var(--muted);
}

.page-subtitle {
    margin: 0.55rem 0 0;
    max-width: 60ch;
    line-height: 1.5;
    font-size: 1rem;
}

.notice {
    padding: 0.95rem 1rem;
    margin-bottom: 1rem;
}

.notice-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: rgba(144, 99, 28, 0.16);
}

.notice-error {
    background: var(--error-soft);
    color: var(--error);
    border-color: rgba(139, 51, 51, 0.16);
}

.upload-panel {
    margin-bottom: 1rem;
}

.dropzone {
    min-height: 200px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border: 1px dashed rgba(33, 58, 45, 0.16);
    border-radius: 16px;
    background: rgba(251, 252, 251, 0.92);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
    border-color: rgba(33, 58, 45, 0.28);
    background: #f4f8f3;
}

.dropzone-mark {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.dropzone-title {
    max-width: 28ch;
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--primary);
}

.dropzone-copy,
.dropzone-caption {
    font-size: 0.94rem;
}

#files {
    display: none;
}

.panel-actions,
.results-header,
.table-panel__header,
.file-item__top,
.module-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.panel-actions {
    margin-top: 1rem;
}

.panel-tip {
    margin: 0;
    font-size: 0.95rem;
}

.button,
.file-status,
.results-timestamp,
.summary-chip,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.58rem 0.96rem;
    border-radius: 999px;
    font-weight: 700;
}

.button {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.86);
    color: var(--primary);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.button:hover {
    border-color: var(--line-strong);
    background: #ffffff;
    transform: translateY(-1px);
}

.button-primary,
.btn-primary {
    border-color: rgba(24, 44, 33, 0.18);
    background: linear-gradient(180deg, #2b4738, var(--primary));
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(33, 58, 45, 0.12);
}

.results-stack {
    display: grid;
    gap: 1rem;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.1rem;
}

.module-card {
    display: grid;
    gap: 1rem;
    min-height: 100%;
    padding: 1.3rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 248, 0.98)),
        var(--surface);
    box-shadow: var(--shadow);
}

.module-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.module-card__heading {
    display: grid;
    gap: 0.18rem;
}

.module-card__eyebrow {
    margin: 0 0 0.28rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.module-card__title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--primary);
}

.module-card__copy {
    margin: 0;
    max-width: 42ch;
    line-height: 1.55;
    color: var(--muted);
}

.module-card__note {
    color: var(--muted);
    font-size: 0.92rem;
}

.module-status,
.placeholder-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.32rem 0.72rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.76rem;
    font-weight: 700;
}

.module-status--disponible {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(36, 89, 59, 0.1);
}

.module-status--vacio,
.placeholder-badge {
    background: var(--warning-soft);
    color: var(--warning);
}

.summary-panel {
    display: grid;
    gap: 1rem;
}

.results-header h2,
.table-panel__header h3,
.placeholder-panel h2 {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.35rem;
    color: var(--primary);
}

.results-timestamp,
.table-panel__meta {
    font-size: 0.92rem;
}

.results-timestamp,
.summary-chip {
    background: var(--primary-soft);
    color: var(--primary);
}

.summary-chips,
.downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.files-grid {
    display: grid;
    gap: 0.8rem;
}

.file-item {
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(33, 58, 45, 0.08);
    background: rgba(255, 255, 255, 0.92);
}

.file-item__name {
    display: block;
    color: var(--primary);
    font-size: 1rem;
}

.file-item__meta {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 0.92rem;
}

.file-message {
    margin: 0.7rem 0 0;
    line-height: 1.5;
}

.file-status {
    padding: 0.42rem 0.82rem;
    font-size: 0.84rem;
    text-transform: capitalize;
}

.file-status--procesado {
    background: var(--success-soft);
    color: var(--success);
}

.file-status--omitido {
    background: var(--warning-soft);
    color: var(--warning);
}

.file-status--error {
    background: var(--error-soft);
    color: var(--error);
}

.table-panel {
    padding: 0;
    overflow: hidden;
}

.table-panel__header {
    padding: 1.05rem 1.25rem 0.9rem;
    border-bottom: 1px solid var(--line);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
}

thead th {
    padding: 0.88rem 1.1rem;
    text-align: left;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: #f6f8f5;
}

tbody td {
    padding: 0.95rem 1.1rem;
    border-top: 1px solid rgba(33, 58, 45, 0.08);
    vertical-align: top;
}

tbody tr:nth-child(even) {
    background: #fafbfa;
}

.status-pill {
    padding: 0.38rem 0.7rem;
    font-size: 0.78rem;
}

.status-pill--completo,
.status-pill--normal {
    background: var(--success-soft);
    color: var(--success);
}

.status-pill--incompleto,
.status-pill--marcas_extra {
    background: rgba(144, 99, 28, 0.12);
    color: var(--warning);
}

.placeholder-panel {
    display: grid;
    gap: 1rem;
    max-width: 760px;
}

.placeholder-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.nav-user {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.45rem 0.78rem;
    border-radius: 999px;
    background: rgba(33, 58, 45, 0.06);
    color: var(--primary);
    font-size: 0.92rem;
    font-weight: 600;
}

.module-nav__link--logout {
    border-color: transparent;
    background: transparent;
    color: #7a1f1f;
}

.module-nav__link--logout:hover {
    border-color: rgba(122, 31, 31, 0.1);
    background: rgba(122, 31, 31, 0.06);
    color: #7a1f1f;
}

/* ===== LOGIN PAGE ===== */
@keyframes pageIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgba(33, 58, 45, 0.08), transparent 32%),
        linear-gradient(180deg, #eef2ec, #f4f6f3);
    display: flex;
    flex-direction: column;
}

.login-shell {
    flex: 1;
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
    padding: clamp(1rem, 4vw, 2.2rem) 1rem;
    display: flex;
    align-items: center;
    animation: pageIn 0.6s ease both;
}

.login-auth-panel {
    width: 100%;
    border-radius: 18px;
    border: 1px solid rgba(33, 58, 45, 0.1);
    background: rgba(255, 255, 255, 0.88);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.login-logo-wrap {
    width: 92px;
    height: 92px;
    margin: 0 auto 1rem;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(33, 58, 45, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
}

.login-logo-wrap .ofs-logo {
    width: 64px;
    height: auto;
}

.login-header {
    text-align: center;
}

.login-header .eyebrow {
    font-size: 0.66rem;
    letter-spacing: 0.1rem;
}

.login-header h1 {
    font-size: clamp(1.4rem, 4.2vw, 1.8rem);
    margin-top: 0.2rem;
    color: var(--primary);
}

.login-header p {
    margin-top: 0.35rem;
    font-size: 0.9rem;
}

.status {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-error {
    background: #fbe9e7;
    color: #9b2c2c;
    border: 1px solid #f3b5b5;
}

.status-success {
    background: #e7f4ea;
    color: #1f5a39;
    border: 1px solid #b9dfc3;
}

.login-access-card,
.login-password-panel {
    margin-top: 0.95rem;
    border: 1px solid rgba(33, 58, 45, 0.1);
    border-radius: 12px;
    background: #fafcfb;
    padding: 0.9rem;
}

.login-access-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.login-access-card h3 {
    color: var(--primary);
    font-size: 0.9rem;
    line-height: 1.2;
}

.login-access-list {
    display: grid;
    gap: 0.45rem;
}

.login-access-user {
    border: 1px solid rgba(33, 58, 45, 0.1);
    border-radius: 10px;
    background: #ffffff;
    padding: 0.55rem 0.64rem;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.5rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.25s ease;
}

.login-access-user:hover {
    border-color: var(--line-strong);
    background: #f5f9f6;
}

.login-access-user.is-selected {
    border-color: rgba(33, 58, 45, 0.18);
    background: #edf5ef;
}

.login-access-initials {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04rem;
    color: #ffffff;
    background: var(--primary);
}

.login-access-meta strong {
    display: block;
    color: var(--primary);
    font-size: 0.9rem;
    line-height: 1.2;
}

.record-form {
    display: grid;
    gap: 1rem;
}

.login-form {
    margin-top: 0.85rem;
}

.login-form .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 0.6rem;
    min-height: 44px;
    border-radius: 999px;
    padding: 0.75rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.login-form .btn-primary:hover {
    background: var(--primary-strong);
    transform: translateY(-2px);
}

.login-password-panel {
    display: none;
}

.login-password-panel.is-visible {
    display: block;
}

.login-password-title {
    font-size: 0.92rem;
    color: var(--primary);
    margin-bottom: 0.6rem;
}

.field {
    display: grid;
    gap: 0.42rem;
}

.field input {
    min-height: 42px;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(33, 58, 45, 0.14);
    border-radius: 10px;
    background: #fff;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 58, 45, 0.14);
}

.btn-primary {
    min-height: 44px;
    border: none;
    border-radius: 14px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.site-footer.login-footer {
    background: transparent;
    border-top: none;
    padding: 0.4rem 1rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

@media (max-width: 760px) {
    .site-header__inner,
    .page-shell {
        width: min(calc(100% - 24px), 100%);
    }

    .site-header__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
    }

    .site-main {
        padding: 1rem 0 1.8rem;
    }

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

    .brand__logo {
        height: 44px;
    }

    .intro-card,
    .upload-panel,
    .result-panel {
        padding: 1rem;
    }

    .intro-card--compact,
    .panel-actions,
    .results-header,
    .table-panel__header,
    .file-item__top,
    .module-card__footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .button,
    .results-timestamp {
        width: 100%;
    }

    .module-nav {
        width: 100%;
        margin-left: 0;
        justify-content: stretch;
    }

    .module-nav__primary,
    .module-nav__session {
        width: 100%;
        justify-content: space-between;
    }

    .module-nav__link {
        flex: 1 1 120px;
    }

    .module-nav__session {
        gap: 0.35rem;
    }

    .module-nav__session .module-nav__link {
        width: 100%;
    }

    .hero-copy,
    .module-card__copy {
        max-width: none;
    }

    .downloads {
        width: 100%;
    }

    .downloads .button {
        flex: 1 1 160px;
    }

    table {
        min-width: 680px;
    }
}

@media (min-width: 1100px) {
    .page-shell--home .module-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
