/* =============================================================================
   css/screens/reports.css
   Where things go on the Reports screen (js/screens/reports.js): the bar
   with Day / Month / Year and the date stepper, then the Day report
   (REP-02, docs/05-ux-spec.md screen 14 and section 6).

   Tablet and laptop (768px and up): the figures on the left, the bills,
   payments and returns on the right, each scrolling on its own. Phone: one
   column, the figures first ("tables first", section 6).

   Positioning only. The summary rows, bill rows, timeline, badges and the
   segmented control are components in components.css; every value here is
   a token (docs/05-ux-spec.md section 8, CLAUDE.md rule 9).
   ============================================================================= */

.reports {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  height: 100%;
  min-height: 0;
  padding: var(--space-3) var(--space-4);
}

/* -----------------------------------------------------------------------------
   THE BAR: title, Day / Month / Year, ◀ date ▶
   ----------------------------------------------------------------------------- */

.reports__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  flex: none;
}

.reports__bar h1 {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.reports__views {
  flex: 0 1 320px;
}

.reports__stepper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

/* The date reads as words; the real date input lies over it, invisible,
   so a tap anywhere on the words opens the picker. */
.reports__date {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  font-weight: var(--font-bold);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.reports__date-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* -----------------------------------------------------------------------------
   ONE DAY: figures left, lists right
   ----------------------------------------------------------------------------- */

.reports__body {
  flex: 1 1 auto;
  min-height: 0;
}

.reports__day {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: var(--space-4);
  height: 100%;
  min-height: 0;
}

.reports__figures,
.reports__lists {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.reports__state {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.reports__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.reports__section h2 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.reports__loading,
.reports__empty {
  padding: var(--space-5) 0;
}

/* Phone: one column, the page scrolls as a whole. */
@media (max-width: 767px) {
  .reports {
    height: auto;
    padding: var(--space-3);
  }

  .reports__stepper {
    margin-left: 0;
    width: 100%;
  }

  .reports__date {
    flex: 1 1 auto;
    min-width: 0;
  }

  .reports__views {
    flex: 1 1 100%;
  }

  .reports__day {
    display: flex;
    flex-direction: column;
    height: auto;
  }

  .reports__figures,
  .reports__lists {
    overflow: visible;
  }
}
