@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
    --ink-950: #0B1220;
    --ink-900: #0D1628;
    --ink-800: #111E36;
    --ink-700: #182742;

    --blue: #2563EB;
    --blue-600: #1D4ED8;
    --blue-700: #1E40AF;
    --sky: #0EA5E9;

    --success: #16A34A;
    --danger: #DC2626;

    --white: #FFFFFF;
    --surface: #F4F6FA;
    --line: #E3E8F0;
    --text: #1C2635;
    --muted: #5B6472;

    --grad-primary: linear-gradient(135deg, #2563EB, #1D4ED8 70%, #1E40AF);
    --grad-navy: linear-gradient(160deg, #0B1220 0%, #111E36 55%, #182742 100%);

    --radius: 14px;
    --radius-sm: 9px;
    --shadow-card: 0 6px 18px rgba(11, 18, 32, 0.08);
    --shadow-float: 0 14px 34px rgba(11, 18, 32, 0.18);
    --transition: 0.25s ease;
}

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

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--surface);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    font-family: 'Poppins', 'Inter', sans-serif;
    line-height: 1.2;
    color: var(--ink-900);
}

/* ------------------------------------------------------------
   HEADER (estilo hero del tema VicPy)
------------------------------------------------------------ */
.app-header {
    position: relative;
    color: #fff;
    border-radius: var(--radius);
    margin-bottom: 22px;
    padding: 34px 28px 30px;
    background: var(--grad-navy);
    box-shadow: 0 14px 34px rgba(11, 18, 32, 0.28);
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 22px;
}

.app-header::before {
    content: '';
    position: absolute;
    top: -160px;
    right: -120px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.4), transparent 62%);
    pointer-events: none;
}

.app-header::after {
    content: '';
    position: absolute;
    bottom: -200px;
    left: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.25), transparent 60%);
    pointer-events: none;
}

.app-header__logo {
    position: relative;
    z-index: 2;
    width: 74px;
    height: 74px;
    border-radius: 18px;
    overflow: hidden;
    background: var(--white);
    box-shadow: 0 10px 26px rgba(11, 18, 32, 0.4);
    flex-shrink: 0;
}

.app-header__logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-header__titles {
    position: relative;
    z-index: 2;
}

.app-header__titles h1 {
    font-size: 1.7rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.app-header__titles .subtitle {
    font-size: 1em;
    opacity: 0.82;
    margin-top: 2px;
}

@media (max-width: 768px) {
    .app-header {
        padding: 22px 18px 24px;
        gap: 14px;
    }

    .app-header__logo {
        width: 56px;
        height: 56px;
        border-radius: 14px;
    }

    .app-header__titles h1 {
        font-size: 1.2rem;
    }
}

header {
    background: var(--grad-navy);
    color: #fff;
    border-radius: var(--radius);
    padding: 30px 20px;
    position: relative;
    overflow: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 25px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* ------------------------------------------------------------
   TABS (navegación estilo VicPy)
------------------------------------------------------------ */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 20px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 6px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--line);
}

.tab-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 12px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 14px;
    position: relative;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.tab-btn .icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

/* Iconos en cajas de color (estilo card__icon del tema VicPy) */
.tab-ic, .sc-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    flex-shrink: 0;
}

.tab-ic .icon {
    width: 15px;
    height: 15px;
}

.sc-ic .icon {
    width: 16px;
    height: 16px;
}

.bc-cyan   { background: rgba(14, 165, 233, 0.12);  color: var(--blue-600); }
.bc-teal   { background: rgba(16, 185, 129, 0.12);  color: #047857; }
.bc-violet { background: rgba(99, 102, 241, 0.12);  color: #4338CA; }
.bc-orange { background: rgba(245, 158, 11, 0.14);  color: #B45309; }

.tab-btn.active .tab-ic,
.scope-btn.active .sc-ic {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.tab-btn:hover {
    background: #EFF3FB;
    color: var(--blue-600);
}

.tab-btn.active {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: 0 5px 16px rgba(37, 99, 235, 0.4);
}

.tab-content {
    display: none;
    background: var(--white);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--line);
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

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

/* ------------------------------------------------------------
   FORMULARIOS
------------------------------------------------------------ */
.form-section h2, .list-section h2, .summary-section h2, .monthly-section h2, .categories-section h2 {
    color: var(--ink-900);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--line);
    padding-bottom: 10px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

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

.form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.form-row label {
    min-width: 80px;
    font-weight: 600;
    color: var(--muted);
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--muted);
    font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--line);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.25s ease;
    background: #fff;
    color: var(--text);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ------------------------------------------------------------
   BOTONES (estilo VicPy)
------------------------------------------------------------ */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Poppins', 'Inter', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
    white-space: nowrap;
}

.btn .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.34);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.28);
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #16A34A);
    color: #fff;
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(22, 163, 74, 0.38);
}

