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

/* ========================================
   ANEXOS - Estilos principales
   ======================================== */

:root {
    --color-primary: #1f3b2c;
    --color-primary-light: #2d5640;
    --color-accent: #1f3b2c;
    --color-accent-strong: #193124;
    --color-accent-soft: #e8f0eb;
    --color-gold: #c8a048;
    --color-secondary: #234735;

    --color-bg: #f3f5f2;
    --color-surface: #ffffff;
    --color-border: #d4ddd6;
    --color-border-strong: #bcc9c0;

    --color-text: #1f2937;
    --color-muted: #5f6b63;

    --color-success: #1f5a39;
    --color-error: #9b2c2c;
    --color-warning: #9a6b17;
    --color-info: #1f3b2c;
    --color-info-bg: #eef4f8;
    --color-success-bg: #e7f4ea;
    --color-error-bg: #fbe9e7;

    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 18px;

    --shadow-sm: 0 10px 24px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 16px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.1);

    --transition: all 0.25s ease;
    --font-sans: "Source Sans 3", "Segoe UI", sans-serif;
    --font-serif: "Source Serif 4", "Times New Roman", serif;

    --primary: var(--color-primary);
    --primary-light: var(--color-primary-light);
    --surface: var(--color-surface);
    --border: var(--color-border);
    --text-primary: var(--color-text);
    --text-secondary: var(--color-muted);
    --background: var(--color-bg);
    --shadow: var(--shadow-sm);
    --error: var(--color-error);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background:
        radial-gradient(circle at top right, rgba(200, 160, 72, 0.12), transparent 55%),
        radial-gradient(circle at 10% 20%, rgba(31, 59, 44, 0.08), transparent 45%),
        var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    letter-spacing: 0;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    color: var(--color-text);
    letter-spacing: 0;
}

main {
    padding: 2.25rem 2.5rem 3rem;
    min-height: calc(100vh - 160px);
    animation: pageIn 0.6s ease both;
    width: 100%;
    max-width: none;
    flex: 1;
}

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

/* ========== Navbar ========== */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-accent);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    padding: 1.1rem clamp(1rem, 2vw, 2.25rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-logo {
    height: 58px;
    width: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
}

.nav-title {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.nav-system {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--color-accent);
}

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

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: flex-end;
    flex: 1;
}

.nav-link {
    text-decoration: none;
    color: var(--color-accent);
    font-weight: 600;
    padding: 0.55rem 0.92rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(31, 59, 44, 0.08);
    transition: var(--transition);
}

.nav-link:hover {
    border-color: var(--color-accent);
    background: #f7faf8;
    transform: translateY(-1px);
}

.nav-link.active {
    background: var(--color-accent-soft);
    border-color: rgba(31, 59, 44, 0.28);
    color: var(--color-accent);
}

.nav-link-logout {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
    position: relative;
}

.nav-link-logout:hover {
    background: var(--color-accent-strong);
    border-color: var(--color-accent-strong);
    color: #fff;
}

.nav-link-logout--edit-active {
    padding-right: 1.85rem;
}

.nav-status-dot {
    position: absolute;
    top: 0.42rem;
    right: 0.58rem;
    width: 0.58rem;
    height: 0.58rem;
    border-radius: 50%;
    background: #d32626;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 3px rgba(211, 38, 38, 0.18);
}

