/* Histórico de lançamentos — Saulo 2026-05-27
   ============================================
   Identidade visual herda dos tokens M3 (tokens.css). Mobile-first com
   top app bar + filterbar scrollável + lista cronológica reversa
   agrupada por dia. Desktop ganha breadcrumb + header amplo + lista
   centralizada.
*/

/* ─── Shell ───────────────────────────────────────────────────── */
.hist-shell {
  flex: 1; min-width: 0;
  background: var(--background);
  display: flex; flex-direction: column;
  overflow-x: hidden;
}
.hist-mobile { display: none; }
.hist-desktop { display: block; }

@media (max-width: 760px) {
  .hist-mobile {
    display: flex; flex-direction: column;
    min-height: 100dvh;
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
  }
  .hist-desktop { display: none; }
}

/* ─── Desktop ─────────────────────────────────────────────────── */
.hist-d-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 32px 64px;
  width: 100%;
}
.hist-d-breadcrumb {
  font: 400 12px/1 'Inter';
  color: var(--on-surface-variant);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.hist-d-breadcrumb a {
  color: var(--on-surface-variant); text-decoration: none;
}
.hist-d-breadcrumb a:hover { color: var(--on-surface); }
.hist-d-breadcrumb .sep { opacity: 0.4; }
.hist-d-breadcrumb .current { color: var(--on-surface); font-weight: 500; }
.hist-d-title {
  font: 600 28px/1.1 'Inter Tight';
  letter-spacing: -0.01em;
  color: var(--on-surface);
  margin: 0 0 6px;
}
.hist-d-sub {
  font: 400 13px/1.4 'Inter';
  color: var(--on-surface-variant);
  margin: 0 0 24px;
}
.hist-d-list { background: transparent; }

/* ─── Mobile top app bar ──────────────────────────────────────── */
.hist-m-topbar {
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0)) 12px 8px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--outline-variant);
  flex-shrink: 0;
}
.hist-m-topbar-icon {
  width: 40px; height: 40px;
  border: 0; background: transparent; color: var(--on-surface);
  display: grid; place-items: center;
  border-radius: 999px; cursor: pointer; padding: 0;
  text-decoration: none;
}
.hist-m-topbar-icon:hover { background: var(--surface-container-low); }
.hist-m-topbar-icon .msym { font-size: 22px; }
.hist-m-topbar-titles { flex: 1; min-width: 0; }
.hist-m-topbar-title {
  font: 600 17px/1.2 'Inter Tight';
  color: var(--on-surface);
  letter-spacing: -0.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hist-m-topbar-sub {
  font: 400 11px/1 'Inter';
  color: var(--on-surface-variant);
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ─── Filterbar (chips) ───────────────────────────────────────── */
.hist-filters {
  display: flex; gap: 8px;
  padding: 14px 0 16px;
}
@media (max-width: 760px) {
  .hist-filters {
    padding: 10px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-padding-inline: 12px;
  }
  .hist-filters::-webkit-scrollbar { display: none; }
  .hist-filters > * { flex-shrink: 0; }
}
.hist-chip-wrap { position: relative; }
.hist-chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--outline-variant);
  background: var(--surface);
  border-radius: 999px;
  font: 500 13px 'Inter';
  color: var(--on-surface);
  cursor: pointer;
  transition: border-color var(--motion-fast), background var(--motion-fast);
}
.hist-chip:hover { background: var(--surface-container-low); }
.hist-chip.is-active {
  background: var(--primary-container);
  color: var(--on-primary-container);
  border-color: var(--primary);
}
.hist-chip .msym { font-size: 16px; opacity: 0.7; }
.hist-chip-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  z-index: 20;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.hist-chip-opt {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  border: 0; background: transparent;
  border-radius: 8px;
  font: 400 13px 'Inter';
  color: var(--on-surface);
  cursor: pointer;
  text-align: left;
}
.hist-chip-opt:hover { background: var(--surface-container-low); }
.hist-chip-opt.on {
  background: var(--primary-container);
  color: var(--on-primary-container);
}
.hist-chip-opt .msym { font-size: 16px; }

/* ─── Lista ───────────────────────────────────────────────────── */
.hist-day { margin-bottom: 20px; }
.hist-day-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0 6px;
}
.hist-day-label {
  font: 600 11px/1 'Inter';
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}
.hist-day-count {
  font: 400 11px/1 'Inter';
  color: var(--on-surface-variant);
}
.hist-day-items {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: 14px;
  overflow: hidden;
}
@media (max-width: 760px) {
  .hist-day { margin: 0 0 16px; padding: 0 12px; }
  .hist-day-head { padding: 14px 4px 6px; }
  .hist-day-items { border-radius: 12px; }
}

.hist-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--outline-variant);
}
.hist-row:last-child { border-bottom: 0; }
.hist-row-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--on-surface-variant);
  flex-shrink: 0;
}
.hist-row-icon .msym { font-size: 18px; }
.hist-row-icon.tone-success {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}
.hist-row-icon.tone-danger {
  background: color-mix(in srgb, var(--error) 14%, transparent);
  color: var(--error);
}
.hist-row-icon.tone-warn {
  background: color-mix(in srgb, var(--tertiary) 14%, transparent);
  color: var(--tertiary);
}

.hist-row-body { flex: 1; min-width: 0; }
.hist-row-line1 {
  font: 400 13.5px/1.4 'Inter';
  color: var(--on-surface);
}
.hist-row-actor { font-weight: 600; }
.hist-row-action.tone-success { color: var(--success); font-weight: 500; }
.hist-row-action.tone-danger  { color: var(--error);   font-weight: 500; }
.hist-row-action.tone-warn    { color: var(--tertiary); font-weight: 500; }
.hist-row-action.tone-neutral { color: var(--on-surface-variant); font-weight: 500; }
.hist-row-entity {
  color: var(--on-surface-variant);
}
.hist-row-desc {
  color: var(--on-surface);
}
.hist-row-line2 {
  display: flex; align-items: center; gap: 10px;
  margin-top: 4px;
  font: 400 12px/1 'Inter';
  color: var(--on-surface-variant);
}
.hist-row-amount {
  font: 600 13px/1 'Inter Tight';
  font-feature-settings: 'tnum';
  letter-spacing: -0.005em;
}
.hist-row-amount.tone-success { color: var(--success); }
.hist-row-amount.tone-danger  { color: var(--error); }
.hist-row-amount.tone-warn    { color: var(--tertiary); }
.hist-row-amount.tone-neutral { color: var(--on-surface); }
.hist-row-time { font-feature-settings: 'tnum'; }

/* ─── Estado vazio + load more ────────────────────────────────── */
.hist-empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--on-surface-variant);
  font: 400 13px/1.5 'Inter';
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.hist-empty .msym { font-size: 32px; opacity: 0.5; }
.hist-empty-title { font: 600 15px/1.3 'Inter'; color: var(--on-surface); margin-top: 4px; }
.hist-empty-sub   { color: var(--on-surface-variant); }
.hist-empty-spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--outline-variant);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: hist-spin 700ms linear infinite;
}
@keyframes hist-spin { to { transform: rotate(360deg); } }

.hist-load-more {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0;
  gap: 12px;
}
@media (max-width: 760px) {
  .hist-load-more { padding: 16px 12px 24px; }
}
.hist-load-meta {
  font: 400 12px/1 'Inter';
  color: var(--on-surface-variant);
}
.hist-btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--outline-variant);
  background: var(--surface);
  color: var(--on-surface);
  font: 500 13px 'Inter';
  cursor: pointer;
}
.hist-btn:hover { background: var(--surface-container-low); }
.hist-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
