/* Reports and customer history follow the shared salon palette. */
dialog.modal:has(.insights-history) { width: min(1040px, calc(100vw - 36px)); }
dialog.modal:has(.insights-history) .modal-body { padding: 25px; }
.insights-history-loading { min-height: 280px; }
.insights-repeat-cell { min-width: 180px; max-width: 230px; }
.insights-repeat-cell .btn { font-size: 10px; padding: 8px 10px; white-space: normal; text-align: left; }
.insights-repeat-note { display: block; max-width: 225px; color: var(--muted); font-size: 10px; line-height: 1.7; margin-top: 6px; white-space: normal; overflow-wrap: anywhere; }
.insights-customer-header { display: flex; align-items: center; gap: 17px; margin-bottom: 23px; }
.insights-customer-header > .avatar { width: 58px; height: 58px; font-size: 18px; flex-shrink: 0; }
.insights-customer-header > div { min-width: 0; flex: 1; }
.insights-customer-header .eyebrow { font-size: 8px; letter-spacing: .11em; margin-bottom: 7px; }
.insights-customer-header h2 { font-size: 23px; letter-spacing: -.035em; line-height: 1.2; margin: 0 0 9px; overflow-wrap: anywhere; }
.insights-contact { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 10px; }
.insights-contact > span { display: inline-flex; gap: 5px; align-items: center; overflow-wrap: anywhere; }
.insights-contact svg { width: 12px; height: 12px; flex-shrink: 0; }
.insights-profile-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.insights-profile-stats .stat-card { padding: 16px; border-radius: 12px; box-shadow: none; background: var(--surface-soft); }
.insights-profile-stats .stat-label { font-size: 10px; }
.insights-profile-stats .stat-icon { width: 27px; height: 27px; }
.insights-profile-stats .stat-value { font-size: 20px; letter-spacing: -.035em; margin: 12px 0 7px; }
.insights-profile-stats .stat-foot { font-size: 9px; line-height: 1.7; }
.insights-collection-breakdown { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 14px 3px 19px; color: var(--muted); font-size: 10px; border-bottom: 1px solid var(--border); }
.insights-collection-breakdown strong { color: var(--text); margin-left: 7px; font-weight: 550; font-variant-numeric: tabular-nums; }
.insights-customer-note { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }
.insights-customer-note .eyebrow { font-size: 8px; margin-bottom: 6px; }
.insights-customer-note p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; line-height: 1.8; }
.insights-history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 22px 0 15px; }
.insights-history-tabs button { display: flex; align-items: center; gap: 7px; }
.insights-history-tabs button > span { color: var(--subtle); font-size: 9px; }
.insights-history-table { border: 1px solid var(--border); border-radius: 12px; }
.insights-history-table table { min-width: 730px; }
.insights-history-table td, .insights-history-table th { padding: 13px 15px; }
.insights-history-table td { font-size: 10px; }
.insights-date { white-space: nowrap; font-size: 10px; }
.insights-money { font-weight: 550; white-space: nowrap; font-variant-numeric: tabular-nums; }
.insights-items { line-height: 1.8; }
.insights-history .badge.refunded { color: var(--red); background: var(--red-soft); }
.insights-payment-description { display: block; max-width: 270px; overflow-wrap: anywhere; line-height: 1.7; }
.insights-positive { color: var(--primary); }
.insights-negative { color: var(--red); }
.insights-history-more { display: flex; justify-content: center; margin-top: 18px; }
.insights-history-scope { text-align: center; color: var(--subtle); font-size: 9px; margin: 19px 0 0; }
.insights-empty { min-height: 190px; }
.insights-report-toolbar { align-items: flex-end; margin-bottom: 16px; }
.insights-range { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.insights-range .field label { color: var(--muted); font-size: 10px; }
.insights-range .field input { min-height: 37px; padding: 8px 10px; font-size: 11px; }
.insights-range > span { padding-bottom: 10px; color: var(--subtle); font-size: 12px; }
.insights-range .field-error { flex-basis: 100%; }
.insights-range .field-error:empty { display: none; }
.insights-report-scope { display: flex; align-items: center; gap: 9px; margin-bottom: 23px; color: var(--muted); font-size: 10px; flex-wrap: wrap; }
.insights-report-scope > svg { width: 14px; height: 14px; color: var(--primary); }
.insights-report-scope > strong { color: var(--primary-text); font-weight: 550; }
.insights-report-stats .stat-value { font-size: clamp(22px, 2.2vw, 28px); }
.insights-report-secondary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 20px 23px; margin-bottom: 24px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); gap: 20px; }
.insights-report-secondary > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.insights-report-secondary span { color: var(--muted); font-size: 10px; }
.insights-report-secondary strong { color: var(--text); font-weight: 550; font-size: 17px; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.insights-report-secondary small { color: var(--subtle); font-size: 8px; line-height: 1.6; }
.insights-chart-panel { margin-bottom: 24px; }
.insights-chart-legend { display: flex; gap: 22px; padding: 0 23px 20px; flex-wrap: wrap; align-items: center; }
.insights-chart-legend > span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.insights-chart-legend i { width: 7px; height: 7px; border-radius: 2px; }
.insights-chart-legend small { margin-left: auto; color: var(--subtle); font-size: 9px; }
.insights-chart-scroll { overflow-x: auto; overflow-y: hidden; margin: 0 23px; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.insights-chart { display: grid; grid-template-columns: repeat(var(--days), minmax(28px, 1fr)); min-width: calc(var(--days) * 28px); height: 242px; padding-top: 35px; gap: 5px; background: repeating-linear-gradient(to bottom, transparent 0px, transparent 46px, var(--border) 47px, transparent 48px); }
.insights-chart-day { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; outline-offset: -2px; }
.insights-chart-bars { height: 178px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; width: 100%; border-bottom: 1px solid var(--border-strong); }
.insights-chart-bars > i { display: block; width: min(14px, 38%); min-height: 2px; border-radius: 3px 3px 0 0; opacity: .85; }
.insights-bar-a { background: var(--primary); }
.insights-bar-b { background: var(--blue); }
.insights-bar-b.out { background: var(--orange); }
.insights-chart-date { margin-top: 8px; color: var(--subtle); font-size: 8px; white-space: nowrap; }
.insights-chart-tooltip { display: none; position: absolute; z-index: 2; top: 0; left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); box-shadow: var(--shadow-raised); border-radius: 8px; padding: 10px; white-space: nowrap; font-size: 9px; line-height: 1.7; pointer-events: none; }
.insights-chart-tooltip > * { display: block; }
.insights-chart-day:first-child .insights-chart-tooltip { left: 0; transform: none; }
.insights-chart-day:last-child .insights-chart-tooltip { left: auto; right: 0; transform: none; }
.insights-chart-day:hover .insights-chart-tooltip, .insights-chart-day:focus .insights-chart-tooltip { display: block; }
.insights-chart-day:hover .insights-chart-bars > i, .insights-chart-day:focus .insights-chart-bars > i { opacity: 1; }
.insights-chart-help { padding: 10px 23px 19px; margin: 0; color: var(--subtle); font-size: 9px; line-height: 1.8; }
.insights-rankings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-bottom: 24px; }
.insights-rankings .panel-heading > svg { width: 19px; height: 19px; color: var(--primary); }
.insights-ranking-table { max-height: 360px; overflow-y: auto; }
.insights-ranking-table table { min-width: 430px; }
.insights-ranking-table th { position: sticky; top: 0; z-index: 1; }
.insights-rank { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; color: var(--primary-text); background: var(--primary-soft); margin-right: 9px; font-size: 9px; }
.insights-methods-panel { margin-bottom: 20px; }
.insights-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; padding: 0 23px 23px; }
.insights-method { padding: 17px 19px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); }
.insights-method > div { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.insights-method svg { width: 16px; height: 16px; color: var(--primary); }
.insights-method dl { margin: 15px 0 0; display: grid; gap: 8px; }
.insights-method dl > div { display: flex; justify-content: space-between; gap: 12px; font-size: 10px; }
.insights-method dt { color: var(--muted); }
.insights-method dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }
.insights-method .net { padding-top: 10px; margin-top: 3px; border-top: 1px solid var(--border); font-weight: 550; }
.insights-method .net dt { color: var(--primary-text); }
.insights-basis-note { align-items: flex-start; }
.insights-basis-note strong { font-size: 11px; }
.insights-basis-note p { font-size: 10px; margin: 5px 0 0; line-height: 1.9; }
.insights-loading-block { display: block; width: min(600px, 100%); height: 180px; border-radius: 14px; }
@media (max-width: 1100px) {
  .insights-report-secondary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .insights-rankings { grid-template-columns: minmax(0, 1fr); }
  .insights-report-toolbar { align-items: flex-start; }
}
@media (max-width: 760px) {
  dialog.modal:has(.insights-history) .modal-body { padding: 18px; }
  .insights-customer-header { flex-wrap: wrap; gap: 12px; }
  .insights-customer-header > div { flex-basis: calc(100% - 74px); }
  .insights-customer-header > .btn { margin-left: 70px; }
  .insights-customer-header h2 { font-size: 20px; }
  .insights-profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insights-history-toolbar { flex-wrap: wrap; }
  .insights-history-tabs { max-width: 100%; }
  .insights-history-tabs button { padding: 8px; font-size: 10px; }
  .insights-report-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 16px; gap: 17px; }
  .insights-report-secondary > div:last-child { grid-column: 1 / -1; }
  .insights-report-secondary strong { font-size: 16px; }
  .insights-range { width: 100%; gap: 8px; }
  .insights-range .field { flex: 1; min-width: 0; }
  .insights-range > span { display: none; }
  .insights-range > .btn { width: 100%; justify-content: center; }
  .insights-presets { width: 100%; }
  .insights-presets button { flex: 1; }
  .insights-report-stats .stat-value { font-size: 22px; }
  .insights-chart-panel .panel-heading { align-items: flex-start; flex-wrap: wrap; }
  .insights-chart-legend { padding-inline: 16px; gap: 10px 17px; }
  .insights-chart-legend small { width: 100%; margin-left: 0; }
  .insights-chart-scroll { margin-inline: 16px; }
  .insights-chart-help { padding-inline: 16px; }
  .insights-methods { grid-template-columns: minmax(0, 1fr); padding: 0 16px 16px; gap: 10px; }
  .insights-method { padding: 15px; }
}
@media (prefers-reduced-motion: reduce) { .insights-chart-bars > i { transition: none; } }
