* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f4f6;
  color: #111827;
  font-size: 14px;
}
header {
  background: #111827;
  color: #f9fafb;
  padding: 12px 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
header h1 {
  margin: 0;
  font-size: 20px;
}
header p {
  margin: 2px 0 0;
  font-size: 13px;
  opacity: 0.8;
}
.tabs {
  max-width: 1100px;
  margin: 10px auto 0;
  padding: 0 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tab-button {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  background: #e5e7eb;
  color: #111827;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab-button.active {
  background: #2563eb;
  color: #f9fafb;
}
.tab-button span.icon {
  font-size: 15px;
}
main {
  max-width: 1100px;
  margin: 10px auto 20px;
  padding: 0 12px 24px;
}
.card {
  background: #ffffff;
  border-radius: 8px;
  padding: 16px 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}
.card small {
  color: #6b7280;
  font-size: 13px;
}
label {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  color: #374151;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  margin-bottom: 10px;
  transition: background 0.15s, border-color 0.15s;
  background: #f9fafb;
}
input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37,99,235,0.2);
  background: #ffffff;
}

input[type="date"],
input[type="time"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  margin-bottom: 10px;
  background: #f9fafb;
}
input[type="date"]:focus,
input[type="time"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37,99,235,0.2);
  background: #ffffff;
}
textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  margin-bottom: 10px;
  resize: vertical;
  background: #f9fafb;
}
textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37,99,235,0.2);
  background: #ffffff;
}
select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  margin-bottom: 10px;
  background: #f9fafb;
}
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37,99,235,0.2);
  background: #ffffff;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.col {
  flex: 1 1 200px;
  min-width: 0;
}
button {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}
button.primary {
  background: #2563eb;
  color: #f9fafb;
}
button.primary:hover {
  background: #1d4ed8;
}
button.secondary {
  background: #e5e7eb;
  color: #111827;
}
button.secondary:hover {
  background: #d1d5db;
}
.message {
  margin-top: 8px;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  display: inline-block;
}
.message.success {
  background: #dcfce7;
  color: #166534;
}
.message.error {
  background: #fee2e2;
  color: #991b1b;
}
.hint {
  font-size: 12px;
  margin-top: -4px;
  margin-bottom: 8px;
}
.hint.existing { color: #166534; }
.hint.new { color: #6b21a8; }
.hint.similar-title { color: #4b5563; margin-top: 4px; }
.similar-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.similar-pill {
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 2px 8px;
  font-size: 12px;
  background: #f9fafb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.similar-pill span.count {
  font-size: 11px;
  color: #6b7280;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead { background: #f9fafb; }
th, td {
  padding: 8px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: middle;
  line-height: 1.4;
}
th {
  font-weight: 600;
  font-size: 13px;
  color: #6b7280;
  text-transform: uppercase;
}
td.num { text-align: center; }
.table-container {
  height: 220px;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}
.table-container thead th {
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 2;
}
.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
}
.badge.highlight {
  background: #dbeafe;
  color: #1d4ed8;
}
.filter-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  flex-wrap: wrap;
}
.filter-row input {
  max-width: 260px;
  margin-bottom: 0;
}
a.link-btn {
  font-size: 12px;
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  display: inline-block;
}
a.link-btn:hover {
  background: #bfdbfe;
}
.chip-button {
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 4px 10px;
  font-size: 12px;
  background: #f9fafb;
  cursor: pointer;
  margin-right: 4px;
  margin-bottom: 4px;
}
.chip-button.active {
  background: #2563eb;
  color: #f9fafb;
  border-color: #1d4ed8;
}
.chip-button:hover {
  background: #e5e7eb;
}
.inline-product-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inline-product-row input[type="text"] {
  margin-bottom: 0;
  flex: 1;
}
.inline-new-toggle {
  font-size: 12px;
  white-space: nowrap;
}
.quick-sellers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.quick-seller-btn {
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 2px 8px;
  font-size: 12px;
  background: #f9fafb;
  cursor: pointer;
}
.quick-seller-btn:hover {
  background: #e5e7eb;
}
th.sortable {
  cursor: pointer;
  white-space: nowrap;
}
.sort-indicator {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.6;
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal-overlay.active {
  display: flex;
}
.modal {
  background: #ffffff;
  border-radius: 8px;
  padding: 16px 18px 18px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.modal h3 {
  margin: 0 0 10px;
  font-size: 16px;
}
.modal small {
  font-size: 12px;
  color: #6b7280;
}
.modal-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.mood-bad { color: #ef4444; font-size: 18px; }
.mood-low { color: #f97316; font-size: 18px; }
.mood-mid { color: #2563eb; font-size: 18px; }
.mood-high { color: #16a34a; font-size: 18px; }
.week-bad { color: #9ca3af; font-size: 14px; }
.week-low { color: #f97316; font-size: 14px; }
.week-mid { color: #2563eb; font-size: 14px; }
.week-high { color: #16a34a; font-size: 14px; }
.freq-low { color: #6b7280; font-size: 12px; }
.freq-mid { color: #2563eb; font-size: 12px; }
.freq-high { color: #f97316; font-size: 12px; }
.freq-very-high { color: #16a34a; font-size: 12px; font-weight: 600; }
.input-duplicate {
  border-color: #b91c1c !important;
  background: #fef2f2 !important;
}
.input-new {
  border-color: #16a34a !important;
  background: #ecfdf5 !important;
}
.summary-highlight { background: #fef3c7; }
.summary-highlight td:first-child { font-weight: 600; }
.state-select {
  width: 100%;
  max-width: 170px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
}
.chart-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
}
.chart-card {
  flex: 1 1 220px;
  min-width: 220px;
}
.pie-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.pie {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: #e5e7eb;
  position: relative;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.05);
}
.pie-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  text-align: center;
  color: #111827;
  background: #f9fafb;
  border-radius: 999px;
  padding: 4px 8px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.05);
}
.pie-legend div {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 4px;
}
.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.legend-new { background: #2563eb; }
.legend-exist { background: #10b981; }
.legend-disc { background: #9ca3af; }

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}
.bar-label { width: 90px; }
.bar-outer {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}
.bar-inner {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s;
}
.bar-value {
  width: 30px;
  text-align: right;
  font-size: 12px;
  color: #374151;
}

.event-type-label { white-space: nowrap; }

.priority-badge {
  font-size: 14px;
}
.priority-normal { color: #16a34a; }
.priority-media { color: #eab308; }
.priority-alta { color: #f97316; }
.priority-critica { color: #dc2626; }

/* Iconos de prioridad junto a Título */
.event-priority-icons {
  display: flex;
  align-items: center;
  gap: 4px;
}
.priority-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 2px;
  opacity: 0.6;
}
.priority-icon-btn.active {
  opacity: 1;
  transform: scale(1.05);
}

@media (max-width: 640px) {
  header h1 { font-size: 18px; }
  .row { flex-direction: column; }
  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-row input { max-width: 100%; }
  .chart-grid { flex-direction: column; }
}
