/* styles.css — Brand Kit Susanita (Tostaditos Susanita S.A.S) */

@font-face {
    font-family: "Visby Round CF";
    src: url('../../tipografia/VisbyRoundCF-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Visby Round CF";
    src: url('../../tipografia/VisbyRoundCF-ExtraBold.otf') format('opentype');
    font-weight: 700 800;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Paleta oficial */
    --susanita-red: #D41519;
    --susanita-yellow: #F8D209;
    --susanita-gray: #595959;
    --susanita-orange: #F5A800;
    --susanita-green: #7EBC00;
    --susanita-blue: #009ADF;
    --susanita-pink: #C6366E;
    --susanita-web-red: #E1251B;
    --susanita-black: #1A1A1A;
    --susanita-white: #FFFFFF;
    --susanita-bg-soft: #FAFAFA;
    --susanita-bg-warm: #FFFBEB;

    /* Alias semánticos (compatibilidad con app.js) */
    --bg-primary: var(--susanita-bg-soft);
    --bg-secondary: var(--susanita-white);
    --bg-glass: rgba(255, 255, 255, 0.92);
    --border-glass: rgba(89, 89, 89, 0.14);
    --text-primary: var(--susanita-black);
    --text-secondary: var(--susanita-gray);
    --text-muted: #8A8A8A;
    --accent-primary: var(--susanita-red);
    --accent-hover: #B01014;
    --accent-danger: #C62828;
    --accent-warning: var(--susanita-orange);
    --accent-info: var(--susanita-blue);
    --accent-success: var(--susanita-green);

    /* Estados de proceso (pagos guardados / flujo) */
    --process-new: #7BC99A;
    --process-new-text: #1f5c3a;
    --process-error: #EF4444;
    --process-error-text: #ffffff;
    --process-sap: #9EC5FE;
    --process-sap-text: #1e3a5f;
    --process-done: #F5F5F5;
    --process-done-text: #595959;
    --process-cancelled: #FECACA;
    --process-cancelled-text: #991b1b;

    --font-brand-heavy: "Visby Round CF", "Century Gothic", Arial, sans-serif;
    --font-brand-regular: "Visby Round CF", "Century Gothic", Arial, sans-serif;
    --font-web-ui: "Visby Round CF", "Century Gothic", Arial, sans-serif;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(26, 26, 26, 0.06);
    --shadow-md: 0 8px 24px rgba(26, 26, 26, 0.08);
    --shadow-glass: 0 8px 32px rgba(212, 21, 25, 0.08);
    --transition: all 0.3s ease;
}

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

html {
    overflow-x: hidden;
    height: 100%;
}

html:has(body.is-login-screen),
html:has(body.is-home-screen) {
    overflow: hidden;
    height: 100%;
}

body.is-login-screen,
body.is-home-screen {
    overflow: hidden;
    min-height: 0;
    height: 100dvh;
    max-height: 100dvh;
}

body.is-login-screen .app-page-bg,
body.is-home-screen .app-page-bg {
    inset: 0;
    transform: none;
}

body.is-login-screen .app-accent-orb,
body.is-home-screen .app-accent-orb {
    display: none;
}

body {
    font-family: var(--font-brand-regular);
    font-weight: 400;
    background: #e8e8e8;
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    -webkit-text-size-adjust: 100%;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.app-page-bg {
    position: fixed;
    inset: -24px;
    z-index: 0;
    background:
        rgba(255, 255, 255, 0.65),
        url('assets/images/fondo-susanita.png') center center / cover no-repeat;
    filter: blur(6px);
    transform: scale(1.04);
    pointer-events: none;
}

.app-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--susanita-bg-soft);
}
::-webkit-scrollbar-thumb {
    background: #D4D4D4;
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--susanita-gray);
}

/* Header — estilo Inventarios Susanita */
.app-header {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border-glass);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(26, 26, 26, 0.08);
    backdrop-filter: blur(8px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.app-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    line-height: 0;
    cursor: pointer;
    border-radius: 8px;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.app-logo:hover {
    opacity: 0.88;
}

.app-logo:focus-visible {
    outline: 2px solid var(--susanita-red);
    outline-offset: 3px;
}

.brand-logo {
    display: block;
    height: 3.5rem;
    width: auto;
    max-height: 56px;
    object-fit: contain;
    object-position: center;
}

.header-titles h1,
.app-header h1 {
    font-family: var(--font-brand-heavy);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--susanita-black);
    letter-spacing: -0.02em;
    margin: 0;
}

.header-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin: 0.15rem 0 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    padding: 0.45rem 0.9rem;
    border-radius: 99px;
    background: #f5f5f5;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
}

.btn-header {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-web-ui);
    color: var(--text-primary);
    background: var(--susanita-white);
    border: 1px solid #d0d0d0;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    text-transform: none;
    letter-spacing: normal;
}

.btn-header:hover {
    background: var(--susanita-bg-soft);
    border-color: var(--susanita-gray);
    box-shadow: var(--shadow-sm);
}

.btn-header svg {
    flex-shrink: 0;
    opacity: 0.75;
}

.session-warning {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0.75rem 2rem 0;
    padding: 0.85rem 1.25rem;
    background: #fff8e1;
    border: 2px solid var(--susanita-orange);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(245, 168, 0, 0.25);
    animation: sessionPulse 2s ease-in-out infinite;
}

.edit-mode-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0.75rem 2rem 0;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    background: rgba(0, 154, 223, 0.1);
    border: 1px solid rgba(0, 154, 223, 0.35);
}

.edit-mode-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
    min-width: 200px;
}

.edit-mode-text strong {
    color: #0077B3;
}

@keyframes sessionPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(245, 168, 0, 0.2); }
    50% { box-shadow: 0 4px 20px rgba(245, 168, 0, 0.45); }
}

.session-warning-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.session-warning-text {
    flex: 1;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #7a4f00;
    min-width: 200px;
}

.app-footer {
    max-width: 1400px;
    width: 100%;
    margin: auto auto 0;
    padding: 0.75rem 2rem 1.25rem;
    flex-shrink: 0;
}

.app-shell > .app-footer {
    margin-top: auto;
}

.app-footer-inner {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(89, 89, 89, 0.08);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem 1.1rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(26, 26, 26, 0.06);
    backdrop-filter: blur(12px);
    max-width: 520px;
    margin: 0 auto;
}

.app-footer-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 0.55rem;
}

.app-footer-logo {
    height: 32px;
    width: auto;
    max-width: 88px;
    object-fit: contain;
}

.app-footer-text {
    font-size: 0.82rem;
    line-height: 1.55;
    color: #595959;
    margin: 0 0 0.35rem;
    font-weight: 400;
}

.app-footer-copy {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin: 0;
    letter-spacing: 0.02em;
}

.app-footer-inner--inline {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    max-width: none;
    padding: 1rem 0 0;
    margin: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.disconnected {
    background-color: var(--susanita-yellow);
    box-shadow: 0 0 6px rgba(248, 210, 9, 0.8);
}

.status-dot.connected {
    background-color: var(--susanita-green);
    box-shadow: 0 0 6px rgba(126, 188, 0, 0.8);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: var(--font-brand-heavy);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--susanita-red);
    color: var(--susanita-white);
    box-shadow: 0 4px 14px rgba(212, 21, 25, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(212, 21, 25, 0.35);
}

.btn-secondary {
    background: var(--susanita-white);
    color: var(--susanita-red);
    border: 2px solid var(--susanita-red);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--susanita-bg-warm);
}

.btn-outline {
    background: var(--susanita-white);
    color: var(--text-primary);
    border: 1px solid #d0d0d0;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
}

.btn-outline:hover:not(:disabled) {
    background: var(--susanita-bg-soft);
    border-color: var(--susanita-gray);
}

.btn-danger {
    background: var(--accent-danger);
    color: var(--susanita-white);
}

.btn-danger:hover:not(:disabled) {
    background: #A31F1F;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

.btn-pay {
    background: var(--susanita-green);
    color: var(--susanita-white);
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 25px rgba(126, 188, 0, 0.35);
    animation: pulse 2s infinite;
}

.btn-pay:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(126, 188, 0, 0.45);
    animation: none;
    filter: brightness(1.05);
}

.btn-create-sap {
    background: var(--susanita-green);
    color: var(--susanita-white);
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    box-shadow: 0 6px 20px rgba(126, 188, 0, 0.35);
    border: none;
    cursor: pointer;
    font-family: var(--font-brand-heavy);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn-create-sap:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(126, 188, 0, 0.45);
    filter: brightness(1.05);
}

.btn-create-sap:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-finalize-review {
    background: var(--susanita-red);
    color: var(--susanita-white);
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    box-shadow: 0 6px 20px rgba(212, 21, 25, 0.35);
    border: none;
    cursor: pointer;
    font-family: var(--font-brand-heavy);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn-finalize-review:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(212, 21, 25, 0.45);
}

.btn-finalize-review:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-approve {
    background: var(--susanita-green);
    color: var(--susanita-white);
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    box-shadow: 0 6px 20px rgba(126, 188, 0, 0.35);
    border: none;
    cursor: pointer;
    font-family: var(--font-brand-heavy);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.btn-approve:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(126, 188, 0, 0.45);
    filter: brightness(1.05);
}

.btn-approve:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(126, 188, 0, 0.35); }
    70% { box-shadow: 0 0 0 15px rgba(126, 188, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(126, 188, 0, 0); }
}