/* ========== Layout Containers ========== */
.container {
    background: rgba(255, 255, 255, 0.96);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    max-width: 1280px;
    width: min(100%, 1280px);
    padding: 2.5rem;
    margin: 0 auto;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========== Buttons ========== */
.btn,
.btn-primary,
.btn-process {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.6rem;
    border: none;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
    gap: 0.4rem;
    font-family: inherit;
}

.btn-primary {
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 12px 24px rgba(31, 59, 44, 0.14);
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.6rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    background: #ffffff;
    color: var(--color-accent);
    border: 1px solid var(--color-border);
    font-family: inherit;
}

.btn-secondary:hover {
    background: #f7faf8;
    border-color: var(--color-accent);
    box-shadow: 0 6px 16px rgba(31, 59, 44, 0.12);
    transform: translateY(-2px);
}

.btn-process {
    width: 100%;
    background: var(--color-accent);
    color: #fff;
    font-size: 1.05rem;
    margin-top: 1rem;
}

.btn-process:hover {
    background: var(--color-accent-strong);
    transform: translateY(-2px);
}

.btn-process:disabled {
    background: var(--color-muted);
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* ========== Cards ========== */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(15, 61, 62, 0.12);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

/* ========== Formularios ========== */
.form-group,
.field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

label {
    font-weight: 700;
    color: var(--color-accent);
}

.form-control,
textarea,
select,
input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
textarea:focus,
select:focus,
input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(31, 59, 44, 0.14);
    background: #fff;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.16rem;
    color: var(--color-muted);
    font-weight: 700;
}

.subtitle {
    color: var(--color-muted);
}

.panel-header p {
    color: var(--color-muted);
}

/* ========== Tables ========== */
.table-wrapper {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table thead {
    background: var(--color-primary);
}

.table th,
thead th {
    color: #fff;
    padding: 0.8rem 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
}

.table td,
tbody td {
    border-bottom: 1px solid rgba(31, 59, 44, 0.08);
    padding: 0.7rem 1rem;
}

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

tbody tr:hover {
    background: rgba(31, 59, 44, 0.06);
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: rgba(31, 90, 57, 0.15);
    color: var(--color-success);
}

.badge-danger {
    background: rgba(178, 60, 60, 0.15);
    color: var(--color-error);
}

/* ========== Loading ========== */
.spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(31, 59, 44, 0.18);
    border-top: 3px solid var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin: 0 auto 0.5rem;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* ========== Status ========== */
.status {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
}

.status-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid #b9dfc3;
}

.status-error {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid #f3b5b5;
}

/* ========== Footer ========== */
footer,
.site-footer {
    background: transparent;
    color: var(--color-muted);
    padding: 1.15rem 0 1.4rem;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

footer p,
.site-footer {
    margin: 0.3rem 0;
    font-size: 0.9rem;
}

/* ========== Login ========== */
.login-page {
    min-height: 100vh;
    background: #f1f4f1;
}

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

.login-auth-panel {
    width: 100%;
    border-radius: 16px;
    border: 1px solid #d7e0d9;
    background: #ffffff;
    padding: 1.25rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.login-logo-wrap {
    width: 92px;
    height: 92px;
    margin: 0 auto 1rem;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #e3e9e4;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.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(--color-accent);
}

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

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

.login-form .btn-primary {
    width: 100%;
    margin-top: 0.6rem;
    min-height: 44px;
}

.login-password-panel {
    display: none;
    border: 1px solid #dfe7e1;
    border-radius: 12px;
    background: #fafcfb;
    padding: 0.9rem;
}

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

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

.login-access-card {
    margin-top: 0.95rem;
    border: 1px solid #dfe7e1;
    border-radius: 12px;
    background: #fafcfb;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

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

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

.login-access-user {
    border: 1px solid #d8e1da;
    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: var(--transition);
}

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

.login-access-user.is-selected {
    border-color: var(--color-accent);
    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(--color-accent);
}

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

.login-footer {
    background: transparent;
    border-top: none;
    padding: 0.4rem 1rem 1rem;
}

/* ========== Anexos page styles ========== */
.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.15rem;
    min-width: 0;
}

.panel-eyebrow {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.annex-switcher-panel {
    padding: 0.9rem 1rem;
}

.annex-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: center;
}

.annex-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 700;
}

.annex-chip.is-active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.annex-chip.is-disabled {
    color: #8b958d;
    background: #f0f4f1;
    cursor: not-allowed;
}

.anexos-page-shell {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.anexos-table-panel {
    min-width: 0;
}

.empty-state {
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    color: var(--color-muted);
    background: #fff;
}

.status-message {
    margin-top: 0.8rem;
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    border: 1px dashed transparent;
    min-height: 2.4rem;
    display: flex;
    align-items: center;
    color: var(--color-muted);
}

.status-message.info {
    border-color: #cfd8e8;
    background: #eff5ff;
    color: #2c425f;
}

.status-message.success {
    border-color: #bfe1ca;
    background: var(--color-success-bg);
    color: #1e5f3f;
}

.status-message.error {
    border-color: #f2c9c4;
    background: var(--color-error-bg);
    color: #8a2f24;
}

.anexo-shell {
    padding: 0.9rem;
}

.anexo-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.anexo-toolbar-copy {
    display: grid;
    gap: 0.18rem;
}

.anexo-toolbar-copy h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--color-primary);
}

.anexo-toolbar-meta {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.88rem;
}

.anexo-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.anexo-edit-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    margin: 0 0 0.8rem;
    padding: 0.72rem 0.82rem;
    border: 1px solid rgba(211, 38, 38, 0.18);
    border-radius: 10px;
    background: #fffafa;
}

