/* Histórico (owner request, 18 Oct 2026): header button #hist-button with its "new since last opening" badge, and the
   #hist-dialog modal (desktop: centred 640px card with an internally scrolling list; phones ≤780px: full-screen sheet).
   Same language as the PriceLabs/channel dialogs (.base-price-head, imoveis-pricing.css) and the calendar cards
   (calendar-dnd.css .cal-hover, channel-prices.css .cp-*). Scoped to body.rm-admin; theme tokens (--rm-*) so the RM and
   VJ skins both apply. No style attributes anywhere (the page CSP forbids them): state is classes + [hidden] only. */

/* ---- Header button + badge ---- */
body.rm-admin .hist-button { position: relative; flex-shrink: 0; }
body.rm-admin .hist-badge { position: absolute; top: -6px; right: -6px; z-index: 1; display: inline-grid; place-items: center; box-sizing: border-box; min-width: 19px; height: 19px; padding: 0 5px;
  border: 2px solid #fff; border-radius: 999px; background: var(--rm-accent, #d2aa61); color: var(--navy, #0b1c32); font-size: 10px; font-weight: 800; line-height: 1; letter-spacing: 0; font-variant-numeric: tabular-nums; pointer-events: none; }
body.rm-admin .hist-badge.is-wide { font-size: 9.5px; }
body.rm-admin .hist-badge[hidden] { display: none; }
@media (max-width: 780px) { body.rm-admin .hist-badge { top: -5px; right: -5px; border-color: var(--rm-body, #f7f7f9); } }

/* ---- Dialog shell ---- */
body.rm-admin .hist-dialog { box-sizing: border-box; width: min(640px, calc(100vw - 28px)); max-width: none; max-height: min(80vh, 840px); margin: auto; padding: 0; overflow: hidden;
  border: 1px solid #e1e6ee; border-radius: 16px; background: #fff; color: #526174; box-shadow: 0 22px 60px rgba(15, 34, 58, .22); font-size: 12px; line-height: 1.35; }
body.rm-admin .hist-dialog[open] { display: flex; flex-direction: column; }
body.rm-admin .hist-dialog::backdrop { background: rgba(15, 34, 58, .35); }
body.rm-admin .hist-head { flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 10px; }
body.rm-admin .hist-head small { display: block; color: var(--rm-secondary, #9295a1); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
body.rm-admin .hist-head h2 { margin: 2px 0 4px; color: var(--rm-heading, #303548); font-size: 1.2rem; line-height: 1.2; }
body.rm-admin .hist-head p { margin: 0; color: var(--rm-secondary, #9295a1); font-size: 12.5px; }
body.rm-admin .hist-head .icon-button { flex: 0 0 auto; width: 34px; min-width: 34px; height: 34px; font-size: 18px; }

/* ---- Filter chips ---- */
body.rm-admin .hist-filters { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 18px 12px; border-bottom: 1px solid #edf0f3; }
body.rm-admin .hist-chip { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 1px solid var(--rm-line, #e5e6e8); border-radius: 999px; background: #fff; color: var(--rm-text, #676a7b); font: inherit; font-size: 12px; font-weight: 650; letter-spacing: .01em; cursor: pointer;
  transition: color .16s, border-color .16s, background .16s; }
body.rm-admin .hist-chip:hover { color: var(--rm-primary, #142f53); border-color: #bdc9d9; background: var(--rm-primary-soft, #e9eff7); }
body.rm-admin .hist-chip.is-active { color: #fff; border-color: var(--rm-primary, #142f53); background: var(--rm-primary, #142f53); }
body.rm-admin .hist-chip:focus-visible { outline: 2px solid var(--rm-primary, #142f53); outline-offset: 2px; }

/* ---- Scrolling list, grouped by day ---- */
body.rm-admin .hist-scroll { flex: 1 1 auto; min-height: 200px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-gutter: stable; }
body.rm-admin .hist-scroll:focus-visible { outline: none; }
body.rm-admin .hist-list, body.rm-admin .hist-items { margin: 0; padding: 0; list-style: none; }
body.rm-admin .hist-day-head { position: sticky; top: 0; z-index: 2; margin: 0; padding: 9px 18px 6px; border-bottom: 1px solid #f0f3f6; background: #fff;
  color: #8a93a3; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
body.rm-admin .hist-items { padding: 4px 10px 8px; }
body.rm-admin .hist-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; column-gap: 11px; align-items: start; padding: 10px 8px; border-radius: 10px; }
body.rm-admin .hist-item + .hist-item { border-top: 1px solid #f0f3f6; }
body.rm-admin .hist-item.is-unseen { background: #fdfaf2; }
body.rm-admin .hist-item.is-unseen + .hist-item.is-unseen { border-top-color: #f3ecd9; }

/* Type icon in a tinted circle */
body.rm-admin .hist-ico { display: grid; place-items: center; width: 34px; height: 34px; margin-top: 1px; border-radius: 50%; background: #f1f5f8; color: #4d586a; font-size: 17px; }
body.rm-admin .hist-ico.tone-new { background: #eaf6ef; color: #2e7d55; }
body.rm-admin .hist-ico.tone-modified { background: #eaf4fb; color: #28679a; }
body.rm-admin .hist-ico.tone-cancelled { background: #fff0f0; color: #b33a3a; }
body.rm-admin .hist-ico.tone-block { background: #e9edf2; color: #4d586a; }
body.rm-admin .hist-ico.tone-unblock { background: #fff; color: #8a93a3; box-shadow: inset 0 0 0 1px #dfe4ea; }
body.rm-admin .hist-ico.tone-amber { background: #fff5df; color: #9a6817; }
body.rm-admin .hist-ico.tone-zelofy { background: linear-gradient(135deg, #0bc4f7 0%, #2563eb 58%, #6d5cf6 100%); box-shadow: 0 1px 2px rgba(11, 23, 57, .18); }
body.rm-admin .hist-ico.tone-zelofy.is-release { background: #eef3ff; box-shadow: inset 0 0 0 1px #d6e0f7; }
body.rm-admin .hist-zmark { display: block; width: 22px; height: 22px; padding: 2px; box-sizing: border-box; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(11, 23, 57, .25); object-fit: contain; }

/* Text block */
body.rm-admin .hist-main { min-width: 0; }
body.rm-admin .hist-top { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 7px; min-height: 20px; }
body.rm-admin .hist-title { color: #16304d; font-size: 13.5px; font-weight: 750; letter-spacing: -.01em; }
body.rm-admin .hist-unit { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 6px; background: #f1f5f8; color: #16304d; font-size: 11.5px; font-weight: 750; letter-spacing: .01em; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.rm-admin .hist-sub { margin-top: 3px; color: #526174; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
body.rm-admin .hist-dates { color: #263b54; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.rm-admin .hist-nights { color: #8a93a3; margin-left: 4px; }
body.rm-admin .hist-sep { margin: 0 5px; color: #b5bcc7; }
body.rm-admin .hist-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 6px; }
body.rm-admin .hist-who, body.rm-admin .hist-chan { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 20px; padding: 0 8px 0 7px; border-radius: 999px; background: #f1f5f8; color: #476078; font-size: 11px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.rm-admin .hist-who i { font-size: 13px; line-height: 1; }
body.rm-admin .hist-who.is-zelofy { background: #eef3ff; color: #1d3f9a; }
body.rm-admin .hist-who-mark { display: block; width: 14px; height: 14px; border-radius: 50%; object-fit: contain; }
body.rm-admin .hist-who.is-channel, body.rm-admin .hist-chan { background: #fff; box-shadow: inset 0 0 0 1px #e4e9ef; }
body.rm-admin .hist-who.is-system { color: #6b7686; }
body.rm-admin .hist-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #868f9d; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
body.rm-admin .hist-dot.is-airbnb { background: #FF385C; }
body.rm-admin .hist-dot.is-booking { background: #003580; }
body.rm-admin .hist-dot.is-expedia { background: #f5cb40; }
body.rm-admin .hist-dot.is-vrbo { background: #2668b7; }
body.rm-admin .hist-dot.is-decolar { background: #5734a8; }
body.rm-admin .hist-dot.is-direct { background: var(--rm-accent, #d2aa61); }
body.rm-admin .hist-code { color: #8a93a3; font-size: 11px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
body.rm-admin .hist-state { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font-size: 9.5px; font-weight: 750; letter-spacing: .03em; text-transform: uppercase; }
body.rm-admin .hist-state.is-failed { color: #b33a3a; background: #fff0f0; }
body.rm-admin .hist-state.is-pending { color: #8a6738; background: #faf3e5; }

/* Time on the right; a gold dot marks what is new since the last opening */
body.rm-admin .hist-time { display: inline-flex; align-items: center; gap: 6px; padding-top: 2px; color: #8a93a3; font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.rm-admin .hist-item.is-unseen .hist-time { color: #6b5a3a; font-weight: 700; }
body.rm-admin .hist-item.is-unseen .hist-time::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rm-accent, #d2aa61); box-shadow: 0 0 0 3px rgba(210, 170, 97, .22); }
body.rm-admin .hist-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Loading / empty / error / load more ---- */
body.rm-admin .hist-status { padding: 6px 18px 16px; }
body.rm-admin .hist-status:empty { display: none; }
body.rm-admin .hist-block { display: grid; justify-items: center; gap: 8px; padding: 40px 16px 32px; color: #8a93a3; font-size: 12.5px; text-align: center; }
body.rm-admin .hist-block > i { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #f1f5f8; color: #8a93a3; font-size: 22px; }
body.rm-admin .hist-block.is-error > i { background: #fff0f0; color: #b33a3a; }
body.rm-admin .hist-block.is-error > span { color: #6b4a4a; }
body.rm-admin .hist-block.is-loading > i { background: transparent; color: var(--rm-primary, #142f53); animation: spin .7s linear infinite; }
body.rm-admin .hist-block .button { min-height: 36px; margin-top: 6px; padding: 0 14px; font-size: 12.5px; }
body.rm-admin .hist-more { width: 100%; min-height: 40px; font-size: 13px; }
body.rm-admin .hist-more i { font-size: 18px; }
body.rm-admin .hist-inline-error { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--rm-danger-soft, #ffe8e7); color: #b3261e; font-size: 12px; }
body.rm-admin .hist-end { margin: 0; padding: 8px 0 0; color: #b5bcc7; font-size: 11px; text-align: center; }
@media (prefers-reduced-motion: reduce) { body.rm-admin .hist-block.is-loading > i { animation: none; } }

/* ---- Footer note (from the server) ---- */
body.rm-admin .hist-note { flex: 0 0 auto; margin: 0; padding: 10px 18px 12px; border-top: 1px solid #edf0f3; background: #fafbfd; color: #8a93a3; font-size: 11px; line-height: 1.4; }
body.rm-admin .hist-note[hidden] { display: none; }

/* ---- Phones: full-screen sheet ---- */
@media (max-width: 780px) {
  body.rm-admin .hist-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  body.rm-admin .hist-head { padding: calc(14px + env(safe-area-inset-top)) 16px 8px; }
  body.rm-admin .hist-head h2 { font-size: 1.25rem; }
  body.rm-admin .hist-head .icon-button { width: 38px; min-width: 38px; height: 38px; }
  body.rm-admin .hist-filters { flex-wrap: nowrap; gap: 6px; padding: 4px 16px 12px; overflow-x: auto; scrollbar-width: none; }
  body.rm-admin .hist-filters::-webkit-scrollbar { display: none; }
  body.rm-admin .hist-chip { flex: 0 0 auto; height: 32px; padding: 0 14px; font-size: 12.5px; }
  body.rm-admin .hist-scroll { min-height: 0; }
  body.rm-admin .hist-day-head { padding: 9px 16px 6px; }
  body.rm-admin .hist-items { padding: 2px 8px 6px; }
  body.rm-admin .hist-item { grid-template-columns: 32px minmax(0, 1fr) auto; column-gap: 10px; padding: 11px 8px; }
  body.rm-admin .hist-ico { width: 32px; height: 32px; font-size: 16px; }
  body.rm-admin .hist-zmark { width: 21px; height: 21px; }
  body.rm-admin .hist-title { font-size: 14px; }
  body.rm-admin .hist-sub { font-size: 12.5px; }
  body.rm-admin .hist-status { padding: 6px 16px 16px; }
  body.rm-admin .hist-note { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
}

/* Daily booking totals: local-day complete aggregates, display only. */
body.rm-admin .hist-day-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:4px 12px; }
body.rm-admin .hist-day-totals { margin-left:auto; text-align:right; font-size:10.5px; letter-spacing:0; text-transform:none; font-weight:650; font-variant-numeric:tabular-nums; color:#526174; }