/* App Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem 0.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Pasos — pestañas estilo Inventarios */
.step-wizard {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.step {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.9rem 1.25rem;
    border-radius: 12px;
    border: 2px solid #ddd;
    background: rgba(255, 255, 255, 0.95);
    opacity: 1;
    transition: var(--transition);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.step.active {
    background: var(--susanita-red);
    border-color: var(--susanita-red);
    color: var(--susanita-white);
    box-shadow: 0 6px 20px rgba(212, 21, 25, 0.3);
}

.step.completed {
    border-color: var(--susanita-yellow);
    background: var(--susanita-bg-warm);
    color: var(--text-primary);
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    border: none;
    transition: var(--transition);
}

.step.active .step-number {
    background: rgba(255, 255, 255, 0.25);
    color: var(--susanita-white);
    box-shadow: none;
}

.step.completed .step-number {
    background: var(--susanita-yellow);
    color: var(--susanita-black);
}

.step.completed .step-number::after {
    display: none;
}

.step-label {
    font-weight: 700;
    font-size: 0.9rem;
}

.step-line {
    display: none;
}

/* Panels — tarjeta principal blanca */
.panel {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(26, 26, 26, 0.12);
    animation: slideUp 0.4s ease forwards;
}

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

.panel-header {
    padding: 1.1rem 1.75rem;
    border-bottom: 2px solid var(--susanita-red);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--susanita-white);
    color: var(--text-primary);
}

.panel-header h2 {
    font-family: var(--font-brand-heavy);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--susanita-black);
}

.panel-icon {
    font-size: 1.5rem;
}

.badge {
    background: var(--susanita-yellow);
    color: var(--susanita-black);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 700;
    border: none;
    margin-left: auto;
}

.panel-body {
    padding: 1.75rem 2rem 0;
}

.panel-body:not(:has(.panel-actions)) {
    padding-bottom: 2rem;
}

.center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    gap: 2rem;
}

.center-content p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 500px;
    line-height: 1.6;
}

.panel-actions {
    margin: 1.5rem -2rem 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    padding: 1.15rem 2rem 1.35rem;
    background: #f5f5f5;
    border-top: 1px solid var(--border-glass);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.panel-actions-split {
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.panel-actions-results {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
}

.panel-actions-results #btnBackToInvoices {
    justify-self: start;
}

.panel-actions-results #btnPrintVouchers {
    justify-self: center;
}

.panel-actions-results #btnNewPayment {
    justify-self: end;
}

.btn-print-vouchers {
    border-color: var(--susanita-red);
    color: var(--susanita-red);
}

.btn-print-vouchers:hover {
    background: rgba(212, 21, 25, 0.08);
}

.btn-back-header {
    flex-shrink: 0;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--susanita-bg-soft);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-web-ui);
}

.btn-back-header:hover {
    background: var(--susanita-bg-warm);
    border-color: var(--susanita-red);
    color: var(--susanita-red);
}

/* Forms & Inputs */
.search-bar, .filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

input[type="text"], input[type="date"] {
    background: var(--susanita-white);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 0.625rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    transition: var(--transition);
    outline: none;
}

.input-search {
    flex: 1;
    min-width: 300px;
}

input[type="text"]:focus, input[type="date"]:focus {
    border-color: var(--susanita-red);
    box-shadow: 0 0 0 3px rgba(212, 21, 25, 0.12);
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* Checkboxes */
.checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    background: var(--susanita-white);
    cursor: pointer;
    display: grid;
    place-content: center;
    transition: var(--transition);
}

.checkbox::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em white;
    background-color: white;
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.checkbox:checked {
    background-color: var(--susanita-red);
    border-color: var(--susanita-red);
}

.checkbox:checked::before {
    transform: scale(1);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: var(--susanita-white);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-glass);
}

.data-table th {
    background: #f0f0f0;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--susanita-black);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--susanita-red);
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:nth-child(even) {
    background: var(--susanita-bg-soft);
}

.data-table tbody tr:hover {
    background: var(--susanita-bg-warm);
}

.data-table tbody tr.selected {
    background: #fff0f0;
    box-shadow: inset 3px 0 0 var(--susanita-red);
}

.data-table tbody tr.selected:nth-child(even) {
    background: #fff0f0;
}

.data-table td {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.th-check { width: 40px; text-align: center; }
.th-right { text-align: right; }
td.th-right {
    text-align: right;
    font-weight: 600;
}

.total-row td {
    background: var(--susanita-bg-warm);
    font-size: 1rem;
    font-weight: 600;
}

.total-row #totalSelected {
    color: var(--susanita-red);
    font-size: 1.125rem;
}

/* Status Badges */
.status-badge {
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}
.status-overdue {
    background: rgba(212, 21, 25, 0.12);
    color: var(--susanita-red);
    border: 1px solid rgba(212, 21, 25, 0.25);
}
.status-soon {
    background: rgba(245, 168, 0, 0.15);
    color: #9A6500;
    border: 1px solid rgba(245, 168, 0, 0.35);
}
.status-current {
    background: rgba(126, 188, 0, 0.15);
    color: #4A7300;
    border: 1px solid rgba(126, 188, 0, 0.35);
}

/* PDF Upload */
.pdf-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pdf-input {
    display: none;
}

.pdf-upload-label {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 154, 223, 0.35);
    background: rgba(0, 154, 223, 0.08);
    color: #0077B3;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    transition: var(--transition);
}

.pdf-upload:hover .pdf-upload-label {
    border-color: var(--susanita-blue);
    background: rgba(0, 154, 223, 0.14);
}

.pdf-file-name {
    max-width: 72px;
    color: var(--text-secondary);
    font-size: 0.65rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

button.pdf-file-name.btn-view-pdf {
    max-width: 88px;
    padding: 0;
    border: none;
    background: transparent;
    color: #1d4ed8;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

button.pdf-file-name.btn-view-pdf:hover {
    color: #1e3a8a;
}

.save-draft-summary {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--susanita-bg-warm);
    border: 1px solid rgba(212, 21, 25, 0.12);
}

.save-draft-summary-intro {
    margin: 0 0 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.save-draft-summary-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.save-draft-summary-amount {
    font-weight: 700;
    white-space: nowrap;
}

.attachment-hint {
    margin: -0.5rem 0 1.25rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--susanita-bg-warm);
    border: 1px solid rgba(248, 210, 9, 0.5);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.th-ref, .td-ref {
    min-width: 0;
    max-width: none;
}

#invoiceTable {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
}

#invoiceTable th,
#invoiceTable td {
    padding: 0.35rem 0.15rem;
    font-size: 0.78rem;
    vertical-align: middle;
}

#invoiceTable thead th {
    text-align: center;
    vertical-align: middle;
    padding: 0.45rem 0.12rem;
    font-size: 0.63rem;
    font-weight: 600;
    line-height: 1.15;
    white-space: normal;
}

#invoiceTable thead .th-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35em;
    text-align: center;
    line-height: 1.15;
}

#invoiceTable thead .th-label-wide {
    font-size: 0.58rem;
    line-height: 1.12;
    min-height: 2.5em;
}

/* Anchos que suman 100% */
#invoiceTable .th-check {
    width: 4%;
    padding: 0.35rem 0.05rem 0.35rem 0.3rem !important;
}

#invoiceTable td.th-check {
    padding: 0.35rem 0.05rem 0.35rem 0.3rem !important;
    text-align: center;
}

#invoiceTable th.col-vendor,
#invoiceTable td.col-vendor {
    width: 19%;
    text-align: left;
}

#invoiceTable th.col-vendor {
    text-align: center;
}

#invoiceTable td.col-vendor {
    padding-left: 0.2rem !important;
}

#invoiceTable .col-type {
    width: 9%;
    min-width: 6.75rem;
}

#invoiceTable .col-docnum {
    width: 8%;
    min-width: 4.75rem;
}
#invoiceTable .col-ref { width: 11%; }
#invoiceTable .col-date { width: 10%; }
#invoiceTable .col-amount { width: 12%; }
#invoiceTable .col-status { width: 11%; min-width: 4.5rem; }
#invoiceTable .col-attach { width: 10%; }

#invoiceTable td.col-type,
#invoiceTable td.col-docnum,
#invoiceTable td.col-ref,
#invoiceTable td.col-date,
#invoiceTable td.col-status,
#invoiceTable td.col-attach {
    text-align: center;
}

#invoiceTable td.col-type {
    overflow: hidden;
    text-overflow: clip;
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
    vertical-align: middle;
}

#invoiceTable td.col-type .doc-type-badge {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    line-height: 1.35;
    text-align: center;
    box-sizing: border-box;
    vertical-align: middle;
}

#invoiceTable td.col-docnum {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 0.4rem !important;
    padding-right: 0.35rem !important;
    vertical-align: middle;
}

#invoiceTable td.col-docnum strong {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

#invoiceTable th.col-ref,
#invoiceTable td.col-ref {
    text-align: center;
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
}

#invoiceTable td.col-ref .creditor-ref {
    display: inline-block;
    max-width: 100%;
    text-align: center;
    word-break: break-word;
    line-height: 1.25;
}

#invoiceTable td.col-ref {
    vertical-align: middle;
}

#invoiceTable th.col-status {
    text-align: center;
}

#invoiceTable td.col-status {
    overflow: visible;
    text-overflow: clip;
    text-align: center;
    vertical-align: middle;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