.anexo-edit-panel.is-disabled {
    border-color: rgba(31, 59, 44, 0.12);
    background: #fafcfb;
}

.anexo-edit-panel-copy,
.anexo-edit-panel-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.anexo-edit-panel-copy {
    color: #8c1f1f;
    font-size: 0.86rem;
    font-weight: 800;
}

.anexo-edit-panel.is-disabled .anexo-edit-panel-copy {
    color: var(--color-muted);
}

.anexo-edit-panel-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.anexo-edit-dot {
    width: 0.62rem;
    height: 0.62rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #d32626;
    box-shadow: 0 0 0 4px rgba(211, 38, 38, 0.13);
}

.anexo-edit-panel.is-disabled .anexo-edit-dot {
    background: #9aa69d;
    box-shadow: none;
}

.anexo-filter-counter {
    border: 1px solid #d8e4d8;
    background: #f6faf5;
    color: #264131;
    border-radius: 999px;
    padding: 0.45rem 0.78rem;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.anexo-export-btn {
    white-space: nowrap;
}

.anexo-initial-edit-toggle {
    white-space: nowrap;
}

.anexo-budget-edit-toggle {
    white-space: nowrap;
}

.anexo-permission-toggle {
    white-space: nowrap;
}

.anexo-permission-toggle.is-on {
    border-color: rgba(211, 38, 38, 0.28);
    background: #fff1f1;
    color: #8c1f1f;
}

.anexo-permission-toggle:disabled {
    cursor: wait;
    opacity: 0.72;
}

.anexo-initial-edit-toggle[aria-pressed="true"] {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #ffffff;
}

.anexo-budget-edit-toggle[aria-pressed="true"] {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #ffffff;
}

.anexo-initial-edit-status {
    min-width: 6.4rem;
    color: var(--color-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: right;
}

.anexo-initial-edit-status[data-kind="success"] {
    color: var(--color-success);
}

.anexo-initial-edit-status[data-kind="error"] {
    color: var(--color-error);
}

.anexo-filter-empty {
    margin-bottom: 0.8rem;
    border-radius: 12px;
    padding: 0.65rem 0.8rem;
    font-size: 0.88rem;
}

.anexo-filter-empty {
    border: 1px dashed #d6cfc0;
    background: #fdf8ef;
    color: #6b5a37;
}

.anexo-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: auto;
    overflow-y: hidden;
    border-radius: 14px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}

.anexo-table {
    width: max(100%, 1450px);
    min-width: 1450px;
    font-size: 0.83rem;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.anexo-table .anexo-col-code {
    width: 8.5rem;
}

.anexo-table .anexo-col-name {
    width: 23rem;
}

.anexo-table .anexo-col-balance,
.anexo-table .anexo-col-number {
    width: 9.5rem;
}

.anexo-table .anexo-col-flow {
    width: 8.2rem;
}

.anexo-table thead th {
    background: #e9f0ea;
    color: #22382d;
    border-bottom: 1px solid #cfd8ce;
    vertical-align: middle;
    text-align: center;
    line-height: 1.35;
}

.anexo-table thead tr:nth-child(2) th {
    background: #f4f7f1;
}

.anexo-table thead tr:nth-child(3) th {
    background: #fbfcfa;
}

.anexo-head-primary th {
    font-size: 0.78rem;
}

.anexo-head-secondary th,
.anexo-head-tertiary th {
    font-size: 0.72rem;
}

.anexo-table .head-spacer {
    color: transparent;
}

.anexo-table td,
.anexo-table th {
    border-right: 1px solid #efe8db;
    padding: 0.58rem 0.68rem;
    overflow-wrap: anywhere;
}

.anexo-table td:last-child,
.anexo-table th:last-child {
    border-right: none;
}

.anexo-table .col-code {
    min-width: 124px;
}

.anexo-table .col-name {
    min-width: 340px;
}

.anexo-table .col-balance {
    min-width: 135px;
}

.anexo-row td {
    background: #fff;
}

.anexo-row .num-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.anexo-initial-edit-cell {
    min-width: 135px;
}

.anexo-initial-input {
    display: none;
    width: 100%;
    min-width: 112px;
    height: 2rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid rgba(31, 59, 44, 0.28);
    border-radius: 8px;
    background: #ffffff;
    color: var(--color-text);
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.anexo-budget-edit-cell {
    min-width: 128px;
}

.anexo-budget-input {
    display: none;
    width: 100%;
    min-width: 112px;
    height: 2rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid rgba(31, 59, 44, 0.28);
    border-radius: 8px;
    background: #ffffff;
    color: var(--color-text);
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.anexo-initial-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(31, 59, 44, 0.1);
}

.anexo-budget-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(31, 59, 44, 0.1);
}

.anexo-table.is-editing-initials .anexo-initial-display {
    display: none;
}

.anexo-table.is-editing-initials .anexo-initial-input {
    display: inline-block;
}

.anexo-table-generic.is-editing-budgets .anexo-budget-display {
    display: none;
}

.anexo-table-generic.is-editing-budgets .anexo-budget-input {
    display: inline-block;
}

.anexo-table.is-editing-initials .anexo-initial-edit-cell {
    background: #fff8ec;
    box-shadow: inset 0 0 0 1px rgba(200, 160, 72, 0.22);
}

.anexo-table-generic.is-editing-budgets .anexo-budget-edit-cell {
    background: #fff8ec;
    box-shadow: inset 0 0 0 1px rgba(200, 160, 72, 0.22);
}

.anexo-row-section td,
.anexo-row-subsection td,
.anexo-row-label td {
    background: #fbfaf6;
}

.anexo-row-section td {
    font-family: var(--font-serif);
    font-size: 0.98rem;
    color: var(--color-primary);
    font-weight: 700;
    border-top: 2px solid var(--color-border);
}

.anexo-row-subsection td,
.anexo-row-label td {
    color: #455247;
    font-weight: 700;
}

.anexo-row-subtotal td {
    background: #f7f2e8;
    font-weight: 700;
}

.anexo-row-total td {
    background: #edf5ef;
    color: #1d4b35;
    font-weight: 800;
    border-top: 1px solid #c7ddcf;
}

.anexo-table-generic {
    width: max(100%, 1180px);
    min-width: 1180px;
    table-layout: fixed;
}

.anexo-table-generic td,
.anexo-table-generic th {
    padding: 0.55rem 0.7rem;
    line-height: 1.4;
    white-space: pre-line;
    vertical-align: middle;
}

.anexo-table-generic .num-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.anexo-sheet-row-title th {
    background: #f7f3ea;
    color: var(--color-primary);
    text-align: center;
    font-weight: 800;
}

.anexo-sheet-row-title:first-child th {
    background: #eef4ef;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.anexo-sheet-row-header th {
    background: #e9f0ea;
    color: #22382d;
    text-align: center;
    font-size: 0.76rem;
    font-weight: 800;
}

.anexo-sheet-row-section th {
    background: #fbfaf6;
    color: var(--color-primary);
    text-align: left;
    font-family: var(--font-serif);
    font-size: 0.98rem;
    font-weight: 700;
    border-top: 2px solid var(--color-border);
}

.anexo-sheet-row-note th {
    background: #f7f2e8;
    color: #654f2b;
    text-align: left;
    font-weight: 700;
}

.anexo-sheet-row-total td {
    background: #edf5ef;
    color: #1d4b35;
    font-weight: 800;
}

.anexo-sheet-row-blank th {
    background: #fff;
    border: none;
    padding: 0.3rem 0;
}

.anexo-table-generic .anexo-cell-placeholder {
    color: transparent;
}

.anexo-table-generic .anexo-cell-empty {
    background: #fffdfa;
}

.anexo-table-anexo_5 {
    min-width: 1780px;
}

.anexo-table-anexo_5 td,
.anexo-table-anexo_5 th {
    border: 1px solid #e3dacb;
}

.anexo-table-anexo_5 .anexo-sheet-row-header th {
    background: #e4ece4;
    text-align: center;
    text-transform: uppercase;
}

.anexo-table-anexo_5 .anexo5-col-no {
    width: 4.5rem;
}

.anexo-table-anexo_5 .anexo5-col-level {
    width: 9.5rem;
}

.anexo-table-anexo_5 .anexo5-col-name {
    width: 25rem;
}

.anexo-table-anexo_5 .anexo5-col-unit {
    width: 11rem;
}

.anexo-table-anexo_5 .anexo5-col-annual,
.anexo-table-anexo_5 .anexo5-col-total,
.anexo-table-anexo_5 .anexo5-col-percent,
.anexo-table-anexo_5 .anexo5-col-difference {
    width: 9.5rem;
}

.anexo-table-anexo_5 .anexo5-col-quarter {
    width: 8rem;
}

.anexo-table-anexo_5 .anexo5-form-cell {
    padding: 0.35rem;
    background: #fff;
    text-align: center;
}

.anexo-table-anexo_5 .anexo5-project-title-row td {
    padding: 0.45rem 0.85rem;
    background: #eaf2e8;
    color: #20372b;
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0;
    text-align: center;
}

.anexo5-project-title-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    min-height: 2.1rem;
}

.anexo5-project-title-text {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.anexo5-project-title-actions,
.anexo5-project-edit-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.anexo5-project-edit-control[hidden],
.anexo5-project-title-actions[hidden] {
    display: none;
}

.anexo5-project-edit,
.anexo5-project-delete,
.anexo5-project-cancel {
    min-height: 1.85rem;
    border: 0;
    background: transparent;
    color: #315541;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
}

.anexo5-project-delete {
    color: #8b352d;
}

.anexo5-project-edit:hover,
.anexo5-project-edit:focus,
.anexo5-project-delete:hover,
.anexo5-project-delete:focus,
.anexo5-project-cancel:hover,
.anexo5-project-cancel:focus {
    color: var(--color-text);
    outline: none;
}

.anexo5-project-save {
    min-height: 1.9rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
}

.anexo-table-anexo_5 .anexo5-insert-row td {
    padding: 0;
    background: #fffdfa;
    text-align: center;
}

.anexo5-new-project-cell {
    height: 2.85rem;
}

.anexo5-insert-open {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 2.85rem;
    border: 0;
    background: transparent;
    color: #315541;
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 800;
}

.anexo5-insert-open:hover,
.anexo5-insert-open:focus {
    background: #f3f8f1;
    outline: none;
}

.anexo5-insert-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 1px solid rgba(49, 85, 65, 0.32);
    border-radius: 50%;
    background: #ffffff;
    font-size: 0.92rem;
    line-height: 1;
}

.anexo5-insert-control {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    min-height: 3.15rem;
    padding: 0.45rem 0.75rem;
    border-top: 1px solid #e3dacb;
    background: #ffffff;
    color: var(--color-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.anexo5-insert-control[hidden] {
    display: none;
}

.anexo5-insert-field {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2rem;
}

.anexo5-project-number,
.anexo5-project-name-input,
.anexo5-insert-count {
    width: 4.5rem;
    height: 2rem;
    padding: 0.25rem 0.45rem;
    border: 1px solid rgba(31, 59, 44, 0.22);
    border-radius: 6px;
    color: var(--color-text);
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.anexo5-project-number:focus,
.anexo5-project-name-input:focus,
.anexo5-insert-count:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(31, 59, 44, 0.1);
}

.anexo5-project-name-input {
    width: 9.5rem;
}

.anexo5-project-number {
    width: 7.5rem;
}

.anexo5-insert-submit {
    min-height: 2rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
}

.anexo5-insert-cancel {
    min-height: 2rem;
    border: 0;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
}

.anexo5-insert-cancel:hover,
.anexo5-insert-cancel:focus {
    color: var(--color-text);
    outline: none;
}

.anexo5-insert-status {
    min-width: 7rem;
    color: #315541;
    font-size: 0.78rem;
}

.anexo-table-anexo_5 .anexo5-meta-cell {
    text-align: center;
}

.anexo5-capture-input {
    width: 100%;
    min-height: 2.15rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fffdfa;
    color: var(--color-text);
    font: inherit;
    text-align: center;
}

.anexo5-capture-input:focus {
    outline: 2px solid rgba(31, 59, 44, 0.22);
    border-color: rgba(31, 59, 44, 0.32);
    background: #ffffff;
}

.anexo5-meta-input {
    min-height: 3.1rem;
    resize: vertical;
    line-height: 1.35;
    text-align: center;
    white-space: normal;
}

.anexo5-calculated-input {
    background: #f3f7f2;
    color: #20372b;
    font-weight: 700;
}

.num-cell-strong {
    font-weight: 800;
}

/* ========== Filters Drawer (SIIF style) ========== */
body.filters-drawer-open {
    overflow: hidden;
}

.filters-drawer-toggle {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-width: 148px;
    padding: 0.78rem 1.05rem;
    border: 1px solid rgba(31, 59, 44, 0.14);
    border-radius: 12px;
    background: #ffffff;
    color: var(--color-primary);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    box-shadow: 0 18px 44px rgba(20, 49, 38, 0.18);
    z-index: 35;
    font-family: inherit;
}

.filters-drawer-toggle:hover {
    background: rgba(31, 59, 44, 0.05);
    border-color: rgba(31, 59, 44, 0.2);
}

.filters-drawer-toggle:active {
    transform: scale(0.985);
}

.filters-drawer-toggle .kbd-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.22rem 0.46rem;
    border-radius: 999px;
    background: rgba(31, 59, 44, 0.06);
    color: var(--color-muted);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.filters-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1190;
}

.filters-drawer-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.filters-drawer {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: min(520px, calc(100vw - 2rem));
    height: calc(100dvh - 2rem);
    max-height: calc(100dvh - 2rem);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(20px);
    transition: transform 0.22s ease, opacity 0.22s ease, visibility 0.22s ease;
    z-index: 1200;
    overscroll-behavior: contain;
}

.filters-drawer.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}

.filters-static {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 22px;
    border: 1px solid rgba(31, 59, 44, 0.12);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.filters-static-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.95rem 1.1rem;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(31, 59, 44, 0.08);
}

.filters-static-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.filters-static-title {
    color: var(--color-primary);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.filters-static-meta {
    color: var(--color-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.filters-static-header-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.filters-static-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(31, 59, 44, 0.12);
    background: rgba(31, 59, 44, 0.06);
    color: var(--color-primary);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.filters-static-count[data-count="0"] {
    background: rgba(255, 255, 255, 0.72);
    color: var(--color-muted);
}

.filters-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(31, 59, 44, 0.12);
    border-radius: 999px;
    background: rgba(31, 59, 44, 0.04);
    color: var(--color-primary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.filters-drawer-close:hover {
    background: rgba(31, 59, 44, 0.08);
    border-color: rgba(31, 59, 44, 0.18);
}

.filters-static-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.2rem 1.1rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filters-static-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
    padding: 0.9rem 1.1rem 1rem;
    border-top: 1px solid rgba(31, 59, 44, 0.10);
    background: rgba(255, 255, 255, 0.84);
}

.btn-apply-filters {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 148px;
    padding: 0.74rem 1.15rem;
    border: 1px solid var(--color-accent);
    border-radius: 12px;
    background: var(--color-accent);
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    font-family: inherit;
}

.btn-apply-filters:hover {
    background: var(--color-accent-strong);
    border-color: var(--color-accent-strong);
}

.btn-apply-filters:active {
    transform: scale(0.98);
}

.btn-clear-filters {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.72rem 0.95rem;
    border: 1px solid rgba(31, 59, 44, 0.14);
    border-radius: 12px;
    background: rgba(31, 59, 44, 0.03);
    color: var(--color-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: inherit;
}

.btn-clear-filters:hover {
    background: rgba(31, 59, 44, 0.06);
    color: var(--color-primary);
}

.filters-panel-section {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.95rem 0;
    border-top: 1px solid rgba(31, 59, 44, 0.08);
    background: transparent;
}

.filters-panel-section:first-of-type {
    border-top: none;
}

.filters-panel-section h4 {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-family: var(--font-sans);
}

.filters-panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.85rem 0.9rem;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    min-width: 0;
}

.filter-field-label {
    color: var(--color-primary);
    font-size: 0.72rem;
    font-weight: 600;
}

.filter-drawer-select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(31, 59, 44, 0.14);
    background: #ffffff;
    color: var(--color-text);
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-drawer-select:focus {
    outline: none;
    border-color: rgba(31, 59, 44, 0.28);
    box-shadow: 0 0 0 4px rgba(31, 59, 44, 0.08);
}

.filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    font-weight: 600;
}

.filter-checkbox-label input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.filter-checkbox-label span {
    color: var(--color-text);
    font-size: 0.86rem;
    font-weight: 600;
}

.anexo-filter-form {
    display: flex;
    flex-direction: column;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #efeae3;
}

::-webkit-scrollbar-thumb {
    background: rgba(15, 61, 62, 0.35);
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 61, 62, 0.55);
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-links {
        justify-content: flex-start;
        width: 100%;
    }

    .anexo-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .anexo-toolbar-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 700px) {
    main {
        padding: 2rem 1rem 3rem;
    }

    .nav-container {
        padding: 0.9rem 1rem;
    }

    .container {
        padding: 2rem 1.5rem;
    }

    .btn,
    .btn-primary,
    .btn-process {
        width: 100%;
    }

    .anexo-shell {
        padding: 0.55rem;
    }

    .filters-drawer-toggle {
        right: 0.9rem;
        bottom: 0.9rem;
        min-width: auto;
        padding: 0.75rem 0.9rem;
    }

    .filters-drawer-toggle .kbd-hint {
        display: none;
    }

    .filters-drawer {
        top: 0.6rem;
        right: 0.6rem;
        width: calc(100vw - 1.2rem);
        height: calc(100dvh - 1.2rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
