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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
}

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #e94560;
}

.empresa-info {
    padding: 0.75rem 1.5rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.nav-menu { list-style: none; padding: 1rem 0; flex: 1; }

.nav-menu li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.nav-menu li a:hover, .nav-menu li a.active {
    background: rgba(233,69,96,0.2);
    color: white;
    border-right: 3px solid #e94560;
}

.nav-menu li a i { width: 20px; text-align: center; }

.ambiente-badge {
    margin: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.ambiente-badge.prueba { background: rgba(59,130,246,0.2); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.ambiente-badge.produccion { background: rgba(34,197,94,0.2); color: #86efac; border: 1px solid rgba(34,197,94,0.3); }

.main-content { margin-left: 240px; flex: 1; padding: 2rem; min-height: 100vh; }

.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; color: #1a1a2e; display: flex; align-items: center; gap: 0.5rem; }
.page-header h1 i { color: #e94560; }
.page-header p { color: #666; margin-top: 0.25rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }

.stat-card { background: white; border-radius: 12px; padding: 1.5rem; display: flex; align-items: center; gap: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.stat-icon { width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: white; }
.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-icon.green { background: linear-gradient(135deg, #22c55e, #15803d); }
.stat-icon.orange { background: linear-gradient(135deg, #f97316, #c2410c); }

.stat-info h3 { font-size: 1.75rem; font-weight: 700; color: #1a1a2e; }
.stat-info p { font-size: 0.85rem; color: #666; }

.quick-actions { margin-bottom: 2rem; }
.quick-actions h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; color: #444; }

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

.action-card {
    background: white; border-radius: 12px; padding: 1.5rem;
    display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
    text-decoration: none; color: #1a1a2e; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s; text-align: center; font-size: 0.9rem; font-weight: 500;
}
.action-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); color: #e94560; }
.action-card i { font-size: 2rem; color: #e94560; }

.dte-table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.dte-table th { background: #f8f9fa; padding: 0.875rem 1rem; text-align: left; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #666; border-bottom: 1px solid #e5e7eb; }
.dte-table td { padding: 0.875rem 1rem; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; vertical-align: middle; }
.dte-table tr:hover { background: #fafafa; }
.dte-table tr:last-child td { border-bottom: none; }
.dte-table code { font-size: 0.8rem; background: #f1f5f9; padding: 0.2rem 0.4rem; border-radius: 4px; }
.row-anulado { opacity: 0.6; }
.table-footer { padding: 0.75rem 1rem; font-size: 0.85rem; color: #666; }

.badge { display: inline-block; padding: 0.25rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #dc2626; }

.form-card { background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); overflow: hidden; }
.form-section { padding: 1.5rem 2rem; border-bottom: 1px solid #f0f0f0; }
.form-section:last-child { border-bottom: none; }
.form-section h2 { font-size: 1rem; font-weight: 600; color: #1a1a2e; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.5rem; }
.form-section h2 i { color: #e94560; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: #444; }

.form-control { padding: 0.625rem 0.875rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.9rem; transition: border-color 0.2s; outline: none; width: 100%; }
.form-control:focus { border-color: #e94560; box-shadow: 0 0 0 3px rgba(233,69,96,0.1); }
textarea.form-control { resize: vertical; }

.checkbox-group { flex-direction: row; align-items: center; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; }
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; }

.totales-preview { background: #f8f9fa; border-radius: 8px; padding: 1rem; margin-top: 1rem; max-width: 300px; margin-left: auto; }
.total-row { display: flex; justify-content: space-between; padding: 0.25rem 0; font-size: 0.9rem; color: #666; }
.total-final { border-top: 1px solid #d1d5db; margin-top: 0.5rem; padding-top: 0.5rem; font-weight: 700; color: #1a1a2e; font-size: 1rem; }

.form-actions { padding: 1.5rem 2rem; display: flex; gap: 1rem; background: #f8f9fa; border-top: 1px solid #f0f0f0; }

.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1.25rem; border-radius: 8px; font-size: 0.9rem; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: #e94560; color: white; }
.btn-primary:hover:not(:disabled) { background: #c73652; }
.btn-secondary { background: #6b7280; color: white; }
.btn-secondary:hover:not(:disabled) { background: #4b5563; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-icon { width: 32px; height: 32px; border-radius: 6px; border: 1px solid #d1d5db; background: white; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: #6b7280; transition: all 0.2s; text-decoration: none; }
.btn-icon:hover { background: #f3f4f6; color: #1a1a2e; }
.btn-icon-danger:hover { background: #fee2e2; color: #dc2626; border-color: #dc2626; }
.action-buttons { display: flex; gap: 0.375rem; }

.alert { display: flex; align-items: flex-start; gap: 0.75rem; padding: 1rem 1.25rem; border-radius: 10px; margin-bottom: 1.5rem; font-size: 0.9rem; }
.alert i { font-size: 1.25rem; margin-top: 0.1rem; flex-shrink: 0; }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; }
.alert-error { background: #fef2f2; border: 1px solid #fca5a5; color: #dc2626; }

.filters-bar { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; padding: 0.625rem 0.875rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.9rem; outline: none; }
.search-input:focus { border-color: #e94560; }
.filter-select { width: auto; min-width: 160px; }

.empty-state { text-align: center; padding: 4rem 2rem; background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.empty-state i { font-size: 4rem; color: #d1d5db; margin-bottom: 1rem; }
.empty-state p { color: #666; margin-bottom: 1.5rem; }

.loading { text-align: center; padding: 3rem; color: #666; font-size: 1.1rem; }
.loading i { margin-right: 0.5rem; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal { background: white; border-radius: 12px; width: 100%; max-width: 700px; max-height: 80vh; display: flex; flex-direction: column; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid #f0f0f0; }
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-header button { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: #666; }
.modal-header button:hover { color: #1a1a2e; }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-body pre { background: #f8f9fa; padding: 1rem; border-radius: 8px; font-size: 0.8rem; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid #f0f0f0; display: flex; justify-content: flex-end; }

.dte-preview { background: #fafafa; }
.dte-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; background: white; border-radius: 10px; padding: 1.25rem; border: 1px solid #e5e7eb; }
.info-item { display: flex; flex-direction: column; gap: 0.25rem; }
.info-item label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: #9ca3af; letter-spacing: 0.05em; }
.info-item span, .info-item small { font-size: 0.9rem; color: #1a1a2e; }

.input-with-button { display: flex; gap: 0.5rem; }
.input-with-button .form-control { flex: 1; }

.text-muted { color: #9ca3af !important; font-size: 0.8rem; }

#blazor-error-ui { background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2); display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-240px); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr; }
}