#invoiceTable td.col-status .status-cell-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    margin: 0 auto;
}

#invoiceTable .col-status .status-badge {
    font-size: 0.58rem;
    padding: 0.12rem 0.35rem;
    line-height: 1.2;
    max-width: none;
}

#invoiceTable .overdue-days {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    white-space: nowrap;
}

#invoiceTable .overdue-days--late {
    color: var(--susanita-red, #D41519);
}

#invoiceTable .overdue-days--ok {
    color: var(--text-muted, #888);
    font-weight: 600;
}

#invoiceTable th {
    font-family: inherit;
    text-transform: none;
    letter-spacing: 0;
}

#invoiceTable td {
    overflow: hidden;
    text-overflow: ellipsis;
}

#invoiceTable td.col-status,
#invoiceTable td.td-attach {
    overflow: visible;
    text-overflow: clip;
}

#invoiceTable td.td-date {
    font-size: 0.72rem;
    white-space: nowrap;
    text-align: center;
}

#invoiceTable .vendor-code {
    font-weight: 600;
    font-size: 0.76rem;
    line-height: 1.2;
}

#invoiceTable .vendor-name {
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#invoiceTable .td-ref,
#invoiceTable .creditor-ref {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

#invoiceTable th.col-amount,
#invoiceTable td.col-amount {
    text-align: right;
    padding-right: 0.45rem !important;
    padding-left: 0.15rem !important;
    font-variant-numeric: tabular-nums;
}

#invoiceTable th.col-amount .th-label {
    justify-content: flex-end;
    width: 100%;
    padding-right: 0.15rem;
}

#invoiceTable .td-amount,
#invoiceTable td.col-amount {
    font-family: inherit;
    font-weight: 600;
    font-size: 0.76rem;
    white-space: nowrap;
}

#invoiceTable td.col-open.amount-partial {
    white-space: normal;
    line-height: 1.25;
}

#invoiceTable .amount-open {
    font-weight: 700;
    color: var(--susanita-red, #D41519);
}

#invoiceTable .amount-paid-hint,
.draft-inv-amount .amount-paid-hint {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.62rem;
    font-weight: 500;
    color: var(--text-secondary, #595959);
    line-height: 1.2;
}

#invoiceTable .col-open,
#invoiceTable td.col-open {
    width: 11%;
}

#invoiceTable th.col-cash-discount,
#invoiceTable td.col-cash-discount {
    width: 10%;
    min-width: 6.5rem;
}

#invoiceTable th.col-discount-pct,
#invoiceTable td.col-discount-pct {
    width: 7%;
    min-width: 4.75rem;
}

#invoiceTable td.col-cash-discount .input-discount,
#invoiceTable td.col-discount-pct .input-discount-percent {
    width: 100%;
    max-width: 8.5rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid rgba(89, 89, 89, 0.22);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    text-align: right;
    color: var(--text-primary);
    background: #fff;
}

#invoiceTable td.col-discount-pct .input-discount-percent {
    width: 4.5rem;
}

.program-standard #invoiceTable .col-cash-discount,
.program-standard #invoiceTable .col-discount-pct,
.assignment-no-discounts .col-cash-discount,
.assignment-no-discounts .col-discount-pct {
    display: none !important;
}

#invoiceTable td.col-cash-discount .input-discount:disabled {
    background: var(--susanita-bg-soft);
    color: var(--text-secondary);
    cursor: not-allowed;
}

#invoiceTable td.col-discount-pct .input-discount-percent {
    background: var(--susanita-bg-soft);
    color: var(--text-secondary);
    cursor: default;
}

#invoiceTable td.col-cash-discount .input-discount:focus {
    outline: none;
    border-color: var(--susanita-red);
    box-shadow: 0 0 0 2px rgba(212, 21, 25, 0.12);
}

#invoiceTable .discount-na {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

#invoiceTable th.col-total,
#invoiceTable td.col-total {
    color: var(--text-secondary, #595959);
    font-weight: 500;
}

#invoiceTable th.col-open,
#invoiceTable td.col-open {
    font-weight: 700;
}

.invoice-partial-filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0 0.5rem;
    padding: 0.55rem 0.75rem;
    background: rgba(248, 210, 9, 0.12);
    border: 1px solid rgba(212, 21, 25, 0.15);
    border-radius: 10px;
}

.invoice-filter-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary, #595959);
}

.invoice-partial-filter .invoice-filter {
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
}

#invoiceTable tr.doc-row-partial {
    background: rgba(248, 210, 9, 0.1);
}

#invoiceTable tr.doc-row-partial:hover {
    background: rgba(248, 210, 9, 0.16);
}

#invoiceTable .partial-pay-badge {
    display: inline-block;
    margin-bottom: 0.2rem;
    padding: 0.12rem 0.38rem;
    border-radius: 999px;
    background: rgba(212, 21, 25, 0.1);
    border: 1px solid rgba(212, 21, 25, 0.28);
    color: var(--susanita-red, #D41519);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

#invoiceTable tr.invoice-filter-empty td {
    text-align: center;
    padding: 1.25rem 0.75rem;
    color: var(--text-secondary, #595959);
    font-size: 0.82rem;
}

.draft-invoice-item.draft-invoice-partial {
    border-left: 3px solid var(--susanita-yellow, #F8D209);
}

.draft-inv-header .partial-pay-badge {
    margin-left: 0.35rem;
    vertical-align: middle;
}

#invoiceTableContainer.table-container {
    overflow-x: auto;
    padding-left: 0;
    padding-right: 0;
}

/* Tabla documentos — pronto pago y asignación PDF (mismas columnas Tipo / Doc.SAP) */
.pdf-assignment-docs-table {
    table-layout: fixed;
    width: 100%;
    min-width: 960px;
}

.pdf-assignment-docs-table .col-vendor {
    width: 17%;
    min-width: 9rem;
}

.pdf-assignment-docs-table td.col-vendor {
    overflow: hidden;
    text-align: left;
    vertical-align: middle;
    padding-left: 0.45rem !important;
    padding-right: 0.25rem !important;
    max-width: 0;
}

.pdf-assignment-docs-table .vendor-code {
    font-weight: 600;
    font-size: 0.74rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-assignment-docs-table .vendor-name {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.3;
    margin-top: 0.12rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.pdf-assignment-docs-table .col-type {
    width: 10%;
    min-width: 7.5rem;
}

.pdf-assignment-docs-table .col-docnum {
    width: 8%;
    min-width: 4.75rem;
}

.pdf-assignment-docs-table td.col-type {
    overflow: hidden;
    text-align: center;
    vertical-align: middle;
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
    position: relative;
    z-index: 1;
    background: inherit;
}

.pdf-assignment-docs-table td.col-type .doc-type-badge {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    line-height: 1.35;
    text-align: center;
    box-sizing: border-box;
    vertical-align: middle;
}

.pdf-assignment-docs-table td.col-docnum {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
    padding-left: 0.4rem !important;
    padding-right: 0.35rem !important;
}

.pdf-assignment-docs-table td.col-docnum strong {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.program-early-payment #invoiceTable {
    min-width: 1080px;
}

.program-early-payment #invoiceTable th.col-vendor,
.program-early-payment #invoiceTable td.col-vendor {
    width: 16%;
}

.doc-type-badge {
    display: inline-block;
    padding: 0.22rem 0.5rem;
    border-radius: 99px;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
    vertical-align: middle;
    line-height: 1.35;
}

.doc-type-invoice {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.doc-type-credit {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

tr.doc-row-credit {
    background: #fef2f2;
}

tr.doc-row-credit td.col-type {
    background: #fef2f2;
}

tr.doc-row-credit:nth-child(even) {
    background: #fef2f2;
}

tr.doc-row-credit.selected {
    background: #ffe8e8;
}

.amount-credit {
    color: #b91c1c;
    font-weight: 700;
}

.pdf-not-required {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    white-space: nowrap;
}

.creditor-ref {
    display: inline-block;
    font-family: inherit;
    font-size: inherit;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 100%;
}

.th-attach, .td-attach {
    min-width: 0;
    white-space: normal;
    position: static;
    background: var(--susanita-white);
    box-shadow: none;
}

.data-table thead .th-attach {
    background: #f0f0f0;
}

.data-table tbody tr.selected .td-attach {
    background: #fff0f0;
}

.data-table tbody tr.doc-row-credit .td-attach {
    background: #fef2f2;
}

.data-table tbody tr.doc-row-credit.selected .td-attach {
    background: #ffe8e8;
}

.pdf-attached {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
}

.pdf-attached-icon {
    color: var(--susanita-green);
    font-weight: 700;
    flex-shrink: 0;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pdf-attached-icon::before {
    content: 'OK';
}

.btn-remove-pdf {
    background: transparent;
    border: none;
    color: var(--susanita-red);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.25rem;
    flex-shrink: 0;
}

.btn-remove-pdf:hover {
    color: var(--accent-hover);
}

.pdf-uploading {
    font-size: 0.75rem;
    color: var(--susanita-blue);
}

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

/* Loaders */
.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(89, 89, 89, 0.15);
    border-radius: 50%;
    border-top-color: var(--susanita-red);
    animation: spin 1s ease-in-out infinite;
}

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

/* Payment Summary Bar */
.payment-summary {
    position: sticky;
    bottom: 2rem;
    background: #ffffff;
    border: 2px solid var(--susanita-red);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    z-index: 50;
    animation: slideUp 0.3s ease;
}

.summary-info {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.summary-label {
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    color: var(--text-secondary);
    font-weight: 500;
}

.summary-value {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 700;
    color: var(--text-primary);
}

.summary-total {
    color: var(--susanita-black);
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    font-weight: 700;
}

.summary-discount-total {
    color: var(--susanita-red);
    font-weight: 700;
}

.payment-discount-total {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
    font-size: 1rem;
    font-weight: 700;
    color: var(--susanita-red);
    text-align: right;
}

.summary-total.wizard-total-negative,
.total-row #totalSelected.wizard-total-negative {
    color: #7c3aed;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 26, 26, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--susanita-white);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--susanita-red);
    color: var(--susanita-white);
}

.modal-header h3 {
    margin: 0;
    color: var(--susanita-white);
    font-family: var(--font-brand-heavy);
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--susanita-white);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
    color: var(--text-primary);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: var(--susanita-bg-soft);
}

.modal-footer .btn-outline {
    color: var(--susanita-gray);
    border-color: var(--border-glass);
}

.modal-footer .btn-outline:hover:not(:disabled) {
    background: var(--susanita-white);
    border-color: var(--susanita-gray);
}

.payment-detail-list {
    margin-bottom: 1.5rem;
}

.payment-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-glass);
}

.payment-grand-total {
    font-size: 1.25rem;
    text-align: right;
    margin-top: 1rem;
    color: var(--susanita-red);
    font-weight: 700;
}

/* Results Section */
.result-card {
    background: var(--susanita-bg-soft);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.result-card.success {
    border-color: rgba(123, 201, 154, 0.45);
    background: rgba(123, 201, 154, 0.12);
}

.result-card.error {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.06);
}

.result-error-message {
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}

.result-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.result-icon--success {
    background: var(--process-new);
    color: var(--process-new-text);
}

.result-icon--success::before {
    content: 'OK';
}

.result-icon--error {
    background: var(--process-error);
    color: var(--process-error-text);
}

.result-icon--error::before {
    content: 'X';
}

.result-details h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.result-details p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.result-details a {
    color: var(--susanita-red);
    text-decoration: none;
    font-weight: 600;
}

.result-details a:hover {
    text-decoration: underline;
}

/* Toasts */
.toast-container {
    position: fixed;
    top: 5.5rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: var(--susanita-white);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease, fadeOut 0.5s ease 4.5s forwards;
    max-width: 350px;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; }
}

