* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.login-box img {
    max-width: 100%;
    height: auto;
}

.login-box h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2em;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #5568d3;
}

.error-msg {
    color: #e74c3c;
    margin-top: 10px;
    font-size: 14px;
}

/* Panel Page */
.panel-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    padding: 20px 0;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-header img {
    max-width: 100%;
    height: auto;
    filter: brightness(1.2);
}

.sidebar-header h2 {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 0.9em;
    color: #95a5a6;
}

.menu {
    list-style: none;
    padding: 20px 0;
}

.menu li {
    padding: 15px 20px;
    cursor: pointer;
    transition: background 0.3s;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.menu li:hover {
    background: #34495e;
}

.menu li.active {
    background: #667eea;
}

.logout-btn {
    margin: 20px;
    width: calc(100% - 40px);
    background: #e74c3c;
}

.logout-btn:hover {
    background: #c0392b;
}

.content {
    flex: 1;
    padding: 30px;
    background: #ecf0f1;
}

.content-header {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.content-header h1 {
    color: #2c3e50;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card h2 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 10px;
    transition: background 0.3s;
}

.btn:hover {
    background: #5568d3;
}

.btn-success {
    background: #27ae60;
}

.btn-success:hover {
    background: #229954;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
}

.btn-warning:hover {
    background: #e67e22;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
}

table tr:hover {
    background: #f8f9fa;
}

.action-btn {
    padding: 5px 10px;
    margin: 0 5px;
    font-size: 12px;
    width: auto;
}

.venta-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.venta-form .form-group {
    margin-bottom: 0;
}

.venta-form .full-width {
    grid-column: 1 / -1;
}

.venta-summary {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
}

.venta-summary h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.venta-items {
    margin-bottom: 15px;
}

.venta-item {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    background: white;
    margin-bottom: 5px;
    border-radius: 3px;
}

.venta-total {
    font-size: 1.5em;
    font-weight: bold;
    color: #27ae60;
    text-align: right;
}

/* Print Styles */
@media print {
    @page {
        size: Letter portrait;
        margin: 8mm;
    }

    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    body * {
        visibility: hidden;
    }
    
    .print-area,
    .print-area * {
        visibility: visible;
    }
    
    .print-area {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .print-area img {
        visibility: visible;
        display: block !important;
    }

    .nota-remision {
        max-width: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 14px !important;
        border: 1px solid #333 !important;
        font-size: 12px !important;
        line-height: 1.3 !important;
        box-sizing: border-box;
        max-height: calc(100vh - 16mm);
        overflow: hidden;
        page-break-inside: avoid;
        break-inside: avoid-page;
    }

    .nota-header {
        padding-bottom: 10px !important;
        margin-bottom: 10px !important;
    }

    .nota-header img {
        height: 80px !important;
        width: auto !important;
    }

    .nota-header h2 {
        margin-top: 10px !important;
        font-size: 17px !important;
    }

    .nota-info {
        gap: 12px !important;
        margin-bottom: 10px !important;
    }

    .nota-table {
        margin: 10px 0 !important;
    }

    .nota-table th,
    .nota-table td {
        padding: 6px 8px !important;
        font-size: 11px !important;
    }

    .nota-pagare {
        margin-top: 12px !important;
        border: 1px solid #333;
        border-radius: 4px;
        padding: 10px !important;
    }

    .nota-pagare-titulo {
        text-align: center;
        margin: 0 0 8px 0 !important;
        font-size: 13px !important;
    }

    .nota-pagare-texto {
        line-height: 1.3 !important;
        margin-bottom: 8px !important;
        text-align: justify;
        font-size: 11px !important;
    }

    .nota-pagare-linea {
        margin-bottom: 5px !important;
        font-size: 11px !important;
    }

    .nota-footer {
        margin-top: 12px !important;
        gap: 24px !important;
    }

    .firma-line {
        margin-top: 28px !important;
        padding-top: 4px !important;
        border-top: 1px solid #333 !important;
    }

    .nota-remision p {
        margin: 3px 0 !important;
    }
}

.nota-remision {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    background: white;
    border: 2px solid #333;
}

.nota-header {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.nota-header img {
    max-width: 100%;
    height: auto;
}

.nota-header h1 {
    font-size: 2em;
    margin-bottom: 5px;
    color: #4a6741;
}

.nota-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.nota-table {
    margin: 20px 0;
}

.nota-table table {
    width: 100%;
    border: 1px solid #333;
}

.nota-table th,
.nota-table td {
    border: 1px solid #333;
    padding: 10px;
}

.nota-footer {
    margin-top: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
}

.nota-pagare {
    margin-top: 20px;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 15px;
}

.nota-pagare-titulo {
    text-align: center;
    margin-bottom: 12px;
}

.nota-pagare-texto {
    line-height: 1.5;
    margin-bottom: 10px;
    text-align: justify;
}

.nota-pagare-linea {
    margin-bottom: 6px;
}

.firma-section {
    text-align: center;
}

.firma-line {
    border-top: 2px solid #333;
    margin-top: 60px;
    padding-top: 10px;
}

.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #95a5a6;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card h3 {
    color: #95a5a6;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}