.btn-small {
    padding: 7px 16px;
    font-size: 13px;
    border-radius: 8px;
    min-width: 40px;
}

/* ------------------------------------------------------------
   FILTROS Y SELECTORES
------------------------------------------------------------ */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
}

.filters select, .year-selector select, .ym-selector select {
    padding: 9px 14px;
    border: 2px solid var(--line);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    transition: all 0.25s ease;
}

.filters select:focus, .year-selector select:focus, .ym-selector select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ------------------------------------------------------------
   TABLAS
------------------------------------------------------------ */
.table-container {
    overflow-x: auto;
    margin-top: 15px;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: 0 2px 10px rgba(11, 18, 32, 0.05);
}

.expenses-table, .summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.expenses-table th, .summary-table th {
    background: var(--grad-primary);
    color: #fff;
    padding: 13px;
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.expenses-table th:first-child, .summary-table th:first-child {
    border-top-left-radius: 12px;
}

.expenses-table th:last-child, .summary-table th:last-child {
    border-top-right-radius: 12px;
}

.expenses-table td, .summary-table td {
    padding: 11px 13px;
    border-bottom: 1px solid #f1f5f9;
}

.expenses-table tbody tr {
    transition: background 0.2s ease;
}

.expenses-table tbody tr:nth-child(even) {
    background: #F8FAFD;
}

.expenses-table tbody tr:hover {
    background: #EFF3FB;
}

.expenses-table .category-cell {
    font-weight: 600;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    font-style: italic;
}

/* ------------------------------------------------------------
   BADGES
------------------------------------------------------------ */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.3px;
}

.badge-income {
    background: linear-gradient(135deg, #10b981, #059669);
}

.badge-expense {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
}

.year-selector, .ym-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.year-selector label, .ym-selector label {
    font-weight: 600;
    color: var(--muted);
}

.ym-selector {
    flex-wrap: wrap;
}

.ym-selector .form-row {
    margin: 0;
}

/* ------------------------------------------------------------
   TARJETAS (resumen, estilo card del tema)
------------------------------------------------------------ */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 25px;
}

.card {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 18px;
    text-align: center;
    box-shadow: var(--shadow-card);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 18px;
    right: 18px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--grad-primary);
    opacity: 0;
    transition: opacity var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: var(--shadow-float);
}

.card:hover::before {
    opacity: 1;
}

.card .label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.card .value {
    font-size: 1.6em;
    font-weight: 800;
    color: var(--ink-900);
}

.card .currency {
    font-size: 0.9em;
    color: var(--blue-600);
}

.chart-container {
    margin: 20px 0;
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--line);
    box-shadow: 0 2px 8px rgba(11, 18, 32, 0.04);
}

/* ------------------------------------------------------------
   MODALES
------------------------------------------------------------ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 18, 32, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.modal.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: var(--radius);
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 60px rgba(11, 18, 32, 0.3);
    animation: modalSlide 0.3s ease;
}

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

.close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    cursor: pointer;
    color: var(--muted);
    transition: color 0.2s;
    line-height: 1;
}

.close:hover {
    color: var(--danger);
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--muted);
    font-size: 14px;
}

/* ------------------------------------------------------------
   LOGIN (estilo hero del tema VicPy)
------------------------------------------------------------ */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--grad-navy);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    top: -180px;
    right: -160px;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.45), transparent 62%);
    pointer-events: none;
}

.login-screen::after {
    content: '';
    position: absolute;
    bottom: -220px;
    left: -180px;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.28), transparent 60%);
    pointer-events: none;
}

