.report-heading {
  margin-bottom: 28px;
}

.report-controls {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.report-modes,
.report-period {
  display: flex;
  align-items: center;
}

.report-modes button,
.report-period > button:not(.text-button) {
  min-height: 40px;
  border: 1px solid var(--line);
  padding: 9px 14px;
  font: 700 .62rem var(--font-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.report-modes button + button {
  border-left: 0;
}

.report-modes button.selected {
  background: var(--text);
  color: var(--bg);
}

.report-period {
  gap: 10px;
}

.report-period strong {
  min-width: 170px;
  text-align: center;
  font: 700 .68rem var(--font-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
}

#report-project {
  min-height: 40px;
  margin-left: auto;
  border: 1px solid var(--line);
  padding: 8px 12px;
  background: var(--control);
  color: var(--text);
  font: 700 .62rem var(--font-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.report-totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  margin-bottom: 24px;
}

.report-totals div {
  min-height: 104px;
  padding: 18px 22px;
  border-right: 1px solid var(--line);
}

.report-totals div:last-child {
  border-right: 0;
}

.report-totals span {
  display: block;
  color: var(--muted);
  font: 700 .6rem var(--font-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.report-totals strong {
  display: block;
  margin-top: 8px;
  font: 400 2.25rem/1 var(--font-heading);
  white-space: nowrap;
}

.report-chart,
.report-table,
.report-activity,
.report-empty {
  position: relative;
  border: 1px solid var(--line);
  padding: 20px;
}

.report-chart h2,
.report-table h2,
.report-activity h2 {
  margin: 0;
  font: 400 1.9rem/1 var(--font-heading);
}

.report-chart > p {
  margin: 6px 0 14px;
  color: var(--muted);
}

.report-legend {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.report-legend span,
.report-table td:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.report-legend span {
  font: 700 .59rem var(--font-ui);
  letter-spacing: .07em;
  text-transform: uppercase;
}

.report-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: none;
  background: var(--swatch);
}

.report-chart-wrap {
  position: relative;
}

.report-chart svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.report-chart svg line {
  stroke: var(--line);
}

.report-chart svg text {
  fill: var(--muted);
  font: 700 10px var(--font-ui);
  letter-spacing: .04em;
}

.report-chart svg .chart-total {
  fill: var(--text);
}

.chart-bar {
  cursor: pointer;
}

.chart-hit {
  fill: transparent;
}

.report-tooltip {
  display: none;
  position: absolute;
  z-index: 2;
  top: 76px;
  right: 16px;
  min-width: 180px;
  border: 1px solid var(--line);
  padding: 11px;
  background: var(--bg);
  box-shadow: 4px 4px 0 var(--accent);
  font: 400 .72rem var(--font-ui);
}

.report-tooltip.visible {
  display: block;
}

.report-tooltip > strong,
.report-tooltip > b {
  display: block;
}

.report-tooltip ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.report-tooltip li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.report-tooltip li b {
  margin-left: auto;
}

.report-tables {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 24px;
  margin-top: 24px;
}

.report-table table {
  width: 100%;
  margin-top: 15px;
  border-collapse: collapse;
}

.report-table th {
  border-bottom: 1px solid var(--line);
  padding: 7px;
  text-align: left;
  font: 700 .57rem var(--font-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.report-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 7px;
  vertical-align: middle;
}

.report-table td:not(:first-child),
.report-table th:not(:first-child) {
  white-space: nowrap;
}

.report-percent {
  display: block;
  width: 78px;
  height: 5px;
  margin-top: 4px;
  background: linear-gradient(to right, var(--swatch) var(--percent), var(--surface) var(--percent));
}

.report-activity article {
  display: grid;
  grid-template-columns: 120px 150px 1fr auto;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.report-activity article p {
  margin: 0;
}

.report-empty {
  text-align: center;
}

.report-empty p {
  margin: 0 0 14px;
}

.muted {
  color: var(--muted);
}

@media (max-width: 720px) {
  .report-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  #report-project {
    width: 100%;
    margin-left: 0;
  }

  .report-totals {
    grid-template-columns: repeat(2, 1fr);
  }

  .report-totals div:nth-child(2) {
    border-right: 0;
  }

  .report-totals div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .report-totals strong {
    font-size: 1.9rem;
  }

  .report-tables {
    grid-template-columns: 1fr;
  }

  .report-table {
    overflow-x: auto;
  }

  .report-activity article {
    grid-template-columns: 1fr auto;
  }

  .report-activity article p {
    grid-column: 1 / -1;
  }
}

/* Review fix: with "Reportes" added, the sidebar is taller than short laptop
   screens (e.g. 720px), which cut off Planes, Respaldo and Cerrar sesión.
   Let the sidebar scroll instead of hiding its bottom items. */
.sidebar {
  overflow-y: auto;
}

.sidebar .lists-area {
  flex: 1 0 auto;
}

/* Review fixes: tables. "inline-flex" on the first cell broke the row borders;
   times, percentages and project names should not wrap. */
.report-table td:first-child {
  display: table-cell;
}

.report-table td .report-swatch {
  margin-right: 7px;
  vertical-align: middle;
}

.report-table td:not(:first-child),
.report-table td:nth-child(2) {
  white-space: nowrap;
}

.report-table td:not(:first-child) {
  font: 700 .78rem var(--font-ui);
}

.report-table td {
  vertical-align: middle;
}

/* The project column (first table) stays on one line next to its swatch. */
.report-tables .report-table:first-child td:first-child {
  white-space: nowrap;
}

@media (max-width: 720px) {
  /* "Tareas completadas" doesn't fit next to the bar on a phone. */
  .report-tables .report-table:first-child th:nth-child(4),
  .report-tables .report-table:first-child td:nth-child(4) {
    display: none;
  }
}

/* G3: export buttons at the end of the controls row. */
.report-export {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.report-export button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
