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

*, *::before, *::after { box-sizing: border-box; }

body { font-family: 'Inter', system-ui, sans-serif; }

/* Navigation */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px;
  color: #94a3b8; font-size: 14px; font-weight: 500;
  text-decoration: none; transition: all 0.15s;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: #2563eb; color: #fff; }
.nav-section { font-size: 11px; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: 0.08em; padding: 12px 12px 4px; }

/* Form controls */
.form-input {
  width: 100%; padding: 9px 12px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 14px; color: #111827;
  background: #fff; transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.form-input:disabled { background: #f9fafb; color: #6b7280; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 36px; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 5px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s; border: none; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-secondary { background: #f1f5f9; color: #374151; border: 1px solid #e2e8f0; }
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover:not(:disabled) { background: #b45309; }
.btn-ghost { background: transparent; color: #6b7280; }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; color: #374151; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-icon { padding: 7px; border-radius: 7px; }

/* Cards */
.card { background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.card-header { padding: 16px 20px; border-bottom: 1px solid #f3f4f6; display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 20px; }

/* Stat cards */
.stat-card { background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; padding: 20px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 11px 16px; text-align: left; font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; background: #f9fafb; border-bottom: 1px solid #e5e7eb; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f3f4f6; color: #374151; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9fafb; }
.data-table .actions { display: flex; gap: 4px; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-orange { background: #ffedd5; color: #9a3412; }

/* Status badges */
.status-borrador { background: #f1f5f9; color: #475569; }
.status-presentada { background: #dbeafe; color: #1d4ed8; }
.status-aceptada { background: #dcfce7; color: #15803d; }
.status-rechazada { background: #fee2e2; color: #b91c1c; }
.status-pendiente { background: #fef9c3; color: #854d0e; }
.status-en-progreso { background: #dbeafe; color: #1d4ed8; }
.status-completada { background: #dcfce7; color: #15803d; }
.status-planificacion { background: #f3e8ff; color: #7e22ce; }
.status-ejecucion { background: #dbeafe; color: #1d4ed8; }
.status-finalizado { background: #dcfce7; color: #15803d; }
.status-pausado { background: #ffedd5; color: #9a3412; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px); }
.modal-box { background: #fff; border-radius: 16px; box-shadow: 0 25px 50px rgba(0,0,0,0.25); width: 100%; max-height: 90vh; overflow-y: auto; }

/* Toasts */
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.15); pointer-events: all; min-width: 280px; max-width: 400px; }
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-warning { background: #d97706; }
.toast-info { background: #2563eb; }

/* Tabs */
.tab-btn { padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; color: #6b7280; cursor: pointer; transition: all 0.15s; border: none; background: transparent; }
.tab-btn.active { background: #2563eb; color: #fff; }
.tab-btn:hover:not(.active) { background: #f1f5f9; color: #374151; }

/* Progress */
.progress-bar { height: 6px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: #2563eb; transition: width 0.3s; }

/* File upload */
.file-drop { border: 2px dashed #d1d5db; border-radius: 10px; padding: 32px; text-align: center; cursor: pointer; transition: all 0.2s; }
.file-drop:hover, .file-drop.dragover { border-color: #3b82f6; background: #eff6ff; }

/* Kanban task cards */
.task-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px; margin-bottom: 10px; cursor: pointer; transition: box-shadow 0.15s; }
.task-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.task-card.estado-pendiente { border-left: 3px solid #fbbf24; }
.task-card.estado-en-progreso { border-left: 3px solid #3b82f6; }
.task-card.estado-completada { border-left: 3px solid #22c55e; }

/* Collapsible sections */
.collapsible-header { display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 12px 0; }
.collapsible-header .arrow { transition: transform 0.2s; }
.collapsible-header.open .arrow { transform: rotate(180deg); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Loading */
.spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
.spinner-dark { border: 2px solid #e5e7eb; border-top-color: #2563eb; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state svg { margin: 0 auto 16px; color: #9ca3af; }

/* View transitions */
.view-content { animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 768px) {
  #app-shell aside { transform: translateX(-100%); transition: transform 0.3s; }
  #app-shell aside.open { transform: translateX(0); }
  #app-shell main { margin-left: 0 !important; }
}

/* Print */
@media print {
  aside, header, .no-print { display: none !important; }
  main { margin-left: 0 !important; }
}

/* Tooltips */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; padding: 4px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 100; margin-bottom: 4px; }

/* Grid helpers */
.grid-cols-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* Quote item tree */
.quote-category { border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.quote-category-header { padding: 12px 16px; background: #f8fafc; font-weight: 600; color: #1e293b; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.quote-subcategory { padding: 8px 16px; border-top: 1px solid #f1f5f9; }
.quote-subcategory-header { font-weight: 500; color: #374151; font-size: 13px; padding: 6px 0; }
.quote-item-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; transition: background 0.1s; }
.quote-item-row:hover { background: #f8fafc; }
.quote-item-row label { flex: 1; font-size: 13px; color: #4b5563; cursor: pointer; }
.quote-item-row .item-price { font-size: 12px; font-weight: 500; color: #6b7280; min-width: 80px; text-align: right; }

/* Change request */
.change-card { border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; margin-bottom: 12px; }
.change-card.pendiente { border-left: 3px solid #fbbf24; }
.change-card.aprobado { border-left: 3px solid #22c55e; }
.change-card.rechazado { border-left: 3px solid #ef4444; }

/* Document grid */
.doc-card { border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px; text-align: center; cursor: pointer; transition: all 0.15s; }
.doc-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-color: #93c5fd; }
.doc-icon { font-size: 32px; margin-bottom: 8px; }

/* Summary/report */
.report-section { margin-bottom: 24px; }
.report-section h3 { font-size: 16px; font-weight: 600; color: #1e293b; padding-bottom: 8px; border-bottom: 2px solid #e5e7eb; margin-bottom: 16px; }
