/* ---------- HISTÓRICO ---------- */
.history-summary { margin-bottom: 14px; }
.history-last-value { font-size: 15px !important; line-height: 1.3; }
.history-filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 150px 150px minmax(220px, 1.5fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.history-filters .field { margin: 0; min-width: 0; }
.history-clear { white-space: nowrap; }
.history-results { margin: 0 2px 14px; color: var(--text-faint); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.history-day { margin-bottom: 22px; }
.history-day-heading { display: flex; align-items: center; gap: 8px; margin: 0 0 10px 23px; color: var(--text-dim); font-size: 12px; font-weight: 700; text-transform: capitalize; }
.history-day-heading small { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 10px; }
.history-timeline { position: relative; }
.history-timeline::before { content: ''; position: absolute; top: 10px; bottom: 10px; left: 7px; width: 2px; background: var(--border); }
.history-entry { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 14px; margin-bottom: 10px; }
.history-marker { position: relative; z-index: 1; width: 16px; height: 16px; margin-top: 19px; border: 4px solid var(--bg); border-radius: 50%; background: var(--text-faint); box-shadow: 0 0 0 1px var(--border); }
.history-marker.history-action-success { background: var(--success); }
.history-marker.history-action-danger { background: var(--danger); }
.history-marker.history-action-warning { background: var(--secondary); }
.history-entry-body { min-width: 0; padding: 15px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); box-shadow: var(--shadow-sm); }
.history-entry-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.history-entry-top h3 { margin: 7px 0 0; font-family: var(--font-body); font-size: 14px; line-height: 1.4; }
.history-entry-top time { flex: 0 0 auto; color: var(--text-faint); font-size: 10px; }
.history-entry-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.history-module, .history-action { display: inline-flex; align-items: center; min-height: 21px; padding: 2px 8px; border-radius: 999px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .045em; }
.history-module { background: var(--accent-soft); color: var(--accent-strong); }
.history-action-neutral { background: var(--bg-elevated); color: var(--text-dim); }
.history-action-success { background: var(--success-soft); color: var(--success); }
.history-action-danger { background: var(--danger-soft); color: var(--danger); }
.history-action-warning { background: var(--secondary-soft); color: var(--secondary-text); }
.history-meta { display: flex; align-items: center; gap: 7px; margin-top: 11px; color: var(--text-faint); font-size: 10px; }
.history-meta strong { color: var(--text-dim); font-weight: 600; }
.history-avatar { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: white; font-size: 10px; font-weight: 700; }
.history-details { margin-top: 12px; border-top: 1px solid var(--border); }
.history-details summary { padding-top: 11px; color: var(--accent-strong); cursor: pointer; font-size: 11px; font-weight: 600; }
.history-changes { display: grid; gap: 7px; margin-top: 10px; }
.history-change { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(0, 1fr) 18px minmax(0, 1fr); gap: 8px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--bg-elevated); font-size: 10px; }
.history-change strong { color: var(--text-dim); }
.history-before { color: var(--danger); text-decoration: line-through; overflow-wrap: anywhere; }
.history-after { color: var(--success); overflow-wrap: anywhere; }
.history-arrow { color: var(--text-faint); text-align: center; }
.history-load-more { display: flex; justify-content: center; margin: 4px auto 24px; }

@media (max-width: 1180px) {
  .history-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .history-search { grid-column: span 2; }
}

@media (max-width: 760px) {
  .history-page-header { align-items: stretch; }
  .history-page-header .btn { width: 100%; justify-content: center; }
  .history-filters { grid-template-columns: 1fr 1fr; padding: 12px; }
  .history-filters .field:nth-child(3), .history-search, .history-clear { grid-column: 1 / -1; }
  .history-entry { gap: 9px; }
  .history-entry-body { padding: 13px; }
  .history-entry-top { display: block; }
  .history-entry-top time { display: block; margin-top: 8px; }
  .history-change { grid-template-columns: 1fr 18px 1fr; }
  .history-change strong { grid-column: 1 / -1; }
}

@media (max-width: 390px) {
  .history-filters { grid-template-columns: 1fr; }
  .history-filters .field, .history-filters .field:nth-child(3), .history-search, .history-clear { grid-column: 1; }
  .history-day-heading { margin-left: 18px; }
  .history-entry { grid-template-columns: 12px minmax(0, 1fr); gap: 7px; }
  .history-marker { width: 12px; height: 12px; border-width: 3px; }
  .history-timeline::before { left: 5px; }
  .history-entry-badges { align-items: flex-start; }
}