.toast.success { border-color: rgba(22, 163, 74, 0.35); }
.toast.error { border-color: rgba(212, 21, 25, 0.28); }
.toast.info { border-color: rgba(59, 130, 246, 0.3); }
.toast.warning { border-color: rgba(217, 119, 6, 0.35); }

/* Summary actions */
.summary-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.badge-header {
    margin-left: 0.35rem;
    background: var(--susanita-red);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
    border-radius: 99px;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.input-textarea {
    width: 100%;
    min-width: 100%;
    background: var(--bg-secondary, #f5f5f5);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.625rem 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-primary);
    resize: vertical;
}

/* Pagos guardados */
.draft-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.draft-filters .draft-filter {
    text-transform: none;
    letter-spacing: normal;
}

.draft-filter.active {
    border-color: transparent;
    color: var(--process-done-text);
}

.draft-filter.active[data-status="aprobado"] {
    background: var(--process-sap);
    color: var(--process-sap-text);
    border-color: var(--process-sap);
}

.draft-filter.active[data-status="ejecutado_parcial"] {
    background: var(--process-error);
    color: var(--process-error-text);
    border-color: var(--process-error);
}

.draft-filter.active[data-status="ejecutado"] {
    background: var(--process-done);
    color: var(--process-done-text);
    border-color: rgba(89, 89, 89, 0.25);
}

.draft-filter.active[data-status="rechazado"] {
    background: var(--process-cancelled);
    color: var(--process-cancelled-text);
    border-color: var(--process-cancelled);
}

.draft-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.6);
    transition: var(--transition);
}

.draft-card:hover {
    box-shadow: var(--shadow-md);
}

.draft-card--pendiente_revision {
    border-left: 4px solid var(--process-new);
}

.draft-card--aprobado {
    border-left: 4px solid var(--process-sap);
}

.draft-card--ejecutado_parcial {
    border-left: 4px solid var(--process-error);
}

.draft-card--ejecutado {
    border-left: 4px solid rgba(89, 89, 89, 0.35);
    background: var(--process-done);
}

.draft-card--rechazado {
    border-left: 4px solid var(--process-cancelled);
    background: rgba(254, 202, 202, 0.35);
}

.draft-card h4 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}

.draft-card-meta,
.draft-card-stats {
    font-size: clamp(0.75rem, 2vw, 0.8rem);
    color: var(--text-secondary);
    margin: 0.15rem 0;
    line-height: 1.4;
}

.draft-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.35rem;
}

.draft-status {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.draft-status-pendiente_revision {
    background: var(--process-new);
    color: var(--process-new-text);
    border-color: rgba(31, 92, 58, 0.15);
}

.draft-status-aprobado {
    background: var(--process-sap);
    color: var(--process-sap-text);
    border-color: rgba(30, 58, 95, 0.12);
}

.draft-status-ejecutado {
    background: var(--process-done);
    color: var(--process-done-text);
    border-color: rgba(89, 89, 89, 0.2);
}

.draft-status-ejecutado_parcial {
    background: var(--process-error);
    color: var(--process-error-text);
    border-color: var(--process-error);
}

.draft-partial-hint {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.28);
    color: #b91c1c;
    font-size: 0.92rem;
    line-height: 1.45;
}

.draft-status-rechazado {
    background: var(--process-cancelled);
    color: var(--process-cancelled-text);
    border-color: rgba(153, 27, 27, 0.15);
}

/* Vista Inicio — selección de módulos */
.view-home.app-shell {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.view-home .app-header {
    flex-shrink: 0;
    padding: 0.55rem 1.25rem;
}

.view-home .header-left {
    gap: 0.85rem;
}

.view-home .header-right {
    gap: 0.45rem;
}

.view-home .btn-header {
    padding: 0.4rem 0.7rem;
    font-size: 0.78rem;
    gap: 0.35rem;
}

.view-home .user-badge {
    font-size: 0.72rem;
    padding: 0.3rem 0.55rem;
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.view-home .header-subtitle {
    display: none;
}

.view-home .brand-logo {
    height: 3.25rem;
    max-height: 52px;
}

.view-home .app-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    max-width: none;
    width: 100%;
    margin: 0 auto;
    padding: 0.5rem 1.5rem;
    min-height: 0;
    overflow: hidden;
}

.view-home #panelHome {
    width: min(100%, 880px);
    max-width: 880px;
    margin: 0 auto;
    flex: 0 0 auto;
}

.view-home .panel-home {
    width: 100%;
    margin: 0 auto;
    box-shadow: 0 8px 28px rgba(26, 26, 26, 0.1);
}

.view-home .panel-home .panel-home-body {
    padding: 1.35rem 1.5rem 1.25rem;
}

.view-home .app-footer {
    margin-top: auto;
    flex-shrink: 0;
    padding: 0.2rem 1.15rem 0.5rem;
}

.view-home .app-footer-inner {
    max-width: 460px;
    margin: 0 auto;
    padding: 0.55rem 0.9rem 0.6rem;
}

.view-home .app-footer-brand {
    margin-bottom: 0.35rem;
}

.view-home .app-footer-logo {
    height: 22px;
}

.view-home .app-footer-text {
    font-size: 0.74rem;
    line-height: 1.4;
    margin-bottom: 0.15rem;
}

.view-home .app-footer-copy {
    font-size: 0.68rem;
}

.home-welcome {
    margin-bottom: 0.9rem;
    text-align: center;
}

.home-welcome-title {
    margin: 0 0 0.35rem;
    font-family: var(--font-brand-heavy);
    font-size: clamp(1.2rem, 3vh, 1.45rem);
    font-weight: 800;
    color: #595959;
}

.home-intro {
    margin: 0;
    color: var(--text-muted, #595959);
    font-size: clamp(0.9rem, 2.1vh, 1rem);
    line-height: 1.4;
}

.home-modules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(0.75rem, 1.8vh, 1rem);
}

.home-module-card {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.95rem;
    padding: clamp(0.9rem, 2.2vh, 1.1rem) 1.1rem;
    min-height: clamp(4.5rem, 12vh, 5.5rem);
    text-align: left;
    background: #fff;
    border: 2px solid rgba(212, 21, 25, 0.12);
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(89, 89, 89, 0.05);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    font-family: inherit;
}

.home-module-card:hover {
    border-color: #D41519;
    box-shadow: 0 6px 20px rgba(212, 21, 25, 0.1);
    transform: translateY(-1px);
}

.home-module-card--soon {
    border-color: rgba(89, 89, 89, 0.12);
    cursor: default;
}

.home-module-card--soon:hover {
    border-color: rgba(89, 89, 89, 0.2);
    box-shadow: 0 2px 12px rgba(89, 89, 89, 0.05);
    transform: none;
}

.home-module-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
}

.home-module-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(50px, 7vh, 56px);
    height: clamp(50px, 7vh, 56px);
    flex-shrink: 0;
    border-radius: 12px;
}