.login-box {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 18px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    text-align: center;
    position: relative;
    z-index: 2;
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    overflow: hidden;
    margin: 0 auto 14px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(11, 18, 32, 0.3);
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.login-box h1 {
    color: var(--ink-900);
    margin-bottom: 5px;
    font-weight: 700;
    font-size: 1.5rem;
}

.login-box .subtitle {
    color: var(--muted);
    margin-bottom: 25px;
    opacity: 1;
}

.login-box .form-group {
    text-align: left;
}

.login-box .btn-block {
    width: 100%;
    margin-top: 10px;
}

.login-error {
    color: var(--danger);
    margin-top: 15px;
    font-size: 14px;
    min-height: 20px;
}

/* ------------------------------------------------------------
   USER BAR Y SCOPE
------------------------------------------------------------ */
.user-bar {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2;
}

.user-bar span {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.user-bar .btn-small {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-bar .btn-small:hover {
    background: rgba(255, 255, 255, 0.3);
}

.scope-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.scope-btn {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--line);
    background: #fff;
    border-radius: 12px;
    font-weight: 600;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: 15px;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(11, 18, 32, 0.05);
}

.scope-btn .icon {
    width: 18px;
    height: 18px;
}

.scope-btn:hover {
    border-color: var(--blue);
    color: var(--blue-600);
}

.scope-btn.active {
    background: var(--grad-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 5px 16px rgba(37, 99, 235, 0.4);
}

/* ------------------------------------------------------------
   RESPONSIVE
------------------------------------------------------------ */
@media (max-width: 768px) {
    body {
        -webkit-tap-highlight-color: transparent;
    }

    .container {
        padding: 12px;
    }

    header {
        padding: 20px 15px 55px;
        border-radius: 12px;
    }

    header h1 {
        font-size: 1.6em;
    }

    .subtitle {
        font-size: 0.95em;
    }

    .user-bar {
        position: static;
        justify-content: center;
        margin-top: 12px;
        flex-wrap: wrap;
    }

    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 8px;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex: 0 0 auto;
        min-width: auto;
        padding: 12px 18px;
        font-size: 13px;
        white-space: nowrap;
    }

    .tab-content {
        padding: 16px;
        border-radius: 12px;
    }

    .scope-bar {
        gap: 8px;
    }

    .scope-btn {
        padding: 13px 10px;
        font-size: 14px;
        min-height: 44px;
    }

    .btn {
        min-height: 44px;
    }

    .btn-small {
        min-height: 38px;
    }

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

    .filters select {
        width: 100%;
    }

    .year-selector, .ym-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .ym-selector .form-row {
        width: 100%;
    }

    .ym-selector .form-row select {
        flex: 1;
        width: 100%;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row label {
        min-width: 0;
    }

    .expenses-table, .summary-table {
        font-size: 13px;
    }

    .expenses-table th, .summary-table th {
        padding: 10px 8px;
    }

    .expenses-table td, .summary-table td {
        padding: 9px 8px;
    }

    .card {
        padding: 16px 12px;
    }

    .card .value {
        font-size: 1.3em;
    }

    .summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }

    .modal-content {
        margin: 10px;
        padding: 20px;
        max-width: none;
        width: auto;
    }

    .login-box {
        padding: 30px 20px;
    }

    .login-box h1 {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .tab-btn {
        padding: 11px 14px;
        font-size: 12px;
    }

    .expenses-table th:nth-child(2),
    .expenses-table td:nth-child(2),
    .expenses-table th:nth-child(4),
    .expenses-table td:nth-child(4) {
        display: none;
    }
}

/* Iconos SVG */
.icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ------------------------------------------------------------
   FACTURAS Y DNIT
------------------------------------------------------------ */
.sub-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.sub-tab-btn {
    padding: 9px 18px;
    border: 2px solid var(--line);
    background: #fff;
    border-radius: 10px;
    font-weight: 600;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.sub-tab-btn .icon {
    width: 16px;
    height: 16px;
}

.sub-tab-btn:hover {
    border-color: var(--blue);
    color: var(--blue-600);
}

.sub-tab-btn.active {
    background: var(--grad-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.subtab {
    display: none;
}

.subtab.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 18px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}

.checkbox-inline input {
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
    cursor: pointer;
}

.report-section {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #F8FAFD;
}

.report-section h3 {
    color: var(--ink-900);
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 1.05em;
}

.venc-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #fef3c7;
    color: #92400e;
}

.invoice-detail dl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px 18px;
    margin: 15px 0;
}

.invoice-detail dt {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 600;
}

.invoice-detail dd {
    font-weight: 600;
    color: var(--ink-900);
    margin: 0;
}

.preview-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 8px;
    background: #F8FAFD;
    flex-wrap: wrap;
}

.preview-row.selected {
    border-color: var(--success);
    background: #ecfdf5;
}

.preview-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
    cursor: pointer;
}

/* Formulario de factura: secciones y búsqueda de RUC */
.form-section-title {
    width: 100%;
    font-size: 13px;
    font-weight: 700;
    color: var(--blue-600);
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 6px 0 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--line);
    display: block;
}

.ruc-search {
    display: flex;
    gap: 6px;
    width: 100%;
}

.ruc-search input {
    flex: 1;
    min-width: 0;
}

