* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; color: #333; line-height: 1.5; }

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

.navbar { background: #2F5496; color: #fff; padding: 10px 0; margin-bottom: 20px; position: sticky; top: 0; z-index: 10; }
.navbar .container { display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 18px; font-weight: 700; color: #fff; text-decoration: none; }
.nav-links { display: flex; gap: 12px; }
.nav-links a { color: #fff; text-decoration: none; font-size: 15px; padding: 8px 16px; border-radius: 6px; font-weight: 500; }
.nav-links a:hover { background: rgba(255,255,255,0.15); }

.flash { padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.toolbar { margin-bottom: 16px; }
.search-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-input { flex: 1; min-width: 200px; padding: 8px 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; }
.filter-select { padding: 8px 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; background: #fff; }

.btn { display: inline-block; padding: 8px 16px; border: 1px solid #ccc; border-radius: 6px; background: #fff; color: #333; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn-primary { background: #2F5496; color: #fff; border-color: #2F5496; }
.btn-danger { background: #dc3545; color: #fff; border-color: #dc3545; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link { background: transparent; border: none; color: #2F5496; padding: 8px 0; }

.table-container { overflow-x: auto; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
table { width: 100%; border-collapse: collapse; }
th { background: #f8f9fa; text-align: left; padding: 10px 12px; font-size: 12px; text-transform: uppercase; color: #666; border-bottom: 2px solid #dee2e6; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 13px; }
tr:hover { background: #f5f7fa; }
.day-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; background: #e8f0fe; color: #1a73e8; }
.obs-cell { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #888; font-style: italic; }
.actions { white-space: nowrap; }
.actions form { display: inline; }
.empty { text-align: center; padding: 40px 16px; color: #999; }
.count { margin-top: 8px; font-size: 13px; color: #888; }

.inline-form { display: inline; }

.form-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 24px; max-width: 700px; }
.form-card h2 { margin-bottom: 20px; font-size: 18px; color: #2F5496; }
.form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.form-row .form-group { flex: 1; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #555; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; }
.form-group textarea { resize: vertical; font-family: inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #2F5496; box-shadow: 0 0 0 2px rgba(47,84,150,0.15); }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }

/* ── Ventas Dashboard ──────────────────────────── */

.meta-hero { background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); padding: 28px; text-align: center; margin-bottom: 20px; }
.meta-hero .number { font-size: 38px; font-weight: 800; color: #2F5496; line-height: 1.1; }
.meta-hero .number.sold { color: #28a745; }
.meta-hero .number.negative { color: #dc3545; }
.meta-hero .label { font-size: 12px; text-transform: uppercase; color: #999; letter-spacing: 0.5px; margin-top: -2px; }
.meta-hero .divider { width: 60px; height: 2px; background: #dee2e6; margin: 14px auto; }
.meta-hero .restante { margin-top: 10px; font-size: 15px; color: #666; }
.meta-hero .restante strong { color: #dc3545; }

.dashboard-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.dh-left { display: flex; align-items: center; gap: 12px; }
.dh-left h2 { margin: 0; font-size: 20px; color: #2F5496; }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-label { font-size: 16px; font-weight: 600; min-width: 120px; text-align: center; }
.dh-right { display: flex; gap: 8px; flex-wrap: wrap; }

.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 16px; }
.card-label { font-size: 11px; text-transform: uppercase; color: #888; font-weight: 600; }
.card-value { font-size: 22px; font-weight: 700; margin: 4px 0; }
.card-meta { font-size: 12px; color: #999; margin-bottom: 8px; }

.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 20px; background: #e9ecef; border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 10px; transition: width 0.4s; }
.progress-red { background: #dc3545; }
.progress-yellow { background: #ffc107; }
.progress-green { background: #28a745; }
.progress-text { font-size: 12px; font-weight: 700; min-width: 36px; text-align: right; }
.text-red { color: #dc3545; }
.text-yellow { color: #d39e00; }
.text-green { color: #28a745; }

.top-card { margin-bottom: 16px; }
.top-card h3 { font-size: 15px; margin-bottom: 10px; color: #2F5496; }
.top-table { width: 100%; border-collapse: collapse; }
.top-table td { padding: 6px 8px; border-bottom: 1px solid #eee; font-size: 13px; }
.top-pos { width: 28px; font-weight: 700; color: #2F5496; }
.top-name { }
.top-val { text-align: right; font-weight: 600; }
.top-table tr:last-child td { border-bottom: none; }

tfoot th { background: #f0f2f5; font-size: 13px; }

@media (max-width: 600px) {
  .form-row { flex-direction: column; gap: 0; }
  .search-form { flex-direction: column; align-items: stretch; }
  .nav-links { flex-wrap: wrap; }
  .dashboard-header { flex-direction: column; align-items: start; }
  .summary-cards { grid-template-columns: 1fr; }
}