.home-module-icon--payment {
    background: rgba(212, 21, 25, 0.1);
    color: #D41519;
}

.home-module-icon--early-payment {
    background: rgba(31, 122, 63, 0.1);
    color: #1f7a3f;
}

.payment-program-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 1rem 0.75rem;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(212, 21, 25, 0.08), rgba(248, 210, 9, 0.12));
    color: #595959;
    font-size: 0.92rem;
    font-weight: 600;
}

.payment-program-banner span {
    text-align: center;
}

.home-module-icon--vendors {
    background: rgba(248, 210, 9, 0.35);
    color: #595959;
}

.home-module-title {
    display: block;
    font-family: var(--font-brand-heavy);
    font-size: clamp(1rem, 2.4vh, 1.1rem);
    font-weight: 800;
    color: #595959;
    line-height: 1.25;
}

.home-module-desc {
    display: block;
    font-size: clamp(0.84rem, 1.9vh, 0.92rem);
    line-height: 1.35;
    color: rgba(89, 89, 89, 0.85);
}

.home-module-badge {
    position: absolute;
    top: 0.55rem;
    right: 0.6rem;
    display: inline-block;
    margin-top: 0;
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #595959;
    background: rgba(248, 210, 9, 0.45);
    border-radius: 999px;
}

.home-module-badge--soon {
    position: static;
    align-self: flex-start;
    margin: 0.1rem 0 0.15rem;
    padding: 0.18rem 0.5rem;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.home-module-card--soon .home-module-content {
    gap: 0.12rem;
}

@media (max-width: 640px) {
    .view-home .home-modules {
        grid-template-columns: 1fr;
    }

    .view-home .app-container {
        justify-content: center;
        align-items: center;
        padding: 0.5rem 1rem;
    }

    .view-home #panelHome {
        width: min(100%, 100%);
    }

    .view-home .panel-home .panel-home-body {
        padding: 1rem 1rem 1.05rem;
    }
}

@media (max-height: 720px) {
    .view-home .app-container {
        justify-content: center;
        align-items: center;
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    .view-home .home-welcome {
        margin-bottom: 0.75rem;
    }

    .view-home .home-module-card {
        min-height: 3.85rem;
        padding: 0.7rem 0.9rem;
    }
}

/* Vista Pagos guardados — todos los perfiles */
.view-saved-payments.app-shell {
    min-height: 100vh;
}

.view-saved-payments .app-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0.75rem 1.5rem 0.5rem;
    gap: 0.75rem;
}

.view-saved-payments #panelSavedPayments {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.view-saved-payments #panelSavedPayments .panel-header {
    padding: 0.75rem 1.25rem;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.view-saved-payments #panelSavedPayments .panel-header h2 {
    flex: 1 1 auto;
    order: 0;
    font-size: 1.05rem;
    margin: 0;
}

.view-saved-payments #panelSavedPayments .panel-header .btn-back-header {
    order: 1;
    width: auto;
    margin-left: auto;
    flex-shrink: 0;
}

.view-saved-payments #panelSavedPayments .panel-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0.85rem 1.25rem 1rem;
}

.view-saved-payments #panelSavedPayments .panel-body:not(:has(.panel-actions)) {
    padding-bottom: 1rem;
}

.view-saved-payments #panelSavedPayments .info-hint {
    margin: 0 0 0.6rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.84rem;
    line-height: 1.45;
}

.view-saved-payments #panelSavedPayments .draft-filters {
    margin-bottom: 0.75rem;
    gap: 0.4rem;
}

.view-saved-payments #draftsListContainer {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    overflow-y: auto;
}

.view-saved-payments #panelSavedPayments .draft-card {
    padding: 0.85rem 1rem;
    margin-bottom: 0;
}

.view-saved-payments #panelSavedPayments .draft-card h4 {
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.view-saved-payments #panelSavedPayments .draft-card-meta,
.view-saved-payments #panelSavedPayments .draft-card-stats {
    margin: 0.1rem 0;
}

.view-saved-payments .app-footer {
    margin-top: auto;
    flex-shrink: 0;
    padding: 0.65rem 1.5rem 1.15rem;
}

.view-saved-payments .app-footer-inner {
    max-width: 540px;
    margin: 0 auto;
    padding: 0.7rem 1.35rem 0.75rem;
}

.view-saved-payments .app-footer-brand {
    margin-bottom: 0.25rem;
}

.view-saved-payments .app-footer-text {
    margin: 0 0 0.2rem;
    line-height: 1.5;
}

.view-saved-payments .app-footer-copy {
    margin: 0;
}

/* Vista detalle de pago */
.view-draft-review.app-shell {
    min-height: 100vh;
}

.view-draft-review .app-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0.75rem 1.5rem 0.5rem;
    gap: 0.75rem;
}

.view-draft-review #panelDraftReview {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.view-draft-review #panelDraftReview .panel-header {
    padding: 0.75rem 1.25rem;
    gap: 0.75rem;
}

.view-draft-review #panelDraftReview .panel-header h2 {
    flex: 1 1 auto;
    order: 0;
    font-size: 1.05rem;
}

.view-draft-review #panelDraftReview .panel-header .btn-back-header {
    order: 1;
    width: auto;
    margin-left: auto;
}

.view-draft-review #panelDraftReview .panel-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0.85rem 1.25rem 1rem;
}

.view-draft-review .draft-review-summary {
    margin-bottom: 0.75rem;
}

.view-draft-review .draft-review-hint {
    margin: 0.5rem 0 0;
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
}

.view-draft-review .draft-review-layout {
    flex: 1 1 auto;
    min-height: 0;
    gap: 0.85rem;
}

.view-draft-review .draft-invoices-panel-head {
    margin-bottom: 0.5rem;
    gap: 0.4rem;
}

.view-draft-review .draft-invoices-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    gap: 0.5rem;
}

.view-draft-review .draft-pdf-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.view-draft-review .draft-pdf-viewer {
    flex: 1 1 auto;
    min-height: 240px;
}

.view-draft-review .draft-review-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}

.view-draft-review .app-footer {
    margin-top: auto;
    flex-shrink: 0;
    padding: 0.65rem 1.5rem 1.15rem;
}

.view-draft-review .app-footer-inner {
    max-width: 540px;
    margin: 0 auto;
    padding: 0.7rem 1.35rem 0.75rem;
}

.view-draft-review .app-footer-brand {
    margin-bottom: 0.25rem;
}

.view-draft-review .app-footer-text {
    margin: 0 0 0.2rem;
}

.view-draft-review .app-footer-copy {
    margin: 0;
}

.draft-review-summary {
    margin-bottom: 1.25rem;
    padding: 0;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
}

.draft-summary-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem 1.15rem;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid rgba(248, 210, 9, 0.45);
    box-shadow: 0 2px 12px rgba(26, 26, 26, 0.05);
}

.draft-summary-meta {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(89, 89, 89, 0.12);
}

.draft-summary-meta-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.draft-summary-id-chip {
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(89, 89, 89, 0.15);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.draft-summary-meta-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
}

.draft-meta-detail {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.draft-summary-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.draft-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.2rem;
    padding: 0.65rem 0.35rem;
    min-height: 4.25rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(89, 89, 89, 0.1);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 4px rgba(26, 26, 26, 0.04);
}

.draft-stat-num {
    font-family: var(--font-brand-heavy);
    font-size: clamp(1.35rem, 3.5vw, 1.75rem);
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--susanita-black);
    letter-spacing: -0.03em;
}

.draft-stat-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    line-height: 1.2;
}

.draft-stat-approved {
    border-color: rgba(22, 163, 74, 0.25);
    background: rgba(22, 163, 74, 0.06);
}

.draft-stat-approved .draft-stat-num {
    color: #15803d;
}

.draft-stat-rejected {
    border-color: rgba(220, 38, 38, 0.25);
    background: rgba(220, 38, 38, 0.05);
}

.draft-stat-rejected .draft-stat-num {
    color: #b91c1c;
}

.draft-stat-pending {
    border-color: rgba(217, 119, 6, 0.3);
    background: rgba(217, 119, 6, 0.06);
}

.draft-stat-pending .draft-stat-num {
    color: #b45309;
}

.draft-summary-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.35rem;
}

/* ─── Desglose tipo estado de cuenta ─── */
.draft-ledger {
    background: #fff;
    border: 1px solid rgba(89, 89, 89, 0.12);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(26, 26, 26, 0.04);
}

.draft-ledger-head {
    display: flex;
    align-items: center;
    padding: 0.55rem 1rem;
    background: var(--susanita-red);
}

.draft-ledger-head-title {
    font-family: var(--font-brand-heavy);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 1px 2px rgba(26, 26, 26, 0.15);
}

.draft-ledger-body {
    display: flex;
    flex-direction: column;
}

.draft-ledger-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem 1.25rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(89, 89, 89, 0.08);
}

.draft-ledger-copy {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.draft-ledger-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.draft-ledger-hint {
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.4;
}

.draft-ledger-value {
    font-family: var(--font-brand-heavy);
    font-size: 1rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    white-space: nowrap;
    text-align: right;
}

.draft-ledger-sign {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 4px;
    background: rgba(212, 21, 25, 0.1);
    color: var(--susanita-red);
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
}

.draft-ledger-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--susanita-yellow);
    color: var(--susanita-black);
    font-size: 0.7rem;
    font-weight: 800;
}