.ruc-search-btn {
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.ruc-search-btn:disabled {
    opacity: .7;
    cursor: wait;
}

.ruc-status {
    display: block;
    font-size: 11px;
    margin-top: 5px;
    color: var(--muted);
    min-height: 14px;
}

.ruc-status.loading {
    color: #f59e0b;
}

.ruc-status.ok {
    color: var(--success);
}

.ruc-status.error {
    color: var(--danger);
}

.ruc-required {
    color: var(--danger);
}

.inv-desc {
    font-size: 11px;
    color: var(--muted);
    font-weight: 400;
    margin-top: 2px;
    max-width: 260px;
    white-space: normal;
}

.payee-edit-hint {
    font-size: 12px;
    font-weight: 600;
    color: var(--blue-600);
    background: #EFF3FB;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    padding: 4px 12px;
}

/* ------------------------------------------------------------
   TALONARIO DE FACTURA (impresión) — modelo estándar PY
   (sin cambios, es el formato de impresión talonario)
------------------------------------------------------------ */
.talonario {
    border: 2px solid #0f172a;
    padding: 22px 24px;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #fff;
    color: #0f172a;
    font-size: 13px;
    line-height: 1.45;
}

.tal-copia {
    background: #fef3c7;
    color: #92400e;
    border: 1px dashed #d97706;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 14px;
    text-align: center;
}

.tal-vendedor {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 18px;
    border-bottom: 3px double #0f172a;
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.tal-vend-izq { text-align: left; flex: 1; }

.tal-fantasia {
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 2px;
}

.tal-razon {
    font-size: 17px;
    font-weight: 800;
    text-transform: uppercase;
}

.tal-rubro { font-size: 12.5px; color: #334155; font-weight: 600; margin-top: 2px; }

.tal-line { font-size: 12.5px; color: #334155; margin-top: 2px; }

.tal-ruc { font-weight: 800; margin-top: 4px; }

.tal-vend-der {
    text-align: center;
    border: 3px double #0f172a;
    border-radius: 8px;
    padding: 8px 18px;
    min-width: 235px;
}

.tal-titulo { font-size: 21px; font-weight: 900; letter-spacing: 2px; }

.tal-numero { font-size: 12px; font-weight: 700; margin-top: 1px; }

.tal-numero-grande { font-size: 14px; font-weight: 800; margin-top: 2px; border-top: 1px solid #94a3b8; border-bottom: 1px solid #94a3b8; padding: 2px 0; }

.tal-cond {
    display: flex;
    gap: 30px;
    margin-bottom: 8px;
    font-size: 12.5px;
}

.tal-subrayado {
    border-bottom: 1px solid #0f172a;
    padding: 0 6px;
    min-width: 40px;
    display: inline-block;
}

.tal-cliente {
    border: 1.5px solid #0f172a;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

.tal-cj-titulo { font-weight: 800; font-size: 12px; border-bottom: 1px solid #94a3b8; margin-bottom: 6px; padding-bottom: 3px; }

.tal-cliente-fila { font-size: 12.5px; margin-top: 3px; }

.tal-items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 12.5px;
}

.tal-items th, .tal-items td {
    border: 1px solid #94a3b8;
    padding: 6px 8px;
    text-align: left;
}

.tal-items th { background: #f1f5f9; font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; }

.tal-num { text-align: right !important; }

.tal-liquidacion {
    display: flex;
    gap: 22px;
    font-size: 12.5px;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    padding: 6px 12px;
    margin-bottom: 12px;
}

.tal-totales { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 14px; }

.tal-total-izq { flex: 1; font-size: 12.5px; }

.tal-subtotal-linea { display: flex; justify-content: space-between; max-width: 320px; padding: 1px 0; }

.tal-nota { margin-top: 6px; font-size: 12px; color: #334155; }

.tal-total-pagar {
    border: 3px double #0f172a;
    border-radius: 8px;
    padding: 8px 20px;
    text-align: center;
    min-width: 210px;
}

.tal-tp-label { font-size: 12px; font-weight: 700; }

.tal-tp-monto { font-size: 21px; font-weight: 900; }

.tal-pie {
    display: flex;
    gap: 24px;
    align-items: center;
    border-top: 1px solid #94a3b8;
    padding-top: 10px;
    font-size: 12px;
}

.tal-pie-caja {
    border: 1.5px solid #0f172a;
    border-radius: 6px;
    padding: 5px 12px;
}

.tal-pie-emitida { margin-left: auto; color: #64748b; font-size: 11px; }

.print-listado { font-family: 'Segoe UI', Arial, sans-serif; }

.print-listado h2 { margin: 0 0 4px; }

.print-sub { color: #64748b; font-size: 12.5px; margin: 0 0 12px; }

.print-listado table { width: 100%; border-collapse: collapse; font-size: 12px; }

.print-listado th, .print-listado td { border: 1px solid #cbd5e1; padding: 5px 7px; text-align: left; }

.print-listado th { background: #f1f5f9; }

.print-listado tfoot td { border-top: 2px solid #334155; }

@media print {
    body * { visibility: hidden; }
    #print-area, #print-area * { visibility: visible; }
    #print-area { position: absolute; left: 0; top: 0; width: 100%; padding: 0; }
    #print-modal { display: flex !important; background: #fff !important; overflow: visible !important; }
    #print-modal .modal-content {
        width: 100%;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    #print-modal h3, #print-btn, #print-modal-close, #print-modal-cancel { display: none !important; }
    .modal { background: #fff !important; }
    @page { margin: 12mm; }
}