.draft-ledger-credits {
    background: rgba(248, 210, 9, 0.08);
    border-top: 1px solid rgba(248, 210, 9, 0.45);
    border-bottom: 1px solid rgba(248, 210, 9, 0.35);
}

.draft-ledger-row-credits {
    border-bottom: 1px dashed rgba(212, 21, 25, 0.18);
    background: rgba(255, 255, 255, 0.45);
}

.draft-ledger-row-credits .draft-ledger-label {
    color: #8a1013;
}

.draft-ledger-row-rejected {
    background: rgba(212, 21, 25, 0.04);
    border-bottom: 1px dashed rgba(212, 21, 25, 0.2);
}

.draft-ledger-row-rejected .draft-ledger-label {
    color: #8a1013;
}

.draft-ledger-value-rejected {
    color: var(--susanita-red);
    font-weight: 700;
}

.draft-card-rejected-hint {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.draft-ledger-value-minus {
    color: var(--susanita-red);
}

.draft-credits-cards {
    list-style: none;
    margin: 0 0.65rem 0.75rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.draft-credit-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    padding: 0.7rem 0.85rem;
    background: #fff;
    border: 1px solid rgba(248, 210, 9, 0.55);
    border-left: 3px solid var(--susanita-red);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 4px rgba(26, 26, 26, 0.04);
}

.draft-credit-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    flex: 1;
}

.draft-credit-card-vendor {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-primary);
    word-break: break-word;
}

.draft-credit-card-ref {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem;
    font-size: 0.76rem;
    line-height: 1.35;
}

.draft-credit-card-ref-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.draft-credit-card-ref-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    word-break: break-word;
}

.draft-credit-card-amount {
    flex-shrink: 0;
    font-size: 0.88rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--susanita-red);
    white-space: nowrap;
    text-align: right;
}

.draft-ledger-net {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem 1.25rem;
    padding: 0.85rem 1rem;
    background: rgba(248, 210, 9, 0.08);
    border-top: 2px solid var(--susanita-red);
}

.draft-ledger-net-copy {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.draft-ledger-net-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.draft-ledger-equation {
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.draft-ledger-net-value {
    font-family: var(--font-brand-heavy);
    font-size: 1.05rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--susanita-red);
    white-space: nowrap;
    text-align: right;
}

/* ─── Total a pagar ─── */
.draft-payable-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem 1.5rem;
    padding: 1rem 1.15rem;
    background: #fff;
    border: 2px solid var(--susanita-red);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 14px rgba(212, 21, 25, 0.12);
}

.draft-payable-copy {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.draft-payable-label {
    font-family: var(--font-brand-heavy);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--susanita-red);
}

.draft-payable-hint {
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.4;
    max-width: 26rem;
}

.draft-payable-equation {
    font-size: 0.88rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1.35;
}

.draft-payable-amount {
    font-family: var(--font-brand-heavy);
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--susanita-black);
    letter-spacing: -0.03em;
    white-space: nowrap;
    text-align: right;
    padding: 0.35rem 0.85rem;
    background: rgba(248, 210, 9, 0.25);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(248, 210, 9, 0.65);
}

/* Legacy grid — mantener por compatibilidad */
.draft-summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    align-items: flex-start;
}

.draft-summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 0 1 auto;
    min-width: 4.5rem;
}

.draft-summary-item-wide {
    flex: 1 1 100%;
    min-width: min(100%, 12rem);
}

.draft-summary-item-date {
    flex: 0 0 auto;
    min-width: 7.5rem;
}

.draft-review-summary .summary-label {
    font-size: clamp(0.68rem, 1.6vw, 0.78rem);
    color: var(--text-secondary);
    font-weight: 600;
    line-height: 1.2;
}

.draft-summary-value {
    font-size: clamp(0.82rem, 1.8vw, 0.92rem);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
}

.draft-summary-datetime,
.text-nowrap {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.draft-summary-id {
    font-size: clamp(0.72rem, 1.8vw, 0.88rem);
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
    line-height: 1.35;
}

.draft-summary-total-item {
    flex: 1 1 100%;
    width: 100%;
    margin-top: 0.15rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(89, 89, 89, 0.15);
}

.draft-summary-total {
    color: var(--susanita-black) !important;
    font-size: clamp(1.2rem, 3.5vw, 1.55rem) !important;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    text-align: right;
    margin-left: auto;
}

.draft-review-summary .draft-status {
    align-self: flex-start;
    font-size: clamp(0.68rem, 1.6vw, 0.78rem);
}

.draft-notes {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(89, 89, 89, 0.12);
    font-size: clamp(0.78rem, 2vw, 0.875rem);
    color: var(--text-secondary);
    line-height: 1.5;
}

.draft-review-layout {
    display: grid;
    grid-template-columns: minmax(340px, 400px) 1fr;
    gap: 1.25rem;
    align-items: stretch;
    min-height: calc(100vh - 340px);
}

.draft-invoices-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.draft-invoices-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    flex: 1;
    min-height: calc(100vh - 420px);
    max-height: calc(100vh - 420px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
}

.draft-invoice-item {
    text-align: left;
    width: 100%;
    padding: 0;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: #fff;
    transition: var(--transition);
    overflow: visible;
}

.draft-invoice-item:hover,
.draft-invoice-item.active {
    border-color: var(--susanita-red);
    background: rgba(248, 210, 9, 0.08);
}

.draft-invoice-item.draft-invoice-aprobado {
    border-left: 4px solid var(--process-sap);
    background: rgba(158, 197, 254, 0.08);
}

.draft-invoice-item.draft-invoice-rechazado {
    border-left: 4px solid var(--process-cancelled);
    background: rgba(254, 202, 202, 0.25);
    opacity: 0.96;
}

.draft-invoice-item.draft-invoice-pendiente {
    border-left: 4px solid var(--process-new);
    background: rgba(123, 201, 154, 0.06);
}

.draft-invoice-item.draft-invoice-staged-aprobado {
    border-left: 4px dashed var(--process-sap);
    background: rgba(158, 197, 254, 0.1);
}

.draft-invoice-item.draft-invoice-staged-rechazado {
    border-left: 4px dashed var(--process-cancelled);
    background: rgba(254, 202, 202, 0.2);
}

.draft-invoice-item.draft-invoice-credito {
    border-left: 4px solid #6366f1;
    background: rgba(99, 102, 241, 0.04);
}

.draft-invoice-item.draft-invoice-no-pdf {
    opacity: 0.96;
}

.draft-inv-no-pdf-tag {
    font-size: 0.68rem;
    font-weight: 700;
    color: #78716c;
    background: rgba(120, 113, 108, 0.12);
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
}

.inv-review-credito {
    background: rgba(99, 102, 241, 0.15);
    color: #4338ca;
}

.draft-invoice-review-staged {
    opacity: 0.95;
}

.inv-review-staged-aprobado {
    background: var(--process-sap);
    color: var(--process-sap-text);
    border: 1px dashed rgba(30, 58, 95, 0.25);
}

.inv-review-staged-rechazado {
    background: var(--process-cancelled);
    color: var(--process-cancelled-text);
    border: 1px dashed rgba(153, 27, 27, 0.2);
}

.draft-subtitle {
    font-size: 0.95rem;
    margin: 0 0 0.75rem;
    color: var(--text-primary);
}

.draft-invoices-panel-head {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.draft-invoices-panel-head .draft-subtitle {
    margin-bottom: 0;
}

.draft-invoices-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.82rem;
}

.draft-select-all-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
}

.draft-bulk-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}

.draft-bulk-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}

.btn-reactivate {
    background: #fff7ed;
    color: #c2410c;
    border: 1.5px solid #fb923c;
    font-weight: 600;
}

.btn-reactivate:hover {
    background: #ffedd5;
    border-color: #ea580c;
}

.draft-invoice-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 0;
}

.draft-invoice-view {
    flex: 1;
    min-width: 0;
    display: block;
    padding: 0.75rem 0.35rem 0.75rem 0.75rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.draft-invoice-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.65rem 0.5rem 0.15rem;
    flex-shrink: 0;
    align-self: center;
}

.inv-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    background: #fff;
    padding: 0;
    line-height: 0;
    flex-shrink: 0;
}

.inv-action-btn:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.inv-action-btn:active {
    transform: scale(0.94);
}

.inv-action-reject {
    color: #dc2626;
    border-color: #dc2626;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.inv-action-reject:hover {
    background: rgba(220, 38, 38, 0.1);
}

.inv-action-approve {
    color: #16a34a;
    border-color: #16a34a;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

.inv-action-approve:hover {
    background: rgba(22, 163, 74, 0.1);
}

.inv-action-reactivate {
    color: #d97706;
    border-color: #d97706;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.2);
}

.inv-action-reactivate:hover {
    background: rgba(217, 119, 6, 0.1);
}

.inv-action-undo {
    width: auto;
    min-width: 2.35rem;
    height: 2.35rem;
    padding: 0 0.65rem 0 0.45rem;
    border-radius: 999px;
    color: #d97706;
    border-color: #d97706;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.2);
    gap: 0.25rem;
}

.inv-action-undo:hover {
    background: rgba(217, 119, 6, 0.1);
}

.inv-action-label {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
}

.inv-action-btn:disabled,
.inv-action-btn[aria-disabled="true"] {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}

.inv-action-btn:disabled:hover,
.inv-action-btn[aria-disabled="true"]:hover {
    background: #fff;
    box-shadow: none;
    transform: none;
}

.inv-action-done {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
}

.inv-action-done-approve {
    color: #fff;
    background: #16a34a;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35);
}

.inv-action-done-reject {
    color: #fff;
    background: #dc2626;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

.draft-invoice-review {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.875rem 0.65rem;
    border-top: 1px solid rgba(89, 89, 89, 0.1);
    background: rgba(248, 248, 248, 0.6);
}

.inv-review-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.inv-review-pendiente {
    background: var(--process-new);
    color: var(--process-new-text);
}

.inv-review-aprobado {
    background: var(--process-sap);
    color: var(--process-sap-text);
}

.inv-review-rechazado {
    background: var(--process-cancelled);
    color: var(--process-cancelled-text);
}

.inv-review-note,
.draft-rejected-note {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-style: italic;
}

.draft-review-hint {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.hint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.8rem;
    vertical-align: middle;
    margin: 0 0.15rem;
}

.hint-reject {
    color: #dc2626;
    border: 2px solid #dc2626;
    background: #fff;
}

.hint-approve {
    color: #16a34a;
    border: 2px solid #16a34a;
    background: #fff;
}

.draft-rejected-section {
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    background: rgba(254, 202, 202, 0.45);
    border: 1px solid var(--process-cancelled);
}

.draft-rejected-title {
    color: var(--process-cancelled-text);
    margin-bottom: 0.35rem;
}

.draft-rejected-hint {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.draft-rejected-list {
    margin: 0;
    padding: 0;
    gap: 0.55rem;
}

.draft-rejected-list .draft-invoice-item {
    background: #fff;
}

.inv-count-approved {
    color: #15803d;
}

.inv-count-rejected {
    color: #b91c1c;
}

.draft-inv-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.25rem 0.5rem;
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
    line-height: 1.3;
}

.draft-inv-header strong {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.draft-inv-header span {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.draft-inv-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.15rem 0.5rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.draft-inv-ref {
    grid-column: 1 / -1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.draft-inv-amount strong {
    font-size: 0.78rem;
}

.draft-pdf-panel {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 360px);
}

.draft-pdf-viewer {
    flex: 1;
    width: 100%;
    min-height: calc(100vh - 420px);
    height: calc(100vh - 420px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: #f1f5f9;
}

.pdf-hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 2rem;
    text-align: center;
    border: 1px dashed var(--border-glass);
    border-radius: var(--radius-sm);
}

.draft-review-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.execution-progress {
    flex: 1 1 100%;
    width: 100%;
    margin: 0.35rem 0 0;
    padding: 0.55rem 0.75rem;
    font-size: 0.86rem;
    line-height: 1.4;
    color: #595959;
    background: rgba(248, 210, 9, 0.2);
    border: 1px solid rgba(248, 210, 9, 0.45);
    border-radius: 8px;
    text-align: center;
}

#btnReopenDraft {
    margin-right: auto;
}

.btn-download-vouchers {
    border-color: var(--susanita-red);
    color: var(--susanita-red);
}

.btn-download-vouchers:hover {
    background: rgba(212, 21, 25, 0.06);
}

.btn-reject {
    background: #fff;
    color: var(--susanita-red);
    border: 2px solid var(--susanita-red);
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    font-family: var(--font-brand-heavy);
}

.btn-reject:hover:not(:disabled) {
    background: var(--susanita-red);
    color: #fff;
}

.btn-reject:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Login — mismo estilo que formulario corporativo Susanita */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    padding: max(0.5rem, env(safe-area-inset-top)) 0.85rem max(0.5rem, env(safe-area-inset-bottom));
    overflow: hidden;
    box-sizing: border-box;
}

.login-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
    max-width: 420px;
    max-height: calc(100dvh - 1rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: 0 auto;
    flex-shrink: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-overlay[style*="display: none"] {
    display: none !important;
}

.login-bg {
    position: absolute;
    inset: 0;
    background:
        rgba(255, 255, 255, 0.6),
        url('assets/images/fondo-susanita.png') center center / cover no-repeat;
    filter: blur(6px);
    transform: none;
    pointer-events: none;
}

.login-card {
    position: relative;
    z-index: 1;
    background: var(--susanita-white);
    border-radius: 18px;
    padding: clamp(1.15rem, 3vh, 1.55rem) clamp(1.25rem, 3.5vw, 1.65rem) clamp(1rem, 2.5vh, 1.15rem);
    width: 100%;
    max-height: 100%;
    box-shadow: 0 14px 44px rgba(26, 26, 26, 0.18);
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.login-header {
    text-align: center;
    margin-bottom: clamp(0.85rem, 2.2vh, 1.1rem);
    flex-shrink: 0;
}

.login-logo-wrap {
    width: clamp(88px, 13dvh, 104px);
    height: clamp(88px, 13dvh, 104px);
    margin: 0 auto clamp(0.55rem, 1.5vh, 0.75rem);
    border-radius: 50%;
    background: var(--susanita-white);
    border: 3px solid var(--susanita-red);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(212, 21, 25, 0.15);
}

.login-logo {
    width: clamp(68px, 10dvh, 80px);
    height: auto;
    object-fit: contain;
}

.login-title {
    font-family: var(--font-brand-heavy);
    font-size: clamp(1.3rem, 3.2vh, 1.5rem);
    font-weight: 700;
    color: var(--susanita-black);
    margin: 0 0 0.3rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.login-subtitle {
    font-size: clamp(0.88rem, 2vh, 0.95rem);
    color: var(--text-muted);
    margin: 0;
    font-weight: 400;
    line-height: 1.4;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.login-field {
    margin-bottom: clamp(0.7rem, 1.8vh, 0.9rem);
}

.login-field:last-of-type {
    margin-bottom: 0;
}

.login-field label {
    display: block;
    font-family: var(--font-brand-heavy);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--susanita-black);
    margin-bottom: 0.4rem;
    text-align: left;
}

.login-input {
    width: 100%;
    box-sizing: border-box;
    padding: clamp(0.68rem, 1.8vh, 0.78rem) 0.95rem;
    font-family: var(--font-web-ui);
    font-size: 0.95rem;
    color: var(--susanita-black);
    background: #f5f5f5;
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.login-input::placeholder {
    color: #a8a8a8;
}

.login-input:hover {
    border-color: #d4d4d4;
}

.login-input:focus {
    border-color: var(--susanita-red);
    box-shadow: 0 0 0 3px rgba(212, 21, 25, 0.12);
    background: var(--susanita-white);
}

.login-card__footer {
    margin-top: clamp(0.85rem, 2vh, 1rem);
    padding-top: clamp(0.75rem, 1.8vh, 0.9rem);
    border-top: 1px solid rgba(89, 89, 89, 0.1);
    text-align: center;
    flex-shrink: 0;
}

.login-card__footer .app-footer-brand {
    margin-bottom: 0.35rem;
}

.login-card__footer .app-footer-logo {
    height: 24px;
    max-width: 72px;
}

.login-card__footer .app-footer-text {
    font-size: 0.74rem;
    line-height: 1.4;
    margin-bottom: 0.15rem;
    padding: 0;
}

.login-card__footer .app-footer-copy {
    font-size: 0.68rem;
}

.login-password-wrap {
    position: relative;
}

.login-password-wrap .login-input {
    padding-right: 2.75rem;
}

.login-toggle-pwd {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: transparent;
    border: none;
    padding: 0.35rem;
    min-width: 2rem;
    min-height: 2rem;
    cursor: pointer;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    border-radius: 6px;
}

.login-toggle-pwd:hover {
    color: var(--susanita-gray);
    background: rgba(0, 0, 0, 0.04);
}

.login-toggle-pwd svg {
    display: block;
    pointer-events: none;
}

.login-error {
    margin: 0 0 0.75rem;
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    line-height: 1.35;
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
}

.login-btn-submit {
    width: 100%;
    margin-top: clamp(0.85rem, 2vh, 1rem);
    padding: clamp(0.75rem, 1.9vh, 0.88rem) 1.35rem;
    font-family: var(--font-brand-heavy);
    font-size: 1rem;
    font-weight: 700;
    color: var(--susanita-white);
    background: var(--susanita-red);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.login-btn-submit:hover:not(:disabled) {
    background: var(--accent-hover);
}

.login-btn-submit:active:not(:disabled) {
    transform: scale(0.98);
}

.login-btn-submit:disabled {
    opacity: 0.7;
    cursor: wait;
}

.user-badge {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-glass);
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.8);
}

.admin-form-card {
    padding: 1.75rem 2rem;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.65);
}

.admin-section-title {
    margin: 0 0 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.admin-section-title-spaced {
    margin-top: 2rem;
}

.panel-body-admin {
    padding: 1.5rem 2rem 2rem;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-form-row {
    display: grid;
    gap: 1.25rem 1.75rem;
}

.admin-form-row-2 {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 720px) {
    .admin-form-row-2 {
        grid-template-columns: 1fr;
    }
    .admin-form-card,
    .panel-body-admin {
        padding: 1.25rem;
    }
}

.admin-form-actions {
    padding-top: 1.25rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border-glass);
}

.admin-form-actions .btn {
    min-width: 10rem;
}

.admin-table-wrap {
    margin-top: 0.5rem;
}

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

.form-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.form-control {
    width: 100%;
    min-width: 0;
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-primary);
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-red, #e30613);
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.12);
}

.form-field .input-textarea {
    width: 100%;
    box-sizing: border-box;
}

.info-hint,
.modal-hint {
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
}

.modal-body .form-field + .form-field {
    margin-top: 1rem;
}

select.input-search,
select.form-control {
    appearance: auto;
}

/* Responsive */
@media (max-width: 1024px) {
    .payment-summary {
        flex-direction: column;
        gap: 1.5rem;
        align-items: stretch;
    }
    .summary-info { justify-content: space-between; }
    .summary-actions { justify-content: stretch; }
    .summary-actions .btn { flex: 1; }
    .draft-summary-grid {
        gap: 0.45rem 0.85rem;
    }

    .draft-summary-item-wide,
    .draft-summary-item-date {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .draft-summary-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .draft-summary-stats .draft-stat-card:nth-child(4),
    .draft-summary-stats .draft-stat-card:nth-child(5) {
        grid-column: span 1;
    }

    .draft-summary-meta-details {
        grid-template-columns: 1fr;
    }

    .draft-review-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .draft-invoices-list {
        min-height: 280px;
        max-height: 320px;
    }

    .draft-pdf-panel {
        min-height: 420px;
    }

    .draft-pdf-viewer {
        min-height: 420px;
        height: 420px;
    }
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 0.85rem;
        padding: 0.85rem 1rem;
        text-align: center;
    }

    .header-left {
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: flex-start;
        text-align: left;
        gap: 0.75rem;
    }

    .header-titles h1,
    .app-header h1 {
        font-size: 1rem;
        line-height: 1.25;
    }

    .header-subtitle {
        font-size: 0.75rem;
        display: none;
    }

    .brand-logo {
        height: 3rem;
        max-height: 48px;
    }

    .app-logo {
        padding: 0;
    }

    .header-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .user-badge {
        width: 100%;
        text-align: center;
        font-size: 0.75rem;
    }

    .btn-header {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 0;
        justify-content: center;
        padding: 0.65rem 0.5rem;
        font-size: 0.78rem;
    }

    .session-warning {
        margin: 0.75rem 1rem 0;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .session-warning .btn {
        width: 100%;
    }

    .app-footer {
        padding: 0 1rem 1.25rem;
    }

    .app-footer-inner {
        padding: 1.15rem 1.25rem 1.25rem;
    }

    .step-wizard {
        flex-direction: column;
        gap: 0.5rem;
    }

    .step {
        padding: 0.75rem 1rem;
    }

    .step-label {
        font-size: 0.82rem;
    }

    .panel-header {
        padding: 1rem 1.15rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .panel-header h2 {
        font-size: 1rem;
        flex: 1 1 100%;
        order: 2;
    }

    .panel-header .badge {
        margin-left: 0;
        order: 3;
    }

    .panel-header .btn-back-header {
        order: 1;
        width: 100%;
        text-align: center;
    }

    .panel-body {
        padding: 1.15rem 1rem 0;
    }

    .panel-actions {
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 1rem;
        flex-direction: column;
    }

    .panel-actions .btn,
    .panel-actions-split .btn {
        width: 100%;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .btn {
        width: 100%;
    }

    .input-search {
        min-width: 0;
        width: 100%;
    }

    .search-bar {
        width: 100%;
    }

    .table-container {
        margin: 0 -0.25rem;
        border-radius: var(--radius-sm);
        -webkit-overflow-scrolling: touch;
    }

    .data-table th,
    .data-table td {
        padding: 0.65rem 0.5rem;
        font-size: 0.78rem;
    }

    #invoiceTable th,
    #invoiceTable td {
        padding: 0.45rem 0.3rem;
        font-size: 0.72rem;
    }

    #invoiceTable thead th {
        font-size: 0.55rem;
        padding: 0.35rem 0.08rem;
    }

    #invoiceTable thead .th-label {
        min-height: 2.1em;
    }

    .data-table th {
        font-size: 0.68rem;
    }

    .payment-summary {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
        padding: 1rem;
        border-radius: var(--radius-md);
        flex-direction: column;
        gap: 1rem;
        max-height: 70vh;
        overflow-y: auto;
    }

    .summary-info {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .summary-actions {
        flex-direction: column;
        width: 100%;
    }

    .summary-actions .btn {
        width: 100%;
    }

    .btn-pay {
        width: 100%;
        font-size: 1rem;
        padding: 0.85rem 1.25rem;
    }

    .draft-filters {
        flex-direction: column;
    }

    .draft-filters .btn {
        width: 100%;
    }

    .draft-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .draft-card-btn {
        width: 100%;
    }

    .modal {
        width: calc(100% - 1.5rem);
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .app-container {
        padding: 0.85rem 1rem 0.5rem;
        padding-bottom: 5rem;
    }

    .panel {
        border-radius: var(--radius-md);
    }

    .filter-bar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 480px) {
    .header-left {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .header-titles h1,
    .app-header h1 {
        font-size: 0.95rem;
    }

    .btn-header {
        flex: 1 1 100%;
    }

    .draft-summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .draft-stat-num {
        font-size: 1.25rem;
    }

    .draft-payable-bar {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .draft-payable-amount,
    .draft-summary-total {
        width: 100%;
        text-align: center;
    }

    .draft-ledger-row,
    .draft-ledger-net {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .draft-ledger-value,
    .draft-ledger-net-value {
        text-align: left;
    }

    .draft-credit-card {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .draft-credit-card-amount {
        margin-left: auto;
    }
}

/* ─── Asignaciones PDF ───────────────────────────────────── */
.pdf-assignments-list {
    display: grid;
    gap: 0.85rem;
}

.pdf-assignment-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 12px;
    background: #fff;
}

.pdf-assignment-card-title {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
}

.pdf-assignment-card-meta,
.pdf-assignment-card-counts,
.pdf-assignment-card-notes {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted, #595959);
}

.pdf-pending-count {
    color: var(--brand-red, #D41519);
    font-weight: 600;
}

.pdf-assignment-detail-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pdf-assignment-detail-header h3 {
    margin: 0;
    font-size: 1rem;
}

.pdf-status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pdf-status-badge--ok {
    background: #e8f7ee;
    color: #1f7a3f;
}

.pdf-status-badge--pending {
    background: #fff4d6;
    color: #8a6400;
}

.pdf-pending-label {
    font-size: 0.8rem;
    color: var(--text-muted, #595959);
    font-style: italic;
}

.pdf-upload--inline {
    display: inline-flex;
}

.pdf-queue-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pdf-gestor-status {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f0f0f0;
    color: #595959;
}

.pdf-gestor-status--pendiente_revision {
    background: #fff4d6;
    color: #8a6400;
}

.pdf-gestor-status--aprobado {
    background: #e8f7ee;
    color: #1f7a3f;
}

.pdf-gestor-status--rechazado {
    background: #fde8e8;
    color: #b42318;
}

.pdf-gestor-status--enviado_aprobacion {
    background: #e8f0ff;
    color: #1d4ed8;
}

.pdf-assignment-actions {
    margin-top: 1.25rem;
    padding: 1rem 1.1rem;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    background: #fafafa;
}

.pdf-assignment-actions-hint {
    margin: 0 0 0.75rem;
    color: #595959;
    font-size: 0.92rem;
}

.pdf-assignment-actions-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pdf-assignment-gestor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.pdf-assignment-docs-table-wrap {
    overflow-x: auto;
}

.modal-wide {
    max-width: min(920px, 96vw);
    width: 100%;
}

.add-assignment-vendors-panel {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color, #e8e8e8);
}

.add-assignment-vendors-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: flex-end;
    margin-bottom: 0.5rem;
}

.add-assignment-vendors-toolbar .input-search {
    flex: 1 1 220px;
    min-width: 180px;
}

.add-assignment-date-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: flex-end;
}

.add-assignment-date-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.8rem;
    color: #595959;
}

.add-assignment-vendors-count {
    margin: 0.35rem 0 0.5rem;
    font-size: 0.85rem;
    color: #595959;
}

.add-assignment-vendors-list {
    max-height: 140px;
    overflow: auto;
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    background: #fafafa;
}

.add-assignment-vendor-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.3rem 0.15rem;
    font-size: 0.88rem;
    cursor: pointer;
}

.add-assignment-vendor-item:hover {
    background: rgba(212, 21, 25, 0.04);
    border-radius: 4px;
}

.add-assignment-vendors-empty {
    margin: 0.5rem 0;
    font-size: 0.88rem;
    color: #888;
}

.add-assignment-docs-section {
    margin-top: 0.75rem;
}

.add-assignment-docs-heading {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #595959;
}

.home-module-icon--pdf-review {
    color: #1f7a3f;
}

.admin-actions-cell {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.assign-pdf-list {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.9rem;
}

.form-field-check {
    margin-top: 0.5rem;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
}

.field-optional {
    font-weight: 400;
    color: var(--text-muted, #888);
    font-size: 0.82rem;
}

.password-field-wrap {
    position: relative;
}

.password-field-wrap .form-control {
    padding-right: 2.75rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: transparent;
    border: none;
    padding: 0.35rem;
    min-width: 2rem;
    min-height: 2rem;
    cursor: pointer;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    border-radius: 6px;
}

.password-toggle-btn:hover {
    color: var(--susanita-red, #D41519);
    background: rgba(212, 21, 25, 0.06);
}
